| To: | Robert Olsson <Robert.Olsson@xxxxxxxxxxx>, "David S. Miller" <davem@xxxxxxxxxx> |
|---|---|
| Subject: | [PATCH] pktgen - handle NETDEV_TX_LOCKED |
| From: | Stephen Hemminger <shemminger@xxxxxxxx> |
| Date: | Wed, 22 Sep 2004 14:11:58 -0700 |
| Cc: | netdev@xxxxxxxxxxx |
| Organization: | Open Source Development Lab |
| Sender: | netdev-bounce@xxxxxxxxxxx |
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@xxxxxxxx>
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 {
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [Bug 3440] New: eth0 freezes: "NETDEV WATCHDOG: eth0: transmit timed out ", Perolo Silantico |
|---|---|
| Next by Date: | Re: [Bug 3440] New: eth0 freezes: "NETDEV WATCHDOG: eth0: transmit timed out ", Stephen Hemminger |
| Previous by Thread: | [PATCH 1/1 2.6] RESEND ixgb: fix endianness issue for tx cleanup, Jesse Brandeburg |
| Next by Thread: | Re: [PATCH] pktgen - handle NETDEV_TX_LOCKED, David S. Miller |
| Indexes: | [Date] [Thread] [Top] [All Lists] |