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.
11 #include <linux/types.h>
13 /* Driver internal tx-path related declarations. */
15 unsigned int efx_tx_limit_len(struct efx_tx_queue
*tx_queue
,
16 dma_addr_t dma_addr
, unsigned int len
);
18 /* What TXQ type will satisfy the checksum offloads required for this skb? */
19 static inline unsigned int efx_tx_csum_type_skb(struct sk_buff
*skb
)
21 if (skb
->ip_summed
!= CHECKSUM_PARTIAL
)
22 return 0; /* no checksum offload */
24 if (skb
->encapsulation
&&
25 skb_checksum_start_offset(skb
) == skb_inner_transport_offset(skb
)) {
26 /* we only advertise features for IPv4 and IPv6 checksums on
27 * encapsulated packets, so if the checksum is for the inner
28 * packet, it must be one of them; no further checking required.
31 /* Do we also need to offload the outer header checksum? */
32 if (skb_shinfo(skb
)->gso_segs
> 1 &&
33 !(skb_shinfo(skb
)->gso_type
& SKB_GSO_PARTIAL
) &&
34 (skb_shinfo(skb
)->gso_type
& SKB_GSO_UDP_TUNNEL_CSUM
))
35 return EFX_TXQ_TYPE_OUTER_CSUM
| EFX_TXQ_TYPE_INNER_CSUM
;
36 return EFX_TXQ_TYPE_INNER_CSUM
;
39 /* similarly, we only advertise features for IPv4 and IPv6 checksums,
40 * so it must be one of them. No need for further checks.
42 return EFX_TXQ_TYPE_OUTER_CSUM
;