ipaq.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * USB Compaq iPAQ driver
  3. *
  4. * Copyright (C) 2001 - 2002
  5. * Ganesh Varadarajan <ganesh@veritas.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. */
  13. #ifndef __LINUX_USB_SERIAL_IPAQ_H
  14. #define __LINUX_USB_SERIAL_IPAQ_H
  15. /*
  16. * Since we can't queue our bulk write urbs (don't know why - it just
  17. * doesn't work), we can send down only one write urb at a time. The simplistic
  18. * approach taken by the generic usbserial driver will work, but it's not good
  19. * for performance. Therefore, we buffer upto URBDATA_QUEUE_MAX bytes of write
  20. * requests coming from the line discipline. This is done by chaining them
  21. * in lists of struct ipaq_packet, each packet holding a maximum of
  22. * PACKET_SIZE bytes.
  23. *
  24. * ipaq_write() can be called from bottom half context; hence we can't
  25. * allocate memory for packets there. So we initialize a pool of packets at
  26. * the first open and maintain a freelist.
  27. *
  28. * The value of PACKET_SIZE was empirically determined by
  29. * checking the maximum write sizes sent down by the ppp ldisc.
  30. * URBDATA_QUEUE_MAX is set to 64K, which is the maximum TCP window size.
  31. */
  32. struct ipaq_packet {
  33. char *data;
  34. size_t len;
  35. size_t written;
  36. struct list_head list;
  37. };
  38. struct ipaq_private {
  39. int active;
  40. int queue_len;
  41. int free_len;
  42. struct list_head queue;
  43. struct list_head freelist;
  44. };
  45. #define URBDATA_SIZE 4096
  46. #define URBDATA_QUEUE_MAX (64 * 1024)
  47. #define PACKET_SIZE 256
  48. #endif