xref: /openbmc/linux/include/net/tso.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2e876f208SEzequiel Garcia #ifndef _TSO_H
3e876f208SEzequiel Garcia #define _TSO_H
4e876f208SEzequiel Garcia 
5*d7b061b8SYunsheng Lin #include <linux/skbuff.h>
6e876f208SEzequiel Garcia #include <net/ip.h>
7e876f208SEzequiel Garcia 
89c77b803SEric Dumazet #define TSO_HEADER_SIZE		256
9f9cbe9a5SAntoine Ténart 
10e876f208SEzequiel Garcia struct tso_t {
11e876f208SEzequiel Garcia 	int	next_frag_idx;
12185c3e58SEric Dumazet 	int	size;
13e876f208SEzequiel Garcia 	void	*data;
14e876f208SEzequiel Garcia 	u16	ip_id;
15761b331cSEric Dumazet 	u8	tlen; /* transport header len */
168941faa1Semmanuel.grumbach@intel.com 	bool	ipv6;
17e876f208SEzequiel Garcia 	u32	tcp_seq;
18e876f208SEzequiel Garcia };
19e876f208SEzequiel Garcia 
20*d7b061b8SYunsheng Lin /* Calculate the worst case buffer count */
tso_count_descs(const struct sk_buff * skb)21*d7b061b8SYunsheng Lin static inline int tso_count_descs(const struct sk_buff *skb)
22*d7b061b8SYunsheng Lin {
23*d7b061b8SYunsheng Lin 	return skb_shinfo(skb)->gso_segs * 2 + skb_shinfo(skb)->nr_frags;
24*d7b061b8SYunsheng Lin }
25*d7b061b8SYunsheng Lin 
26504b9121SEric Dumazet void tso_build_hdr(const struct sk_buff *skb, char *hdr, struct tso_t *tso,
27e876f208SEzequiel Garcia 		   int size, bool is_last);
28504b9121SEric Dumazet void tso_build_data(const struct sk_buff *skb, struct tso_t *tso, int size);
29761b331cSEric Dumazet int tso_start(struct sk_buff *skb, struct tso_t *tso);
30e876f208SEzequiel Garcia 
31e876f208SEzequiel Garcia #endif	/* _TSO_H */
32