speedtch usbatm.c,1.20,1.21 usbatm.h,1.13,1.14
Duncan Sands
duncan at infradead.org
Tue Apr 26 17:28:06 EDT 2005
Update of /home/cvs/speedtch
In directory phoenix.infradead.org:/tmp/cvs-serv27934
Modified Files:
usbatm.c usbatm.h
Log Message:
Roman's simplified rx/tx logic. This doesn't mean I'm completely happy with
it, but the concept seems sound.
Index: usbatm.c
===================================================================
RCS file: /home/cvs/speedtch/usbatm.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- usbatm.c 26 Apr 2005 08:12:51 -0000 1.20
+++ usbatm.c 26 Apr 2005 21:28:03 -0000 1.21
@@ -96,22 +96,18 @@
static const char usbatm_driver_name[] = "usbatm";
-#define UDSL_MAX_RCV_URBS 4
-#define UDSL_MAX_SND_URBS 4
-#define UDSL_MAX_RCV_BUFS 8
-#define UDSL_MAX_SND_BUFS 8
+#define UDSL_MAX_RCV_URBS 16
+#define UDSL_MAX_SND_URBS 16
#define UDSL_MAX_RCV_BUF_SIZE 1024 /* ATM cells */
#define UDSL_MAX_SND_BUF_SIZE 1024 /* ATM cells */
[...1053 lines suppressed...]
+ for (i = 0; i < num_rcv_urbs + num_snd_urbs; i++) {
+ kfree(instance->transceivers[i].urb->transfer_buffer);
+ usb_free_urb(instance->transceivers[i].urb);
+ }
- for (i = 0; i < num_snd_bufs; i++)
- kfree(instance->send_buffers[i].base);
+ kfree(instance->transceivers);
/* ATM finalize */
if (instance->atm_dev)
@@ -1320,8 +1190,6 @@
if ((num_rcv_urbs > UDSL_MAX_RCV_URBS)
|| (num_snd_urbs > UDSL_MAX_SND_URBS)
- || (num_rcv_bufs > UDSL_MAX_RCV_BUFS)
- || (num_snd_bufs > UDSL_MAX_SND_BUFS)
|| (rcv_buf_size > UDSL_MAX_RCV_BUF_SIZE)
|| (snd_buf_size > UDSL_MAX_SND_BUF_SIZE))
return -EINVAL;
Index: usbatm.h
===================================================================
RCS file: /home/cvs/speedtch/usbatm.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- usbatm.h 14 Apr 2005 10:20:26 -0000 1.13
+++ usbatm.h 26 Apr 2005 21:28:03 -0000 1.14
@@ -124,55 +124,24 @@
extern void usbatm_usb_disconnect(struct usb_interface *intf);
-/* usbatm */
-
-#define UDSL_MAX_RCV_URBS 4
-#define UDSL_MAX_SND_URBS 4
-#define UDSL_MAX_RCV_BUFS 8
-#define UDSL_MAX_SND_BUFS 8
-#define UDSL_MAX_RCV_BUF_SIZE 1024 /* ATM cells */
-#define UDSL_MAX_SND_BUF_SIZE 1024 /* ATM cells */
-#define UDSL_DEFAULT_RCV_URBS 2
-#define UDSL_DEFAULT_SND_URBS 2
-#define UDSL_DEFAULT_RCV_BUFS 4
-#define UDSL_DEFAULT_SND_BUFS 4
-#define UDSL_DEFAULT_RCV_BUF_SIZE 64 /* ATM cells */
-#define UDSL_DEFAULT_SND_BUF_SIZE 64 /* ATM cells */
-
-
-/* receive */
-
-struct usbatm_receive_buffer {
+struct usbatm_channel {
+ int endpoint; /* usb pipe */
+ unsigned int stride; /* ATM cell size + padding */
+ unsigned int buf_size; /* urb buffer size */
+ spinlock_t lock;
struct list_head list;
- unsigned char *base;
- unsigned int filled_cells;
+ struct tasklet_struct tasklet;
+ struct timer_list delay;
+ struct work_struct clear_halt_work;
+ struct usbatm_data *usbatm;
};
-struct usbatm_receiver {
- struct list_head list;
- struct usbatm_receive_buffer *buffer;
+struct usbatm_transceiver {
struct urb *urb;
- struct usbatm_data *instance;
-};
-
-
-/* send */
-
-struct usbatm_send_buffer {
struct list_head list;
- unsigned char *base;
- unsigned char *free_start;
- unsigned int free_cells;
+ struct usbatm_channel *channel;
};
-struct usbatm_sender {
- struct list_head list;
- struct usbatm_send_buffer *buffer;
- struct urb *urb;
- struct usbatm_data *instance;
-};
-
-
/* main driver data */
struct usbatm_data {
@@ -189,10 +158,6 @@
struct usb_device *usb_dev;
struct usb_interface *usb_intf;
char description[64];
- int tx_endpoint;
- int rx_endpoint;
- int tx_padding;
- int rx_padding;
/* ATM device */
struct atm_dev *atm_dev;
@@ -212,31 +177,13 @@
/* ATM device */
struct list_head vcc_list;
- /* receive */
- struct usbatm_receiver receivers[UDSL_MAX_RCV_URBS];
- struct usbatm_receive_buffer receive_buffers[UDSL_MAX_RCV_BUFS];
-
- spinlock_t receive_lock;
- struct list_head spare_receivers;
- struct list_head filled_receive_buffers;
-
- struct tasklet_struct receive_tasklet;
- struct list_head spare_receive_buffers;
-
- /* send */
- struct usbatm_sender senders[UDSL_MAX_SND_URBS];
- struct usbatm_send_buffer send_buffers[UDSL_MAX_SND_BUFS];
-
- struct sk_buff_head sndqueue;
+ struct usbatm_transceiver *transceivers;
- spinlock_t send_lock;
- struct list_head spare_senders;
- struct list_head spare_send_buffers;
+ struct usbatm_channel rx_channel;
+ struct usbatm_channel tx_channel;
- struct tasklet_struct send_tasklet;
+ struct sk_buff_head sndqueue;
struct sk_buff *current_skb; /* being emptied */
- struct usbatm_send_buffer *current_buffer; /* being filled */
- struct list_head filled_send_buffers;
};
#endif /* _USBATM_H_ */
More information about the Usbatm-commits
mailing list