Commit e7a25685 authored by Edward Cree's avatar Edward Cree Committed by David S. Miller

sfc: factor out efx_tx_tso_header_length() and understand encapsulation

ef100 will need to check this against NIC limits.
Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 93841000
...@@ -311,6 +311,20 @@ struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue, ...@@ -311,6 +311,20 @@ struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue,
return buffer; return buffer;
} }
int efx_tx_tso_header_length(struct sk_buff *skb)
{
size_t header_len;
if (skb->encapsulation)
header_len = skb_inner_transport_header(skb) -
skb->data +
(inner_tcp_hdr(skb)->doff << 2u);
else
header_len = skb_transport_header(skb) - skb->data +
(tcp_hdr(skb)->doff << 2u);
return header_len;
}
/* Map all data from an SKB for DMA and create descriptors on the queue. */ /* Map all data from an SKB for DMA and create descriptors on the queue. */
int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
unsigned int segment_count) unsigned int segment_count)
...@@ -339,8 +353,7 @@ int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, ...@@ -339,8 +353,7 @@ int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
/* For TSO we need to put the header in to a separate /* For TSO we need to put the header in to a separate
* descriptor. Map this separately if necessary. * descriptor. Map this separately if necessary.
*/ */
size_t header_len = skb_transport_header(skb) - skb->data + size_t header_len = efx_tx_tso_header_length(skb);
(tcp_hdr(skb)->doff << 2u);
if (header_len != len) { if (header_len != len) {
tx_queue->tso_long_headers++; tx_queue->tso_long_headers++;
......
...@@ -34,6 +34,7 @@ void efx_enqueue_unwind(struct efx_tx_queue *tx_queue, ...@@ -34,6 +34,7 @@ void efx_enqueue_unwind(struct efx_tx_queue *tx_queue,
struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue, struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue,
dma_addr_t dma_addr, size_t len); dma_addr_t dma_addr, size_t len);
int efx_tx_tso_header_length(struct sk_buff *skb);
int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb, int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
unsigned int segment_count); unsigned int segment_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment