Hi,
this change set against 2.5 will make kaweth put its private header
into the sk_buff directly if possible or else allocate a temporary sk_buff.
It saves memory and usually a copy.
Regards
Oliver
You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
[EMAIL PROTECTED], 2002-06-15 11:57:57+02:00, [EMAIL PROTECTED]
- eliminate a copy during tx if possible
-increased speed
-no permanently allocated buffer
diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
--- a/drivers/usb/net/kaweth.c Sat Jun 15 12:16:01 2002
+++ b/drivers/usb/net/kaweth.c Sat Jun 15 12:16:01 2002
@@ -220,10 +220,11 @@
struct urb *rx_urb;
struct urb *tx_urb;
struct urb *irq_urb;
+
+ struct sk_buff *tx_skb;
__u8 *firmware_buf;
__u8 scratch[KAWETH_SCRATCH_SIZE];
- __u8 tx_buf[KAWETH_BUF_SIZE];
__u8 rx_buf[KAWETH_BUF_SIZE];
__u8 intbuffer[INTBUFFERSIZE];
__u16 packet_filter_bitmap;
@@ -650,11 +651,13 @@
static void kaweth_usb_transmit_complete(struct urb *urb)
{
struct kaweth_device *kaweth = urb->context;
+ struct sk_buff *skb = kaweth->tx_skb;
if (unlikely(urb->status != 0))
kaweth_dbg("%s: TX status %d.", kaweth->net->name, urb->status);
netif_wake_queue(kaweth->net);
+ dev_kfree_skb(skb);
}
/****************************************************************
@@ -663,7 +666,7 @@
static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
{
struct kaweth_device *kaweth = net->priv;
- int count = skb->len;
+ char *private_header;
int res;
@@ -679,15 +682,30 @@
kaweth_async_set_rx_mode(kaweth);
netif_stop_queue(net);
- *((__u16 *)kaweth->tx_buf) = cpu_to_le16(skb->len);
+ /* We now decide whether we can put our special header into the sk_buff */
+ if (skb_cloned(skb) || skb_headroom(skb) < 2) {
+ /* no such luck - we make our own */
+ struct sk_buff *copied_skb;
+ copied_skb = skb_copy_expand(skb, 2, 0, GFP_ATOMIC);
+ dev_kfree_skb_any(skb);
+ skb = copied_skb;
+ if (!copied_skb) {
+ kaweth->stats.tx_errors++;
+ netif_start_queue(net);
+ spin_unlock(&kaweth->device_lock);
+ return 0;
+ }
+ }
- memcpy(kaweth->tx_buf + 2, skb->data, skb->len);
+ private_header = __skb_push(skb, 2);
+ *private_header = cpu_to_le16(skb->len);
+ kaweth->tx_skb = skb;
FILL_BULK_URB(kaweth->tx_urb,
kaweth->dev,
usb_sndbulkpipe(kaweth->dev, 2),
- kaweth->tx_buf,
- count + 2,
+ private_header,
+ skb->len,
kaweth_usb_transmit_complete,
kaweth);
kaweth->end = 0;
@@ -699,6 +717,7 @@
kaweth->stats.tx_errors++;
netif_start_queue(net);
+ dev_kfree_skb(skb);
}
else
{
@@ -706,8 +725,6 @@
kaweth->stats.tx_bytes += skb->len;
net->trans_start = jiffies;
}
-
- dev_kfree_skb(skb);
spin_unlock(&kaweth->device_lock);
===================================================================
This BitKeeper patch contains the following changesets:
1.627
## Wrapped with gzip_uu ##
begin 664 bkpatch1755
M'XL(`.$3"ST``ZU5;6_;-A#^+/Z*&PH,B1/;%*T7VYN#M.G6&MO0(%NQCP(M
MG6U!,JE15)U@ZG_?44H<&$D&+)T@@];Q[KF[YQY1;^!SC6;NZ3+_@H:]@8^Z
MMO2(2BL<;?4.RUPUMR-M-K1YHS5MCIUYW$>,5\70&L1ZO!<A(Y=K:=,MT$X]
M]_S1Y&"Q=Q7.O9N?/GS^]>T-8XL%7&VEVN#O:&&Q8*OB,FNP'!5&RZW+UAZV
M6\&Y[_LBY),P\L-63">3H/4COLKH;R;BV7H5S=C&X.:R#T_U[CA<\,@/!`^#
M0+1A%/.`O0=_%(D8N!CS:.R'X/OS,*;[C(LYY]!W=_D<#W#FPY"S=_#M-5^Q
M%(9`T+M<28L@(=75'62-R=4&["WD:ZAT7>>K$LD58)BKU*"L,8.Z0LQZH])0
MH=E)A<J6=R#+4J<$E\&J6:]IJK\`-2UF[/J1<S;\CQ=C7')V\4S3F7%4U>.F
M7HT+N4=+`WCL/^`SP=N)F/J3-HJBS.>!7*72#[-H^F\L'\$JM$?0;IXAGX5Q
M&+?!S`_#3E`O13ROK]>7S;ZE[(D0$U)BR^-9P#L9OE:%(H3A]'^48=58L%N$
MBCIP8MRBS-!`KJSN['61.#U!EAM,26<DJY[[3S`T^^XFF5R_.(972&XIA`#!
M/.;5UC2I/=0PL+=)7:Q^8.^%B,!GRR@4M#QQ(Q]80%_!\.(AB+QCYYWAEZ18
MT^GES"?T.R5`FG8'V"U>NI4&!O>4)#TESFDJ.B>W!,P;#^!/!*7WD&&:9PC[
M+24D\O8(J50=M;HQ[IU-<UF^2.U@S#QZY5TI25K2S+.N*FA;<"879K3>]<8?
M09S"W\QSV>D$J!LZ9<LF+6B4E'8G"^QRZKWJ<)]P0T=-CEG/B.<]/A%A77XZ
MB1*\K:3JBC@'<0[\'#[\?)V\_>/3;\NK4Q=V1&$BU=T]C92N0SI.XGK[[M'4
ME^\]C*>VTM8C&A(:HTU]=N9"/))0ODYHS]CDKP8;/"%+E\&KJUPEC:+3KCCY
M_@&%*LI33)RQ]S)H&Z.`NX>OC&Z:7M!/+X`)\XZ'2S4G72]54V_O&W<X@R=N
M:=4D5B<E^I'S&UZ4J)SGL=IZ-CO)S$C*RVC&G:(]Z*YCT/.#_0'OG"UC[CLA
@/B_6F#O0PT<VW6):U,UN$4M_-<%4LG\`L5""W.`'````
`
end
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel