* [PATCH] small loopback.c cleanups
@ 2003-08-17 0:57 Mitchell Blank Jr
2003-08-17 5:42 ` David S. Miller
0 siblings, 1 reply; 2+ messages in thread
From: Mitchell Blank Jr @ 2003-08-17 0:57 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
Few trivial cleanups/improvements to drivers/net/loopback.c Seems to work
fine for me, although I don't know how to stress all of the code paths.
Patch is versus 2.6.0-test3 (should apply to current BK fine)
-Mitch
--- linux-2.6.0-test3-VIRGIN/drivers/net/loopback.c 2003-07-13 20:30:48.000000000 -0700
+++ linux-2.6.0-test3mnb1/drivers/net/loopback.c 2003-08-16 08:37:29.000000000 -0700
@@ -128,17 +128,13 @@
* instead are lobbed from tx queue to rx queue
*/
- if(atomic_read(&skb->users) != 1)
- {
+ if (skb_shared(skb)) {
struct sk_buff *skb2=skb;
skb=skb_clone(skb, GFP_ATOMIC); /* Clone the buffer */
- if(skb==NULL) {
- kfree_skb(skb2);
+ kfree_skb(skb2);
+ if (unlikely(skb==NULL))
return 0;
- }
- kfree_skb(skb2);
- }
- else
+ } else
skb_orphan(skb);
skb->protocol=eth_type_trans(skb,dev);
@@ -148,12 +144,8 @@
#endif
if (skb_shinfo(skb)->tso_size) {
- struct iphdr *iph = skb->nh.iph;
-
- if (skb->protocol != htons(ETH_P_IP))
- BUG();
- if (iph->protocol != IPPROTO_TCP)
- BUG();
+ BUG_ON(skb->protocol != htons(ETH_P_IP));
+ BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP);
emulate_large_send_offload(skb);
return 0;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] small loopback.c cleanups
2003-08-17 0:57 [PATCH] small loopback.c cleanups Mitchell Blank Jr
@ 2003-08-17 5:42 ` David S. Miller
0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2003-08-17 5:42 UTC (permalink / raw)
To: Mitchell Blank Jr; +Cc: netdev
On Sat, 16 Aug 2003 17:57:06 -0700
Mitchell Blank Jr <mitch@sfgoth.com> wrote:
> Few trivial cleanups/improvements to drivers/net/loopback.c Seems to work
> fine for me, although I don't know how to stress all of the code paths.
>
> Patch is versus 2.6.0-test3 (should apply to current BK fine)
Patch applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-08-17 5:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-17 0:57 [PATCH] small loopback.c cleanups Mitchell Blank Jr
2003-08-17 5:42 ` 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).