[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240701012101.182784-5-tom@herbertland.com>
Date: Sun, 30 Jun 2024 18:20:58 -0700
From: Tom Herbert <tom@...bertland.com>
To: davem@...emloft.net,
kuba@...nel.org,
jesse.brandeburg@...el.com,
anthony.l.nguyen@...el.com,
cai.huoqing@...ux.dev,
netdev@...r.kernel.org,
felipe@...anda.io
Cc: Tom Herbert <tom@...anda.io>,
Tom Herbert <tom@...bertland.com>
Subject: [PATCH net-next 4/7] ice: Don't do TX csum offload with routing header present
From: Tom Herbert <tom@...anda.io>
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@...bertland.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
Powered by blists - more mailing lists