Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / net / ethernet / sfc / siena / tx.h
blobee801950c9098a89ef199d29701c6a6c18d800ba
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2005-2006 Fen Systems Ltd.
5 * Copyright 2006-2015 Solarflare Communications Inc.
6 */
8 #ifndef EFX_TX_H
9 #define EFX_TX_H
11 #include <linux/types.h>
13 /* Driver internal tx-path related declarations. */
14 /* What TXQ type will satisfy the checksum offloads required for this skb? */
15 static inline unsigned int efx_tx_csum_type_skb(struct sk_buff *skb)
17 if (skb->ip_summed != CHECKSUM_PARTIAL)
18 return 0; /* no checksum offload */
20 if (skb->encapsulation &&
21 skb_checksum_start_offset(skb) == skb_inner_transport_offset(skb)) {
22 /* we only advertise features for IPv4 and IPv6 checksums on
23 * encapsulated packets, so if the checksum is for the inner
24 * packet, it must be one of them; no further checking required.
27 /* Do we also need to offload the outer header checksum? */
28 if (skb_shinfo(skb)->gso_segs > 1 &&
29 !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
30 (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM))
31 return EFX_TXQ_TYPE_OUTER_CSUM | EFX_TXQ_TYPE_INNER_CSUM;
32 return EFX_TXQ_TYPE_INNER_CSUM;
35 /* similarly, we only advertise features for IPv4 and IPv6 checksums,
36 * so it must be one of them. No need for further checks.
38 return EFX_TXQ_TYPE_OUTER_CSUM;
40 #endif /* EFX_TX_H */