Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /****************************************************************************
0003  * Driver for Solarflare network controllers and boards
0004  * Copyright 2005-2006 Fen Systems Ltd.
0005  * Copyright 2006-2015 Solarflare Communications Inc.
0006  */
0007 
0008 #ifndef EFX_TX_H
0009 #define EFX_TX_H
0010 
0011 #include <linux/types.h>
0012 
0013 /* Driver internal tx-path related declarations. */
0014 
0015 unsigned int efx_tx_limit_len(struct efx_tx_queue *tx_queue,
0016                   dma_addr_t dma_addr, unsigned int len);
0017 
0018 u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue,
0019                    struct efx_tx_buffer *buffer, size_t len);
0020 
0021 /* What TXQ type will satisfy the checksum offloads required for this skb? */
0022 static inline unsigned int efx_tx_csum_type_skb(struct sk_buff *skb)
0023 {
0024     if (skb->ip_summed != CHECKSUM_PARTIAL)
0025         return 0; /* no checksum offload */
0026 
0027     if (skb->encapsulation &&
0028         skb_checksum_start_offset(skb) == skb_inner_transport_offset(skb)) {
0029         /* we only advertise features for IPv4 and IPv6 checksums on
0030          * encapsulated packets, so if the checksum is for the inner
0031          * packet, it must be one of them; no further checking required.
0032          */
0033 
0034         /* Do we also need to offload the outer header checksum? */
0035         if (skb_shinfo(skb)->gso_segs > 1 &&
0036             !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
0037             (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM))
0038             return EFX_TXQ_TYPE_OUTER_CSUM | EFX_TXQ_TYPE_INNER_CSUM;
0039         return EFX_TXQ_TYPE_INNER_CSUM;
0040     }
0041 
0042     /* similarly, we only advertise features for IPv4 and IPv6 checksums,
0043      * so it must be one of them. No need for further checks.
0044      */
0045     return EFX_TXQ_TYPE_OUTER_CSUM;
0046 }
0047 #endif /* EFX_TX_H */