speedtouch: recycle the receive urb's buffer. Currently, every time a receive urb
completes, its old buffer is thrown away and replaced with a new one. This patch
performs the minor changes needed to reuse the old buffer. We need a copy of the
sk_buff on the stack because atmsar_decode_rawcell mucks around with the data and
tail pointers. I'll fix atmsar_decode_rawcell some other day (or should I say
night).
speedtouch.c | 39 ++++++++++++++++++---------------------
1 files changed, 18 insertions(+), 21 deletions(-)
diff -Nru a/drivers/usb/misc/speedtouch.c b/drivers/usb/misc/speedtouch.c
--- a/drivers/usb/misc/speedtouch.c Thu Jan 23 21:39:09 2003
+++ b/drivers/usb/misc/speedtouch.c Thu Jan 23 21:39:09 2003
@@ -348,9 +348,10 @@
struct udsl_instance_data *instance = (struct udsl_instance_data *) data;
struct udsl_data_ctx *ctx;
unsigned long flags;
+ struct sk_buff skb;
struct urb *urb;
struct atmsar_vcc_data *atmsar_vcc = NULL;
- struct sk_buff *new = NULL, *skb = NULL, *tmp = NULL;
+ struct sk_buff *new = NULL, *tmp = NULL;
PDEBUG ("udsl_atm_processqueue entered\n");
@@ -368,27 +369,14 @@
PDEBUG ("udsl_atm_processqueue: processing urb with ctx %p,
urb %p, skb %p\n", ctx, urb, ctx->skb);
/* update the skb structure */
- skb = ctx->skb;
- skb_put (skb, urb->actual_length);
+ skb = *ctx->skb;
+ skb_put (&skb, urb->actual_length);
- /* get a new skb */
- ctx->skb = dev_alloc_skb (UDSL_RECEIVE_BUFFER_SIZE);
- if (!ctx->skb)
- PDEBUG ("No skb, loosing urb.\n");
- else {
- usb_fill_bulk_urb (urb,
- instance->usb_dev,
- usb_rcvbulkpipe (instance->usb_dev,
UDSL_ENDPOINT_DATA_IN),
- (unsigned char *) ctx->skb->data,
- UDSL_RECEIVE_BUFFER_SIZE,
udsl_usb_data_receive, ctx);
- usb_submit_urb (urb, GFP_ATOMIC);
- }
-
- PDEBUG ("skb = %p, skb->len = %d\n", skb, skb->len);
- PACKETDEBUG (skb->data, skb->len);
+ PDEBUG ("skb->len = %d\n", skb.len);
+ PACKETDEBUG (skb.data, skb.len);
while ((new =
- atmsar_decode_rawcell (instance->atmsar_vcc_list, skb,
+ atmsar_decode_rawcell (instance->atmsar_vcc_list, &skb,
&atmsar_vcc)) != NULL) {
PDEBUG ("(after cell processing)skb->len = %d\n",
new->len);
@@ -423,8 +411,17 @@
break;
}
}
- dev_kfree_skb (skb);
- default:
+
+ usb_fill_bulk_urb (urb,
+ instance->usb_dev,
+ usb_rcvbulkpipe (instance->usb_dev,
+UDSL_ENDPOINT_DATA_IN),
+ (unsigned char *) ctx->skb->data,
+ UDSL_RECEIVE_BUFFER_SIZE,
+udsl_usb_data_receive, ctx);
+ if (!usb_submit_urb (urb, GFP_ATOMIC))
+ break;
+ PDEBUG ("udsl_atm_processqueue: submission failed\n");
+ /* fall through */
+ default: /* error or urb unlinked */
break;
}
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel