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