netdev.vger.kernel.org archive mirror
 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 v2 net-next 15/15] sfc: extend common GRO interface to support CHECKSUM_COMPLETE
Date: Mon, 29 Jun 2020 14:36:56 +0100	[thread overview]
Message-ID: <d5bd28fc-f121-d408-e6d7-813d108bee31@solarflare.com> (raw)
In-Reply-To: <3750523f-1c2f-628d-1f71-39b355cf6661@solarflare.com>

EF100 will use CHECKSUM_COMPLETE, but will also make use of
 efx_rx_packet_gro(), thus needs to be able to pass the checksum value
 into that function.
Drivers for older NICs pass in a csum of 0 to get the old semantics (use
 the RX flags for CHECKSUM_UNNECESSARY marking).

Signed-off-by: Edward Cree <ecree@solarflare.com>
---
 drivers/net/ethernet/sfc/rx.c        |  2 +-
 drivers/net/ethernet/sfc/rx_common.c | 11 ++++++++---
 drivers/net/ethernet/sfc/rx_common.h |  2 +-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index a201a30b5d29..c73b933a9101 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -411,7 +411,7 @@ void __efx_rx_packet(struct efx_channel *channel)
 		rx_buf->flags &= ~EFX_RX_PKT_CSUMMED;
 
 	if ((rx_buf->flags & EFX_RX_PKT_TCP) && !channel->type->receive_skb)
-		efx_rx_packet_gro(channel, rx_buf, channel->rx_pkt_n_frags, eh);
+		efx_rx_packet_gro(channel, rx_buf, channel->rx_pkt_n_frags, eh, 0);
 	else
 		efx_rx_deliver(channel, eh, rx_buf, channel->rx_pkt_n_frags);
 out:
diff --git a/drivers/net/ethernet/sfc/rx_common.c b/drivers/net/ethernet/sfc/rx_common.c
index 9927e9ecbbb4..fb77c7bbe4af 100644
--- a/drivers/net/ethernet/sfc/rx_common.c
+++ b/drivers/net/ethernet/sfc/rx_common.c
@@ -510,7 +510,7 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic)
  */
 void
 efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
-		  unsigned int n_frags, u8 *eh)
+		  unsigned int n_frags, u8 *eh, __wsum csum)
 {
 	struct napi_struct *napi = &channel->napi_str;
 	struct efx_nic *efx = channel->efx;
@@ -528,8 +528,13 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
 	if (efx->net_dev->features & NETIF_F_RXHASH)
 		skb_set_hash(skb, efx_rx_buf_hash(efx, eh),
 			     PKT_HASH_TYPE_L3);
-	skb->ip_summed = ((rx_buf->flags & EFX_RX_PKT_CSUMMED) ?
-			  CHECKSUM_UNNECESSARY : CHECKSUM_NONE);
+	if (csum) {
+		skb->csum = csum;
+		skb->ip_summed = CHECKSUM_COMPLETE;
+	} else {
+		skb->ip_summed = ((rx_buf->flags & EFX_RX_PKT_CSUMMED) ?
+				  CHECKSUM_UNNECESSARY : CHECKSUM_NONE);
+	}
 	skb->csum_level = !!(rx_buf->flags & EFX_RX_PKT_CSUM_LEVEL);
 
 	for (;;) {
diff --git a/drivers/net/ethernet/sfc/rx_common.h b/drivers/net/ethernet/sfc/rx_common.h
index 3508dd316570..1672d74f30e2 100644
--- a/drivers/net/ethernet/sfc/rx_common.h
+++ b/drivers/net/ethernet/sfc/rx_common.h
@@ -67,7 +67,7 @@ void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic);
 
 void
 efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
-		  unsigned int n_frags, u8 *eh);
+		  unsigned int n_frags, u8 *eh, __wsum csum);
 
 struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx);
 struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id);

  parent reply	other threads:[~2020-06-29 19:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 13:30 [PATCH v2 net-next 00/15] sfc: prerequisites for EF100 driver, part 1 Edward Cree
2020-06-29 13:32 ` [PATCH v2 net-next 01/15] sfc: update MCDI protocol headers Edward Cree
2020-06-29 13:32 ` [PATCH v2 net-next 02/15] sfc: determine flag word automatically in efx_has_cap() Edward Cree
2020-06-29 13:33 ` [PATCH v2 net-next 03/15] sfc: extend bitfield macros up to POPULATE_DWORD_13 Edward Cree
2020-06-29 13:33 ` [PATCH v2 net-next 04/15] sfc: don't try to create more channels than we can have VIs Edward Cree
2020-06-29 13:34 ` [PATCH v2 net-next 05/15] sfc: refactor EF10 stats handling Edward Cree
2020-06-29 13:34 ` [PATCH v2 net-next 06/15] sfc: split up nic.h Edward Cree
2020-06-29 13:34 ` [PATCH v2 net-next 07/15] sfc: commonise ethtool link handling functions Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 08/15] sfc: commonise ethtool NFC and RXFH/RSS functions Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 09/15] sfc: commonise other ethtool bits Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 10/15] sfc: commonise FC advertising Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 11/15] sfc: track which BAR is mapped Edward Cree
2020-06-29 13:35 ` [PATCH v2 net-next 12/15] sfc: commonise PCI error handlers Edward Cree
2020-06-29 13:36 ` [PATCH v2 net-next 14/15] sfc: commonise ARFS handling Edward Cree
2020-06-29 13:36 ` Edward Cree [this message]
2020-06-29 13:39 ` [PATCH v2 net-next 13/15] sfc: commonise drain event handling Edward Cree
2020-06-30  0:30 ` [PATCH v2 net-next 00/15] sfc: prerequisites for EF100 driver, part 1 Jakub Kicinski
2020-06-30  0:38   ` 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=d5bd28fc-f121-d408-e6d7-813d108bee31@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).