qeth_tso.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * linux/drivers/s390/net/qeth_tso.h ($Revision: 1.4 $)
  3. *
  4. * Header file for qeth TCP Segmentation Offload support.
  5. *
  6. * Copyright 2004 IBM Corporation
  7. *
  8. * Author(s): Frank Pavlic <pavlic@de.ibm.com>
  9. *
  10. * $Revision: 1.4 $ $Date: 2005/03/24 09:04:18 $
  11. *
  12. */
  13. #ifndef __QETH_TSO_H__
  14. #define __QETH_TSO_H__
  15. extern int
  16. qeth_tso_send_packet(struct qeth_card *, struct sk_buff *,
  17. struct qeth_qdio_out_q *, int , int);
  18. struct qeth_hdr_ext_tso {
  19. __u16 hdr_tot_len;
  20. __u8 imb_hdr_no;
  21. __u8 reserved;
  22. __u8 hdr_type;
  23. __u8 hdr_version;
  24. __u16 hdr_len;
  25. __u32 payload_len;
  26. __u16 mss;
  27. __u16 dg_hdr_len;
  28. __u8 padding[16];
  29. } __attribute__ ((packed));
  30. struct qeth_hdr_tso {
  31. struct qeth_hdr hdr; /*hdr->hdr.l3.xxx*/
  32. struct qeth_hdr_ext_tso ext;
  33. } __attribute__ ((packed));
  34. /*some helper functions*/
  35. static inline int
  36. qeth_get_elements_no(struct qeth_card *card, void *hdr, struct sk_buff *skb)
  37. {
  38. int elements_needed = 0;
  39. if (skb_shinfo(skb)->nr_frags > 0)
  40. elements_needed = (skb_shinfo(skb)->nr_frags + 1);
  41. if (elements_needed == 0 )
  42. elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE)
  43. + skb->len) >> PAGE_SHIFT);
  44. if (elements_needed > QETH_MAX_BUFFER_ELEMENTS(card)){
  45. PRINT_ERR("qeth_do_send_packet: invalid size of "
  46. "IP packet. Discarded.");
  47. return 0;
  48. }
  49. return elements_needed;
  50. }
  51. #endif /* __QETH_TSO_H__ */