2 * linux/include/linux/inet_lro.h
4 * Large Receive Offload (ipv4 / tcp)
6 * (C) Copyright IBM Corp. 2007
9 * Jan-Bernd Themann <themann@de.ibm.com>
10 * Christoph Raisch <raisch@de.ibm.com>
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)
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.
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.
38 struct net_lro_stats
{
39 unsigned long aggregated
;
40 unsigned long flushed
;
41 unsigned long no_desc
;
45 * LRO descriptor for a tcp session
48 struct sk_buff
*parent
;
49 struct sk_buff
*last_skb
;
50 struct skb_frag_struct
*next_frag
;
53 struct vlan_group
*vgrp
;
59 u32 skb_tot_frags_len
;
61 u16 tcp_saw_tstamp
; /* timestamps enabled */
64 int pkt_aggr_cnt
; /* counts aggregated packets */
71 * Large Receive Offload (LRO) Manager
73 * Fields must be set by driver
77 struct net_device
*dev
;
78 struct net_lro_stats stats
;
81 unsigned long features
;
82 #define LRO_F_NAPI 1 /* Pass packets to stack via NAPI */
83 #define LRO_F_EXTRACT_VLAN_ID 2 /* Set flag if VLAN IDs are extracted
84 from received packets and eth protocol
85 is still ETH_P_8021Q */
88 * Set for generated SKBs that are not added to
89 * the frag list in fragmented mode
92 u32 ip_summed_aggr
; /* Set in aggregated SKBs: CHECKSUM_UNNECESSARY
95 int max_desc
; /* Max number of LRO descriptors */
96 int max_aggr
; /* Max number of LRO packets to be aggregated */
98 int frag_align_pad
; /* Padding required to properly align layer 3
99 * headers in generated skb when using frags */
101 struct net_lro_desc
*lro_arr
; /* Array of LRO descriptors */
104 * Optimized driver functions
106 * get_skb_header: returns tcp and ip header for packet in SKB
108 int (*get_skb_header
)(struct sk_buff
*skb
, void **ip_hdr
,
109 void **tcpudp_hdr
, u64
*hdr_flags
, void *priv
);
112 #define LRO_IPV4 1 /* ip_hdr is IPv4 header */
113 #define LRO_TCP 2 /* tcpudp_hdr is TCP header */
116 * get_frag_header: returns mac, tcp and ip header for packet in SKB
118 * @hdr_flags: Indicate what kind of LRO has to be done
119 * (IPv4/IPv6/TCP/UDP)
121 int (*get_frag_header
)(struct skb_frag_struct
*frag
, void **mac_hdr
,
122 void **ip_hdr
, void **tcpudp_hdr
, u64
*hdr_flags
,
129 * @lro_mgr: LRO manager to use
130 * @skb: SKB to aggregate
131 * @priv: Private data that may be used by driver functions
132 * (for example get_tcp_ip_hdr)
135 void lro_receive_skb(struct net_lro_mgr
*lro_mgr
,
140 * Processes a SKB with VLAN HW acceleration support
143 void lro_vlan_hwaccel_receive_skb(struct net_lro_mgr
*lro_mgr
,
145 struct vlan_group
*vgrp
,
150 * Processes a fragment list
152 * This functions aggregate fragments and generate SKBs do pass
153 * the packets to the stack.
155 * @lro_mgr: LRO manager to use
156 * @frags: Fragment to be processed. Must contain entire header in first
158 * @len: Length of received data
159 * @true_size: Actual size of memory the fragment is consuming
160 * @priv: Private data that may be used by driver functions
161 * (for example get_tcp_ip_hdr)
164 void lro_receive_frags(struct net_lro_mgr
*lro_mgr
,
165 struct skb_frag_struct
*frags
,
166 int len
, int true_size
, void *priv
, __wsum sum
);
168 void lro_vlan_hwaccel_receive_frags(struct net_lro_mgr
*lro_mgr
,
169 struct skb_frag_struct
*frags
,
170 int len
, int true_size
,
171 struct vlan_group
*vgrp
,
173 void *priv
, __wsum sum
);
176 * Forward all aggregated SKBs held by lro_mgr to network stack
179 void lro_flush_all(struct net_lro_mgr
*lro_mgr
);
181 void lro_flush_pkt(struct net_lro_mgr
*lro_mgr
,
182 struct iphdr
*iph
, struct tcphdr
*tcph
);