1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 2e9117e50SBert Kenward /**************************************************************************** 3e9117e50SBert Kenward * Driver for Solarflare network controllers and boards 4e9117e50SBert Kenward * Copyright 2005-2006 Fen Systems Ltd. 5e9117e50SBert Kenward * Copyright 2006-2015 Solarflare Communications Inc. 6e9117e50SBert Kenward */ 7e9117e50SBert Kenward 8e9117e50SBert Kenward #ifndef EFX_TX_H 9e9117e50SBert Kenward #define EFX_TX_H 10e9117e50SBert Kenward 11e9117e50SBert Kenward #include <linux/types.h> 12e9117e50SBert Kenward 13e9117e50SBert Kenward /* Driver internal tx-path related declarations. */ 14e9117e50SBert Kenward 15e9117e50SBert Kenward unsigned int efx_tx_limit_len(struct efx_tx_queue *tx_queue, 16e9117e50SBert Kenward dma_addr_t dma_addr, unsigned int len); 17e9117e50SBert Kenward 18e9117e50SBert Kenward u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue, 19e9117e50SBert Kenward struct efx_tx_buffer *buffer, size_t len); 20e9117e50SBert Kenward 21*fe0c4060SEdward Cree /* What TXQ type will satisfy the checksum offloads required for this skb? */ efx_tx_csum_type_skb(struct sk_buff * skb)22*fe0c4060SEdward Creestatic inline unsigned int efx_tx_csum_type_skb(struct sk_buff *skb) 23*fe0c4060SEdward Cree { 24*fe0c4060SEdward Cree if (skb->ip_summed != CHECKSUM_PARTIAL) 25*fe0c4060SEdward Cree return 0; /* no checksum offload */ 26*fe0c4060SEdward Cree 27*fe0c4060SEdward Cree if (skb->encapsulation && 28*fe0c4060SEdward Cree skb_checksum_start_offset(skb) == skb_inner_transport_offset(skb)) { 29*fe0c4060SEdward Cree /* we only advertise features for IPv4 and IPv6 checksums on 30*fe0c4060SEdward Cree * encapsulated packets, so if the checksum is for the inner 31*fe0c4060SEdward Cree * packet, it must be one of them; no further checking required. 32*fe0c4060SEdward Cree */ 33*fe0c4060SEdward Cree 34*fe0c4060SEdward Cree /* Do we also need to offload the outer header checksum? */ 35*fe0c4060SEdward Cree if (skb_shinfo(skb)->gso_segs > 1 && 36*fe0c4060SEdward Cree !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) && 37*fe0c4060SEdward Cree (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)) 38*fe0c4060SEdward Cree return EFX_TXQ_TYPE_OUTER_CSUM | EFX_TXQ_TYPE_INNER_CSUM; 39*fe0c4060SEdward Cree return EFX_TXQ_TYPE_INNER_CSUM; 40*fe0c4060SEdward Cree } 41*fe0c4060SEdward Cree 42*fe0c4060SEdward Cree /* similarly, we only advertise features for IPv4 and IPv6 checksums, 43*fe0c4060SEdward Cree * so it must be one of them. No need for further checks. 44*fe0c4060SEdward Cree */ 45*fe0c4060SEdward Cree return EFX_TXQ_TYPE_OUTER_CSUM; 46*fe0c4060SEdward Cree } 47e9117e50SBert Kenward #endif /* EFX_TX_H */ 48