Update to 3.4-final.
[linux-flexiantxendom0-3.2.10.git] / drivers / xen / sfc_netfront / accel_ssr.h
1 /****************************************************************************
2  * Solarflare driver for Xen network acceleration
3  *
4  * Copyright 2006-2008: Solarflare Communications Inc,
5  *                      9501 Jeronimo Road, Suite 250,
6  *                      Irvine, CA 92618, USA
7  *
8  * Maintained by Solarflare Communications <linux-xen-drivers@solarflare.com>
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU General Public License version 2 as published
12  * by the Free Software Foundation, incorporated herein by reference.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  ****************************************************************************
23  */
24
25 #ifndef NETFRONT_ACCEL_SSR_H
26 #define NETFRONT_ACCEL_SSR_H
27
28 #include <linux/skbuff.h>
29 #include <linux/ip.h>
30 #include <linux/tcp.h>
31 #include <linux/list.h>
32
33 #include "accel.h"
34
35 /** State for Soft Segment Reassembly (SSR). */
36
37 struct netfront_accel_ssr_conn {
38         struct list_head link;
39
40         unsigned saddr, daddr;
41         unsigned short source, dest;
42
43         /** Number of in-order packets we've seen with payload. */
44         unsigned n_in_order_pkts;
45
46         /** Next in-order sequence number. */
47         unsigned next_seq;
48
49         /** Time we last saw a packet on this connection. */
50         unsigned long last_pkt_jiffies;
51
52         /** The SKB we are currently holding.  If NULL, then all following
53          * fields are undefined.
54          */
55         struct sk_buff *skb;
56
57         /** The tail of the frag_list of SKBs we're holding.  Only valid
58          * after at least one merge.
59          */
60         struct sk_buff *skb_tail;
61
62         /** The IP header of the skb we are holding. */
63         struct iphdr *iph;
64         
65         /** The TCP header of the skb we are holding. */
66         struct tcphdr *th;
67 };
68
69 extern void netfront_accel_ssr_init(struct netfront_accel_ssr_state *st);
70 extern void netfront_accel_ssr_fini(netfront_accel_vnic *vnic,
71                                     struct netfront_accel_ssr_state *st);
72
73 extern void
74 __netfront_accel_ssr_end_of_burst(netfront_accel_vnic *vnic,
75                                   struct netfront_accel_ssr_state *st);
76
77 extern int  netfront_accel_ssr_skb(netfront_accel_vnic *vnic,
78                                    struct netfront_accel_ssr_state *st,
79                                    struct sk_buff *skb);
80
81 static inline void
82 netfront_accel_ssr_end_of_burst (netfront_accel_vnic *vnic,
83                                  struct netfront_accel_ssr_state *st) {
84         if ( ! list_empty(&st->conns) )
85                 __netfront_accel_ssr_end_of_burst(vnic, st);
86 }
87
88 #endif /* NETFRONT_ACCEL_SSR_H */