blob: 83504dee3f57d9d72ee963772a3d63429bd729c7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
16
17extern int
18qeth_tso_send_packet(struct qeth_card *, struct sk_buff *,
19 struct qeth_qdio_out_q *, int , int);
20
21struct 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));
33
34struct qeth_hdr_tso {
35 struct qeth_hdr hdr; /*hdr->hdr.l3.xxx*/
36 struct qeth_hdr_ext_tso ext;
37} __attribute__ ((packed));
38
39/*some helper functions*/
40
41static inline int
42qeth_get_elements_no(struct qeth_card *card, void *hdr, struct sk_buff *skb)
43{
44 int elements_needed = 0;
45
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;
55 }
56 return elements_needed;
57}
58#endif /* __QETH_TSO_H__ */