All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Cree <ecree@solarflare.com>
To: <linux-net-drivers@solarflare.com>, <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>
Subject: [PATCH net-next 09/14] sfc: factor out efx_tx_tso_header_length() and understand encapsulation
Date: Tue, 30 Jun 2020 13:13:15 +0100	[thread overview]
Message-ID: <ddebccd7-fbea-b8d5-1a3d-de5d56f63c73@solarflare.com> (raw)
In-Reply-To: <14a93b71-3d4e-4663-82be-a2281cd1105e@solarflare.com>

ef100 will need to check this against NIC limits.

Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 drivers/net/ethernet/sfc/tx_common.c | 17 +++++++++++++++--
 drivers/net/ethernet/sfc/tx_common.h |  1 +
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sfc/tx_common.c b/drivers/net/ethernet/sfc/tx_common.c
index 6ac19daa891a..2a058b76d1f0 100644
--- a/drivers/net/ethernet/sfc/tx_common.c
+++ b/drivers/net/ethernet/sfc/tx_common.c
@@ -311,6 +311,20 @@ struct efx_tx_buffer *efx_tx_map_chunk(struct efx_tx_queue *tx_queue,
 	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. */
 int efx_tx_map_data(struct efx_tx_queue *tx_queue, struct sk_buff *skb,
 		    unsigned int segment_count)
@@ -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
 		 * descriptor. Map this separately if necessary.
 		 */
-		size_t header_len = skb_transport_header(skb) - skb->data +
-				(tcp_hdr(skb)->doff << 2u);
+		size_t header_len = efx_tx_tso_header_length(skb);
 
 		if (header_len != len) {
 			tx_queue->tso_long_headers++;
diff --git a/drivers/net/ethernet/sfc/tx_common.h b/drivers/net/ethernet/sfc/tx_common.h
index 82e2e291317d..cbe995b024a6 100644
--- a/drivers/net/ethernet/sfc/tx_common.h
+++ b/drivers/net/ethernet/sfc/tx_common.h
@@ -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,
 				       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,
 		    unsigned int segment_count);
 


  parent reply	other threads:[~2020-06-30 12:13 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 12:00 [PATCH net-next 00/14] sfc: prerequisites for EF100 driver, part 2 Edward Cree
2020-06-30 12:02 ` [PATCH net-next 01/14] sfc: move NIC-specific mcdi_port declarations out of common header Edward Cree
2020-06-30 12:02 ` [PATCH net-next 02/14] sfc: commonise MCDI MAC stats handling Edward Cree
2020-06-30 12:03 ` [PATCH net-next 03/14] sfc: add missing licence info to mcdi_filters.c Edward Cree
2020-06-30 12:03 ` [PATCH net-next 04/14] sfc: commonise miscellaneous efx functions Edward Cree
2020-06-30 12:11 ` [PATCH net-next 05/14] sfc: commonise some MAC configuration code Edward Cree
2020-06-30 12:11 ` [PATCH net-next 06/14] sfc: commonise efx_sync_rx_buffer() Edward Cree
2020-06-30 12:12 ` [PATCH net-next 07/14] sfc: commonise TSO fallback code Edward Cree
2020-06-30 12:12 ` [PATCH net-next 08/14] sfc: remove duplicate declaration of efx_enqueue_skb_tso() Edward Cree
2020-06-30 12:13 ` Edward Cree [this message]
2020-06-30 12:13 ` [PATCH net-next 10/14] sfc: move definition of EFX_MC_STATS_GENERATION_INVALID Edward Cree
2020-06-30 12:14 ` [PATCH net-next 11/14] sfc: initialise max_[tx_]channels in efx_init_channels() Edward Cree
2020-06-30 12:14 ` [PATCH net-next 12/14] sfc: commonise efx->[rt]xq_entries initialisation Edward Cree
2020-06-30 12:15 ` [PATCH net-next 13/14] sfc: commonise initialisation of efx->vport_id Edward Cree
2020-06-30 12:15 ` [PATCH net-next 14/14] sfc: don't call tx_remove if there isn't one Edward Cree
2020-06-30 19:44 ` [PATCH net-next 00/14] sfc: prerequisites for EF100 driver, part 2 Jakub Kicinski
2020-06-30 20:09 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ddebccd7-fbea-b8d5-1a3d-de5d56f63c73@solarflare.com \
    --to=ecree@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.