.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /**************************************************************************** |
---|
2 | 3 | * Driver for Solarflare network controllers and boards |
---|
3 | 4 | * Copyright 2005-2006 Fen Systems Ltd. |
---|
4 | 5 | * Copyright 2006-2015 Solarflare Communications Inc. |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify it |
---|
7 | | - * under the terms of the GNU General Public License version 2 as published |
---|
8 | | - * by the Free Software Foundation, incorporated herein by reference. |
---|
9 | 6 | */ |
---|
10 | 7 | |
---|
11 | 8 | #ifndef EFX_TX_H |
---|
.. | .. |
---|
21 | 18 | u8 *efx_tx_get_copy_buffer_limited(struct efx_tx_queue *tx_queue, |
---|
22 | 19 | struct efx_tx_buffer *buffer, size_t len); |
---|
23 | 20 | |
---|
24 | | -int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, struct sk_buff *skb, |
---|
25 | | - bool *data_mapped); |
---|
| 21 | +/* What TXQ type will satisfy the checksum offloads required for this skb? */ |
---|
| 22 | +static inline unsigned int efx_tx_csum_type_skb(struct sk_buff *skb) |
---|
| 23 | +{ |
---|
| 24 | + if (skb->ip_summed != CHECKSUM_PARTIAL) |
---|
| 25 | + return 0; /* no checksum offload */ |
---|
26 | 26 | |
---|
| 27 | + if (skb->encapsulation && |
---|
| 28 | + skb_checksum_start_offset(skb) == skb_inner_transport_offset(skb)) { |
---|
| 29 | + /* we only advertise features for IPv4 and IPv6 checksums on |
---|
| 30 | + * encapsulated packets, so if the checksum is for the inner |
---|
| 31 | + * packet, it must be one of them; no further checking required. |
---|
| 32 | + */ |
---|
| 33 | + |
---|
| 34 | + /* Do we also need to offload the outer header checksum? */ |
---|
| 35 | + if (skb_shinfo(skb)->gso_segs > 1 && |
---|
| 36 | + !(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) && |
---|
| 37 | + (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_TUNNEL_CSUM)) |
---|
| 38 | + return EFX_TXQ_TYPE_OUTER_CSUM | EFX_TXQ_TYPE_INNER_CSUM; |
---|
| 39 | + return EFX_TXQ_TYPE_INNER_CSUM; |
---|
| 40 | + } |
---|
| 41 | + |
---|
| 42 | + /* similarly, we only advertise features for IPv4 and IPv6 checksums, |
---|
| 43 | + * so it must be one of them. No need for further checks. |
---|
| 44 | + */ |
---|
| 45 | + return EFX_TXQ_TYPE_OUTER_CSUM; |
---|
| 46 | +} |
---|
27 | 47 | #endif /* EFX_TX_H */ |
---|