Root/
1 | /* |
2 | * linux/include/linux/inet_lro.h |
3 | * |
4 | * Large Receive Offload (ipv4 / tcp) |
5 | * |
6 | * (C) Copyright IBM Corp. 2007 |
7 | * |
8 | * Authors: |
9 | * Jan-Bernd Themann <themann@de.ibm.com> |
10 | * Christoph Raisch <raisch@de.ibm.com> |
11 | * |
12 | * |
13 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2, or (at your option) |
16 | * any later version. |
17 | * |
18 | * This program is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU General Public License for more details. |
22 | * |
23 | * You should have received a copy of the GNU General Public License |
24 | * along with this program; if not, write to the Free Software |
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ |
27 | |
28 | #ifndef __INET_LRO_H_ |
29 | #define __INET_LRO_H_ |
30 | |
31 | #include <net/ip.h> |
32 | #include <net/tcp.h> |
33 | |
34 | /* |
35 | * LRO statistics |
36 | */ |
37 | |
38 | struct net_lro_stats { |
39 | unsigned long aggregated; |
40 | unsigned long flushed; |
41 | unsigned long no_desc; |
42 | }; |
43 | |
44 | /* |
45 | * LRO descriptor for a tcp session |
46 | */ |
47 | struct net_lro_desc { |
48 | struct sk_buff *parent; |
49 | struct sk_buff *last_skb; |
50 | struct skb_frag_struct *next_frag; |
51 | struct iphdr *iph; |
52 | struct tcphdr *tcph; |
53 | __wsum data_csum; |
54 | __be32 tcp_rcv_tsecr; |
55 | __be32 tcp_rcv_tsval; |
56 | __be32 tcp_ack; |
57 | u32 tcp_next_seq; |
58 | u32 skb_tot_frags_len; |
59 | u16 ip_tot_len; |
60 | u16 tcp_saw_tstamp; /* timestamps enabled */ |
61 | __be16 tcp_window; |
62 | int pkt_aggr_cnt; /* counts aggregated packets */ |
63 | int vlan_packet; |
64 | int mss; |
65 | int active; |
66 | }; |
67 | |
68 | /* |
69 | * Large Receive Offload (LRO) Manager |
70 | * |
71 | * Fields must be set by driver |
72 | */ |
73 | |
74 | struct net_lro_mgr { |
75 | struct net_device *dev; |
76 | struct net_lro_stats stats; |
77 | |
78 | /* LRO features */ |
79 | unsigned long features; |
80 | #define LRO_F_NAPI 1 /* Pass packets to stack via NAPI */ |
81 | #define LRO_F_EXTRACT_VLAN_ID 2 /* Set flag if VLAN IDs are extracted |
82 | from received packets and eth protocol |
83 | is still ETH_P_8021Q */ |
84 | |
85 | /* |
86 | * Set for generated SKBs that are not added to |
87 | * the frag list in fragmented mode |
88 | */ |
89 | u32 ip_summed; |
90 | u32 ip_summed_aggr; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY |
91 | * or CHECKSUM_NONE */ |
92 | |
93 | int max_desc; /* Max number of LRO descriptors */ |
94 | int max_aggr; /* Max number of LRO packets to be aggregated */ |
95 | |
96 | int frag_align_pad; /* Padding required to properly align layer 3 |
97 | * headers in generated skb when using frags */ |
98 | |
99 | struct net_lro_desc *lro_arr; /* Array of LRO descriptors */ |
100 | |
101 | /* |
102 | * Optimized driver functions |
103 | * |
104 | * get_skb_header: returns tcp and ip header for packet in SKB |
105 | */ |
106 | int (*get_skb_header)(struct sk_buff *skb, void **ip_hdr, |
107 | void **tcpudp_hdr, u64 *hdr_flags, void *priv); |
108 | |
109 | /* hdr_flags: */ |
110 | #define LRO_IPV4 1 /* ip_hdr is IPv4 header */ |
111 | #define LRO_TCP 2 /* tcpudp_hdr is TCP header */ |
112 | |
113 | /* |
114 | * get_frag_header: returns mac, tcp and ip header for packet in SKB |
115 | * |
116 | * @hdr_flags: Indicate what kind of LRO has to be done |
117 | * (IPv4/IPv6/TCP/UDP) |
118 | */ |
119 | int (*get_frag_header)(struct skb_frag_struct *frag, void **mac_hdr, |
120 | void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags, |
121 | void *priv); |
122 | }; |
123 | |
124 | /* |
125 | * Processes a SKB |
126 | * |
127 | * @lro_mgr: LRO manager to use |
128 | * @skb: SKB to aggregate |
129 | * @priv: Private data that may be used by driver functions |
130 | * (for example get_tcp_ip_hdr) |
131 | */ |
132 | |
133 | void lro_receive_skb(struct net_lro_mgr *lro_mgr, |
134 | struct sk_buff *skb, |
135 | void *priv); |
136 | |
137 | /* |
138 | * Processes a fragment list |
139 | * |
140 | * This functions aggregate fragments and generate SKBs do pass |
141 | * the packets to the stack. |
142 | * |
143 | * @lro_mgr: LRO manager to use |
144 | * @frags: Fragment to be processed. Must contain entire header in first |
145 | * element. |
146 | * @len: Length of received data |
147 | * @true_size: Actual size of memory the fragment is consuming |
148 | * @priv: Private data that may be used by driver functions |
149 | * (for example get_tcp_ip_hdr) |
150 | */ |
151 | |
152 | void lro_receive_frags(struct net_lro_mgr *lro_mgr, |
153 | struct skb_frag_struct *frags, |
154 | int len, int true_size, void *priv, __wsum sum); |
155 | |
156 | /* |
157 | * Forward all aggregated SKBs held by lro_mgr to network stack |
158 | */ |
159 | |
160 | void lro_flush_all(struct net_lro_mgr *lro_mgr); |
161 | |
162 | void lro_flush_pkt(struct net_lro_mgr *lro_mgr, |
163 | struct iphdr *iph, struct tcphdr *tcph); |
164 | |
165 | #endif |
166 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9