netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: davem@davemloft.net, kuba@kernel.org, jesse.brandeburg@intel.com,
	anthony.l.nguyen@intel.com, cai.huoqing@linux.dev,
	netdev@vger.kernel.org, felipe@sipanda.io,
	justin.iurman@uliege.be
Cc: Tom Herbert <tom@herbertland.com>
Subject: [PATCH net-next v2 4/7] ice: Don't do TX csum offload with routing header present
Date: Mon,  1 Jul 2024 12:55:04 -0700	[thread overview]
Message-ID: <20240701195507.256374-5-tom@herbertland.com> (raw)
In-Reply-To: <20240701195507.256374-1-tom@herbertland.com>

When determining if the L4 checksum in an IPv6 packet can be offloaded
on transmit, call ipv6_skip_exthdr_no_rthdr to check for the presence
of a routing header. If a routing header is present, that is the
function return less than zero, then don't offload checksum and call
skb_checksum_help instead.

Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 drivers/net/ethernet/intel/ice/ice_txrx.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_txrx.c b/drivers/net/ethernet/intel/ice/ice_txrx.c
index 8bb743f78fcb..fd57ac52191e 100644
--- a/drivers/net/ethernet/intel/ice/ice_txrx.c
+++ b/drivers/net/ethernet/intel/ice/ice_txrx.c
@@ -1842,15 +1842,12 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
 				  ICE_TX_CTX_EIPT_IPV4_NO_CSUM;
 			l4_proto = ip.v4->protocol;
 		} else if (first->tx_flags & ICE_TX_FLAGS_IPV6) {
-			int ret;
-
 			tunnel |= ICE_TX_CTX_EIPT_IPV6;
 			exthdr = ip.hdr + sizeof(*ip.v6);
 			l4_proto = ip.v6->nexthdr;
-			ret = ipv6_skip_exthdr(skb, exthdr - skb->data,
-					       &l4_proto, &frag_off);
-			if (ret < 0)
-				return -1;
+			if (ipv6_skip_exthdr_no_rthdr(skb, exthdr - skb->data,
+						      &l4_proto, &frag_off) < 0)
+				goto no_csum_offload;
 		}
 
 		/* define outer transport */
@@ -1869,6 +1866,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
 			l4.hdr = skb_inner_network_header(skb);
 			break;
 		default:
+no_csum_offload:
 			if (first->tx_flags & ICE_TX_FLAGS_TSO)
 				return -1;
 
@@ -1928,9 +1926,10 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
 		cmd |= ICE_TX_DESC_CMD_IIPT_IPV6;
 		exthdr = ip.hdr + sizeof(*ip.v6);
 		l4_proto = ip.v6->nexthdr;
-		if (l4.hdr != exthdr)
-			ipv6_skip_exthdr(skb, exthdr - skb->data, &l4_proto,
-					 &frag_off);
+		if (l4.hdr != exthdr &&
+		    ipv6_skip_exthdr_no_rthdr(skb, exthdr - skb->data,
+					      &l4_proto, &frag_off) < 0)
+			goto no_csum_offload;
 	} else {
 		return -1;
 	}
@@ -1961,10 +1960,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off)
 		break;
 
 	default:
-		if (first->tx_flags & ICE_TX_FLAGS_TSO)
-			return -1;
-		skb_checksum_help(skb);
-		return 0;
+		goto no_csum_offload;
 	}
 
 	off->td_cmd |= cmd;
-- 
2.34.1


  parent reply	other threads:[~2024-07-01 19:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 19:55 [PATCH net-next v2 0/7] drivers: Fix drivers doing TX csum offload with EH Tom Herbert
2024-07-01 19:55 ` [PATCH net-next v2 1/7] ipv6: Add ipv6_skip_exthdr_no_rthdr Tom Herbert
2024-07-01 19:55 ` [PATCH net-next v2 2/7] i40e: Don't do TX csum offload with routing header present Tom Herbert
2024-07-01 19:55 ` [PATCH net-next v2 3/7] iavf: " Tom Herbert
2024-07-01 19:55 ` Tom Herbert [this message]
2024-07-01 19:55 ` [PATCH net-next v2 5/7] idpf: " Tom Herbert
2024-07-01 19:55 ` [PATCH net-next v2 6/7] hinic: " Tom Herbert
2024-07-01 19:55 ` [PATCH net-next v2 7/7] fm10k: " Tom Herbert
2024-07-02 10:31 ` [PATCH net-next v2 0/7] drivers: Fix drivers doing TX csum offload with EH Przemek Kitszel
2024-07-03 14:20   ` Greenwalt, Paul
     [not found]     ` <CALx6S35zhg8HAUj9_1=Zm=nV0mzSe-Batdo5qpjz6Zd4G8T17g@mail.gmail.com>
2024-07-03 15:02       ` Przemek Kitszel
2024-07-03 15:56         ` Tom Herbert
2024-07-03  1:46 ` Jakub Kicinski
2024-07-03 14:39   ` Tom Herbert

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=20240701195507.256374-5-tom@herbertland.com \
    --to=tom@herbertland.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=cai.huoqing@linux.dev \
    --cc=davem@davemloft.net \
    --cc=felipe@sipanda.io \
    --cc=jesse.brandeburg@intel.com \
    --cc=justin.iurman@uliege.be \
    --cc=kuba@kernel.org \
    --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).