net: fix network drivers ndo_start_xmit() return values
Subsystems (3)
This patch contains the final driver ndo_start_xmit() return value fixups. I'm pretty sure I got them all ...
Please let me know whether you still want me to submit the remaining patches or whether I should wait until the -next tree is opened up again.
commit fbc7a709feec3792247fb8596ac3d91a6d2c9ecc
Author: Patrick McHardy <[email protected]> Date: Mon Jun 15 18:55:45 2009 +0200
net: fix network drivers ndo_start_xmit() return values
Fix up remaining drivers returning a magic or an errno value from their ndo_start_xmit() functions that were missed in the first pass:
- isdn_net: missed conversion
- bpqether: missed conversion: skb is freed, so return NETDEV_TX_OK
- hp100: intention appears to be to resubmit skb once resources are available, but due to no queue handling it is dropped for now.
- lapbether: skb is freed, so return NETDEV_TX_OK
Compile tested only.
drivers/isdn/i4l/isdn_net.c +1 -1
@@ -1300,7 +1300,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)netif_stop_queue (ndev); } } -return 1 ; +return NETDEV_TX_BUSY ; }/*
drivers/net/hamradio/bpqether.c +1 -1
@@ -260,7 +260,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)*/ if (!netif_running (dev)) {kfree_skb (skb); -return -ENODEV ; +return NETDEV_TX_OK ; }skb_pull (skb,1 );
drivers/net/hp100.c +17 -18
@@ -1495,13 +1495,8 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)hp100_outw (0x4210 ,TRACE );printk ("hp100: %s: start_xmit_bm\n" , dev->name);#endif - -if (skb ==NULL ) { -return 0 ; - } -if (skb->len <=0 ) -return 0 ; + goto drop;if (lp->chip ==HP100_CHIPID_SHASTA &&skb_padto (skb,ETH_ZLEN ))return 0 ;
@@ -1514,10 +1509,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)#endif /* not waited long enough since last tx? */ if (time_before (jiffies, dev->trans_start +HZ )) -return -EAGAIN ; + goto drop;if (hp100_check_lan (dev)) -return -EIO ; + goto drop;if (lp->lan_type ==HP100_LAN_100 && lp->hub_status <0 ) {/* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1551,7 +1546,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) } dev->trans_start = jiffies; -return -EAGAIN ; + goto drop; }/*
@@ -1591,6 +1586,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) dev->trans_start = jiffies;return 0 ; + +drop: +dev_kfree_skb (skb); +return NETDEV_TX_OK ; }
@@ -1648,16 +1647,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)hp100_outw (0x4212 ,TRACE );printk ("hp100: %s: start_xmit\n" , dev->name);#endif - -if (skb ==NULL ) { -return 0 ; - } -if (skb->len <=0 ) -return 0 ; + goto drop;if (hp100_check_lan (dev)) -return -EIO ; + goto drop;/* If there is not enough free memory on the card... */ i =hp100_inl (TX_MEM_FREE ) &0x7fffffff ;
@@ -1671,7 +1665,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)printk ("hp100: %s: trans_start timing problem\n" , dev->name);#endif -return -EAGAIN ; + goto drop; }if (lp->lan_type ==HP100_LAN_100 && lp->hub_status <0 ) {/* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1705,7 +1699,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) } } dev->trans_start = jiffies; -return -EAGAIN ; + goto drop; }for (i =0 ; i <6000 && (hp100_inb (OPTION_MSW ) &HP100_TX_CMD ); i++) {
@@ -1759,6 +1753,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)#endif return 0 ; + +drop: +dev_kfree_skb (skb); +return NETDEV_TX_OK ; + }
drivers/net/wan/lapbether.c +5 -9
@@ -149,46 +149,42 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)*/ static int lapbeth_xmit (struct sk_buff *skb,struct net_device *dev) { -int err = -ENODEV ; +int err;/* * Just to be *really* sure not to send anything if the interface * is down, the ethernet device may have gone. */ if (!netif_running (dev)) { +// XXX goto drop; }switch (skb->data[0 ]) {case 0x00 : - err =0 ;break ;case 0x01 :if ((err =lapb_connect_request (dev)) !=LAPB_OK )printk (KERN_ERR "lapbeth: lapb_connect_request " "error: %d\n" , err); - goto drop_ok; + goto drop;case 0x02 :if ((err =lapb_disconnect_request (dev)) !=LAPB_OK )printk (KERN_ERR "lapbeth: lapb_disconnect_request " "err: %d\n" , err);/* Fall thru */ default : - goto drop_ok; + goto drop; }skb_pull (skb,1 );if ((err =lapb_data_request (dev, skb)) !=LAPB_OK ) {printk (KERN_ERR "lapbeth: lapb_data_request error - %d\n" , err); - err = -ENOMEM ; goto drop; } - err =0 ; out: -return err; -drop_ok: - err =0 ; +return NETDEV_TX_OK ; drop:kfree_skb (skb); goto out;
Quoted 2 lines · Patrick McHardy
This patch contains the final driver
ndo_start_xmit()return value fixups. I'm pretty sure I got them all ...
...
drivers/net/hp100.c static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) · line 1588
Quoted 8 lines
commit
fbc7a709feec3792247fb8596ac3d91a6d2c9eccAuthor: Patrick McHardy <[email protected]> Date: Mon Jun 15 18:55:45 2009 +0200drivers/net/hp100.c +0
-0@@ -1591,6 +1586,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) dev->trans_start = jiffies;return 0 ;
??
Quoted 7 lines
drivers/net/hp100.c +4
-0+ +drop: +dev_kfree_skb (skb); +return NETDEV_TX_OK ; }
...
drivers/net/hp100.c static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 1755
Quoted 4 lines
drivers/net/hp100.c +0
-0@@ -1759,6 +1753,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)#endif return 0 ;
??
Quoted 15 lines
drivers/net/hp100.c +5
-0+ +drop: +dev_kfree_skb (skb); +return NETDEV_TX_OK ; + }drivers/net/wan/lapbether.c +0
-0@@ -149,46 +149,42 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)*/ static int lapbeth_xmit (struct sk_buff *skb,struct net_device *dev)
drivers/net/wan/lapbether.c static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb) · line 159
Quoted 10 lines
drivers/net/wan/lapbether.c +2
-1{ -int err = -ENODEV ; +int err;/* * Just to be *really* sure not to send anything if the interface * is down, the ethernet device may have gone. */ if (!netif_running (dev)) { +// XXX
/* XXX */ ??
Jarek P.
Quoted 3 lines · Jarek Poplawski
Quoted 2 lines · Patrick McHardy
This patch contains the final driver
ndo_start_xmit()return value fixups. I'm pretty sure I got them all ...
...You should probably revisit wireless/zd1201.c (return 0) btw.
Jarek P.
David Miller
maintainerFrom: Jarek Poplawski <[email protected]>
Date: Tue, 16 Jun 2009 07:12:04 +0000
Quoted 6 lines · Jarek Poplawski
Quoted 3 lines · Patrick McHardy
Quoted 2 lines
This patch contains the final driver
ndo_start_xmit()return value fixups. I'm pretty sure I got them all ......You should probably revisit
wireless/zd1201.c(return 0) btw.
Yes this patch needs a little bit more work :)
Quoted 9 lines · Jarek Poplawski
Quoted 9 lines
drivers/net/wan/lapbether.c +1
-1@@ -149,46 +149,42 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)*/ static int lapbeth_xmit (struct sk_buff *skb,struct net_device *dev) { -int err = -ENODEV ; +int err;
Quoted 6 lines
drivers/net/wan/lapbether.c static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb) · line 159
Quoted 6 lines
drivers/net/wan/lapbether.c +1
-0/* * Just to be *really* sure not to send anything if the interface * is down, the ethernet device may have gone. */ if (!netif_running (dev)) { +// XXX
Oops, wrong diff :) Will resend in a minute.
Quoted 9 lines · Jarek Poplawski
Quoted 5 lines · Jarek Poplawski
Quoted 3 lines · Patrick McHardy
This patch contains the final driver
ndo_start_xmit()return value fixups. I'm pretty sure I got them all ......You should probably revisit
wireless/zd1201.c(return 0) btw.
Whats wrong with that?
Quoted 8 lines · David Miller
From: Jarek Poplawski <[email protected]>
Date: Tue, 16 Jun 2009 07:12:04 +0000Quoted 4 lines · Jarek Poplawski
Quoted 3 lines · Patrick McHardy
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
This patch contains the final driver
ndo_start_xmit()return value fixups. I'm pretty sure I got them all ......You should probably revisit
wireless/zd1201.c(return 0) btw.Yes this patch needs a little bit more work :)
This one should be better.
commit acc5f221cf65ce481ddf8b7ef9e058a37562d709
Author: Patrick McHardy <[email protected]> Date: Tue Jun 16 11:31:52 2009 +0200
net: fix network drivers ndo_start_xmit() return values
Fix up remaining drivers returning a magic or an errno value from their ndo_start_xmit() functions that were missed in the first pass:
- isdn_net: missed conversion
- bpqether: missed conversion: skb is freed, so return NETDEV_TX_OK
- hp100: intention appears to be to resubmit skb once resources are available, but due to no queue handling it is dropped for now.
- lapbether: skb is freed, so return NETDEV_TX_OK
Compile tested only.
drivers/isdn/i4l/isdn_net.c +1 -1
@@ -1300,7 +1300,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)netif_stop_queue (ndev); } } -return 1 ; +return NETDEV_TX_BUSY ; }/*
drivers/net/hamradio/bpqether.c +1 -1
@@ -260,7 +260,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)*/ if (!netif_running (dev)) {kfree_skb (skb); -return -ENODEV ; +return NETDEV_TX_OK ; }skb_pull (skb,1 );
drivers/net/hp100.c +17 -18
@@ -1495,13 +1495,8 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)hp100_outw (0x4210 ,TRACE );printk ("hp100: %s: start_xmit_bm\n" , dev->name);#endif - -if (skb ==NULL ) { -return 0 ; - } -if (skb->len <=0 ) -return 0 ; + goto drop;if (lp->chip ==HP100_CHIPID_SHASTA &&skb_padto (skb,ETH_ZLEN ))return 0 ;
@@ -1514,10 +1509,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev)#endif /* not waited long enough since last tx? */ if (time_before (jiffies, dev->trans_start +HZ )) -return -EAGAIN ; + goto drop;if (hp100_check_lan (dev)) -return -EIO ; + goto drop;if (lp->lan_type ==HP100_LAN_100 && lp->hub_status <0 ) {/* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1551,7 +1546,7 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) } dev->trans_start = jiffies; -return -EAGAIN ; + goto drop; }/*
@@ -1591,6 +1586,10 @@ static int hp100_start_xmit_bm(struct sk_buff *skb, struct net_device *dev) dev->trans_start = jiffies;return 0 ; + +drop: +dev_kfree_skb (skb); +return NETDEV_TX_OK ; }
@@ -1648,16 +1647,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)hp100_outw (0x4212 ,TRACE );printk ("hp100: %s: start_xmit\n" , dev->name);#endif - -if (skb ==NULL ) { -return 0 ; - } -if (skb->len <=0 ) -return 0 ; + goto drop;if (hp100_check_lan (dev)) -return -EIO ; + goto drop;/* If there is not enough free memory on the card... */ i =hp100_inl (TX_MEM_FREE ) &0x7fffffff ;
@@ -1671,7 +1665,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)printk ("hp100: %s: trans_start timing problem\n" , dev->name);#endif -return -EAGAIN ; + goto drop; }if (lp->lan_type ==HP100_LAN_100 && lp->hub_status <0 ) {/* we have a 100Mb/s adapter but it isn't connected to hub */
@@ -1705,7 +1699,7 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev) } } dev->trans_start = jiffies; -return -EAGAIN ; + goto drop; }for (i =0 ; i <6000 && (hp100_inb (OPTION_MSW ) &HP100_TX_CMD ); i++) {
@@ -1759,6 +1753,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)#endif return 0 ; + +drop: +dev_kfree_skb (skb); +return NETDEV_TX_OK ; + }
drivers/net/wan/lapbether.c +5 -11
@@ -149,46 +149,40 @@ static int lapbeth_data_indication(struct net_device *dev, struct sk_buff *skb)*/ static int lapbeth_xmit (struct sk_buff *skb,struct net_device *dev) { -int err = -ENODEV ; +int err;/* * Just to be *really* sure not to send anything if the interface * is down, the ethernet device may have gone. */ -if (!netif_running (dev)) { +if (!netif_running (dev)) goto drop; - }switch (skb->data[0 ]) {case 0x00 : - err =0 ;break ;case 0x01 :if ((err =lapb_connect_request (dev)) !=LAPB_OK )printk (KERN_ERR "lapbeth: lapb_connect_request " "error: %d\n" , err); - goto drop_ok; + goto drop;case 0x02 :if ((err =lapb_disconnect_request (dev)) !=LAPB_OK )printk (KERN_ERR "lapbeth: lapb_disconnect_request " "err: %d\n" , err);/* Fall thru */ default : - goto drop_ok; + goto drop; }skb_pull (skb,1 );if ((err =lapb_data_request (dev, skb)) !=LAPB_OK ) {printk (KERN_ERR "lapbeth: lapb_data_request error - %d\n" , err); - err = -ENOMEM ; goto drop; } - err =0 ; out: -return err; -drop_ok: - err =0 ; +return NETDEV_TX_OK ; drop:kfree_skb (skb); goto out;
Quoted 5 lines · Patrick McHardy
Quoted 4 lines · Jarek Poplawski
Quoted 2 lines · Jarek Poplawski
On 15-06-2009 19:00, Patrick McHardy wrote:
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
This patch contains the final driver
ndo_start_xmit()return value fixups. I'm pretty sure I got them all ......You should probably revisit
wireless/zd1201.c(return 0) btw.Whats wrong with that?
I thought you wanted to replace it with NETDEV_TX_OK, but now I see you leave both variants in the last patch, so I'm not sure...
Jarek P.
@@ -1759,6 +1753,11 @@ static int hp100_start_xmit(struct sk_buff *skb, struct net_device *dev)
#endif
return 0;
+
+drop:
+ dev_kfree_skb(skb);
+ return NETDEV_TX_OK;
+
Quoted 6 lines · Jarek Poplawski
Quoted 5 lines · Patrick McHardy
Quoted 4 lines · Jarek Poplawski
Quoted 2 lines · Jarek Poplawski
On 15-06-2009 19:00, Patrick McHardy wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines
This patch contains the final driver
ndo_start_xmit()return value fixups. I'm pretty sure I got them all ......You should probably revisit
wireless/zd1201.c(return 0) btw.Whats wrong with that?
I thought you wanted to replace it with
NETDEV_TX_OK, but now I see you leave both variants in the last patch, so I'm not sure...
I wanted to do that in a seperate patch at the end of the merge window to avoid causing too much clashes with this (and catch any new drivers).
Quoted 1 line · Patrick McHardy
Jarek Poplawski wrote:
...
Quoted 6 lines
Quoted 2 lines
I thought you wanted to replace it with
NETDEV_TX_OK, but now I see you leave both variants in the last patch, so I'm not sure...I wanted to do that in a seperate patch at the end of the merge window to avoid causing too much clashes with this (and catch any new drivers).
NETDEV_TX_OK!
Jarek P.
From: Patrick McHardy <[email protected]>
Date: Tue, 16 Jun 2009 11:33:24 +0200
Quoted 5 lines
net: fix network drivers
ndo_start_xmit()return valuesFix up remaining drivers returning a magic or an errno value from their
ndo_start_xmit()functions that were missed in the first pass:
Quoted 7 lines
-
isdn_net: missed conversion
- bpqether: missed conversion: skb is freed, so returnNETDEV_TX_OK
- hp100: intention appears to be to resubmit skb once resources are available, but due to no queue handling it is dropped for now.
- lapbether: skb is freed, so returnNETDEV_TX_OKSigned-off-by Patrick McHardy <[email protected]>
Applied.