xref: /openbmc/linux/include/net/tso.h (revision 2a598d0b)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TSO_H
3 #define _TSO_H
4 
5 #include <linux/skbuff.h>
6 #include <net/ip.h>
7 
8 #define TSO_HEADER_SIZE		256
9 
10 struct tso_t {
11 	int	next_frag_idx;
12 	int	size;
13 	void	*data;
14 	u16	ip_id;
15 	u8	tlen; /* transport header len */
16 	bool	ipv6;
17 	u32	tcp_seq;
18 };
19 
20 /* Calculate the worst case buffer count */
21 static inline int tso_count_descs(const struct sk_buff *skb)
22 {
23 	return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags;
24 }
25 
26 void tso_build_hdr(const struct sk_buff *skb, char *hdr, struct tso_t *tso,
27 		   int size, bool is_last);
28 void tso_build_data(const struct sk_buff *skb, struct tso_t *tso, int size);
29 int tso_start(struct sk_buff *skb, struct tso_t *tso);
30 
31 #endif	/* _TSO_H */
32