tso.h 721 B

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