Rework ice Tx checksum
Subsystems (3)
cover Rework ice Tx checksum
Hi,
Jakub find the problem with how ice handles Tx checksum offload [1].
The issue is that IP_CSUM/IPV6_CSUM should support only basic packet types. Kernel assumes that if there are extensions headers and there is no HW_CSUM software fallback should be applied. Here is a patch that introduced that [2].
However, software fallback can't be applied when TSO offload happens. That is the situation that this patchset is fixing.
When TSO is enabled and IP_CSUM/IPV6_CSUM is on, kernel is assuming hardware will be able to calculate the checksum, but later on the extension headers are checked and if there is no HW_CSUM the skb_bad_offload() is called.
Following the documentation ice driver is capable of HW_CSUM support, so switch from IP_CSUM/IPV6_CSUM to HW_CSUM. Other Intel drivers (even previous like i40e, ixgbe) also supports HW_CSUM.
The HW_CSUM was used to indicate that GCS (Intel name for checksumming offload using additional descriptor) is support, which is variation of HW_CSUM. Even without GCS th HW_CSUM is supported. First patch is switching to use custom Tx ring flags to allow HW_CSUM usage.
[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/all/5fbeecfc311ea182aa1d1c771725ab8b4cac515e.1729778144.git.benoit.monin@gmx.fr/
Michal Swiatkowski (2):
ice: always do GCS if hardware supports it
ice: use NETIF_F_HW_CSUM instead of IP/IPV6
drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++++ drivers/net/ethernet/intel/ice/ice_main.c | 21 +-------------------- drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 1 + 4 files changed, 7 insertions(+), 21 deletions(-)
Signature · 1 line
2.49.0
PATCH 1/2 ice: always do GCS if hardware supports it
There is no need to check for NETIF_HW_CSUM. If the code reach calculating checksum it means that correct checksum flags are set, because kernel is checking that when setting ip->summed.
Instead of netdev feature flag use Tx ring flag to check if the hardware can use special descriptor for checksum calculating.
--- drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++++ drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_lib.c +4 -0
@@ -1415,6 +1415,10 @@ static int ice_vsi_alloc_rings(struct ice_vsi *vsi)set_bit (ICE_TX_RING_FLAGS_VLAN_L2TAG2 , ring->flags); else set_bit(ICE_TX_RING_FLAGS_VLAN_L2TAG1, ring->flags); + +if (ice_is_feature_supported (pf,ICE_F_GCS )) +set_bit (ICE_TX_RING_FLAGS_GCS , ring->flags); +WRITE_ONCE (vsi->tx_rings[i], ring); }
drivers/net/ethernet/intel/ice/ice_txrx.c +1 -1
@@ -1743,7 +1743,7 @@ int ice_tx_csum(struct ice_tx_buf *first, struct ice_tx_offload_params *off) l3_len = l4.hdr - ip.hdr; offset |= (l3_len /4 ) <<ICE_TX_DESC_LEN_IPLEN_S ; -if ((tx_ring->netdev->features &NETIF_F_HW_CSUM ) && +if (test_bit (ICE_TX_RING_FLAGS_GCS , tx_ring->flags) && !(first->tx_flags &ICE_TX_FLAGS_TSO ) && !skb_csum_is_sctp (skb)) {/* Set GCS */
drivers/net/ethernet/intel/ice/ice_txrx.h +1 -0
@@ -217,6 +217,7 @@ enum ice_tx_ring_flags {ICE_TX_RING_FLAGS_VLAN_L2TAG1 ,ICE_TX_RING_FLAGS_VLAN_L2TAG2 ,ICE_TX_RING_FLAGS_TXTIME , +ICE_TX_RING_FLAGS_GCS , ICE_TX_RING_FLAGS_NBITS, };
Signature · 1 line
2.49.0
RE: [Intel-wired-lan] [PATCH iwl-net v1 1/2] ice: always do GCS if hardware supports it
Quoted 15 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, April 28, 2026 12:07 AM
To: [email protected]
Cc: [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Loktionov, Aleksandr <[email protected]>; Michal Swiatkowski <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net v1 1/2] ice: always do GCS if hardware supports itThere is no need to check for
NETIF_HW_CSUM. If the code reach calculating checksum it means that correct checksum flags are set, because kernel is checking that when settingip->summed.Instead of netdev feature flag use Tx ring flag to check if the hardware can use special descriptor for checksum calculating.
Quoted 7 lines
Reviewed-by Przemek Kitszel <[email protected]>Reviewed-by Aleksandr Loktionov <[email protected]>Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_lib.c | 4 ++++ drivers/net/ethernet/intel/ice/ice_txrx.c | 2 +- drivers/net/ethernet/intel/ice/ice_txrx.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-)
PATCH 2/2 ice: use NETIF_F_HW_CSUM instead of IP/IPV6
In reply to Michal SwiatkowskiThe hardware is capable of calculating checksum for IPV6 packets with extension header. To not drop such packets switch from IP/IPV6 checksum to HW_CSUM.
HW_CSUM is also used in previous generation (i40e).
Previously HW_CSUM was used to indicate that hardware supports general checksum. Drop it assuming that if the hardware supports it, it is used.
Disabling offload for E830 in case of TSO isn't needed anymore as the check for TSO is done in Tx path just before preparation of the special GCS descriptor.
The commit from Fixes didn't introduce a bug, it just shown that the driver is doing sth wrong with the checksum features.
--- drivers/net/ethernet/intel/ice/ice_main.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +1 -20
@@ -3500,9 +3500,8 @@ void ice_set_netdev_features(struct net_device *netdev)NETIF_F_RXHASH ; csumo_features =NETIF_F_RXCSUM | -NETIF_F_IP_CSUM |NETIF_F_SCTP_CRC | -NETIF_F_IPV6_CSUM ; +NETIF_F_HW_CSUM ; vlano_features =NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_CTAG_TX |
@@ -3564,12 +3563,6 @@ void ice_set_netdev_features(struct net_device *netdev)/* Allow core to manage IRQs affinity */ netif_set_affinity_auto (netdev); -/* Mutual exclusivity for TSO and GCS is enforced by the set features -* ndo callback. -*/ -if (ice_is_feature_supported (pf,ICE_F_GCS )) - netdev->hw_features |=NETIF_F_HW_CSUM ; -netif_set_tso_max_size (netdev,ICE_MAX_TSO_SIZE ); }
@@ -6489,18 +6482,6 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)if (changed &NETIF_F_LOOPBACK ) ret =ice_set_loopback (vsi, !!(features &NETIF_F_LOOPBACK )); -/* Due to E830 hardware limitations, TSO (NETIF_F_ALL_TSO) with GCS -* (NETIF_F_HW_CSUM) is not supported. -*/ -if (ice_is_feature_supported (pf,ICE_F_GCS ) && - ((features &NETIF_F_HW_CSUM ) && (features &NETIF_F_ALL_TSO ))) { -if (netdev->features &NETIF_F_HW_CSUM ) -dev_err (ice_pf_to_dev (pf),"To enable TSO, you must first disable HW checksum.\n" ); -else -dev_err (ice_pf_to_dev (pf),"To enable HW checksum, you must first disable TSO.\n" ); -return -EIO ; - } -return ret; }
Signature · 1 line
2.49.0
RE: [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
Quoted 14 lines
-----Original Message-----
From: Michal Swiatkowski <[email protected]>
Sent: Tuesday, April 28, 2026 9:07 AM
To: [email protected]
Cc: [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Loktionov, Aleksandr <[email protected]>; Michal Swiatkowski <[email protected]>
Subject: [PATCH iwl-net v1 2/2] ice: useNETIF_F_HW_CSUMinstead of IP/IPV6
Quoted 3 lines
The hardware is capable of calculating checksum for IPV6 packets with extension header. To not drop such packets switch from IP/IPV6 checksum to
HW_CSUM.
I'd recommend "To not drop" -> "To avoid dropping"
Quoted 7 lines
HW_CSUMis also used in previous generation (i40e).Previously
HW_CSUMwas used to indicate that hardware supports general checksum. Drop it assuming that if the hardware supports it, it is used.
Quoted 7 lines
Disabling offload for E830 in case of TSO isn't needed anymore as the check for TSO is done in Tx path just before preparation of the special GCS descriptor.
The commit from Fixes didn't introduce a bug, it just shown that the driver is doing sth wrong with the checksum features.
Except commit message nits
Quoted 67 lines
Suggested-by Jakub Ramaseuski <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Fixes 04c20a9356f2 ("net: skip offload for NETIF_F_IPV6_CSUM if ipv6header contains extension")
Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +1
-2@@ -3500,9 +3500,8 @@ void ice_set_netdev_features(struct net_device *netdev)NETIF_F_RXHASH ; csumo_features =NETIF_F_RXCSUM | -NETIF_F_IP_CSUM |NETIF_F_SCTP_CRC | -NETIF_F_IPV6_CSUM ; +NETIF_F_HW_CSUM ; vlano_features = NETIF_F_HW_VLAN_CTAG_FILTER |drivers/net/ethernet/intel/ice/ice_main.c +0
-1NETIF_F_HW_VLAN_CTAG_TX |@@ -3564,12 +3563,6 @@ void ice_set_netdev_features(struct net_device *netdev)/* Allow core to manage IRQs affinity */ netif_set_affinity_auto (netdev); -/* Mutual exclusivity for TSO and GCS is enforced by the set features
drivers/net/ethernet/intel/ice/ice_main.c +0
-6-* ndo callback. -*/ -if (ice_is_feature_supported (pf,ICE_F_GCS )) - netdev->hw_features |=NETIF_F_HW_CSUM ; -netif_set_tso_max_size (netdev,ICE_MAX_TSO_SIZE ); }@@ -6489,18 +6482,6 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)if (changed &NETIF_F_LOOPBACK ) ret =ice_set_loopback (vsi, !!(features &NETIF_F_LOOPBACK )); -/* Due to E830 hardware limitations, TSO (NETIF_F_ALL_TSO) with GCS
drivers/net/ethernet/intel/ice/ice_main.c +0
-4-* (NETIF_F_HW_CSUM) is not supported. -*/ - if (ice_is_feature_supported(pf, ICE_F_GCS) && - ((features & NETIF_F_HW_CSUM) && (features &
NETIF_F_ALL_TSO))) {drivers/net/ethernet/intel/ice/ice_main.c +0
-2-if (netdev->features &NETIF_F_HW_CSUM ) - dev_err(ice_pf_to_dev(pf), "To enable TSO, youmust first disable HW checksum.\n");
drivers/net/ethernet/intel/ice/ice_main.c +0
-2-else - dev_err(ice_pf_to_dev(pf), "To enable HWchecksum, you must first disable TSO.\n");
drivers/net/ethernet/intel/ice/ice_main.c +0
-4-return -EIO ; - } -return ret; } --2.49.0
Simon Horman
reviewerRe: [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
In reply to Michal SwiatkowskiFrom: 'Simon Horman' <[email protected]>
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://sashiko.dev
---
ice: use NETIF_F_HW_CSUM instead of IP/IPV6
This commit replaces the IP and IPV6 checksum offload flags with HW_CSUM in the ice driver to allow hardware checksumming for IPv6 packets with extension headers. It also removes the mutual exclusivity check between TSO and GCS.
drivers/net/ethernet/intel/ice/ice_main.c void ice_set_netdev_features(struct net_device *netdev) · line 3495
Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_main.c +1
-2@@ -3491,9 +3491,8 @@ void ice_set_netdev_features(struct net_device *netdev)NETIF_F_RXHASH ; csumo_features =NETIF_F_RXCSUM | -NETIF_F_IP_CSUM |NETIF_F_SCTP_CRC | -NETIF_F_IPV6_CSUM ; +NETIF_F_HW_CSUM ;
By advertising NETIF_F_HW_CSUM, the network stack assumes the driver can handle checksums for any protocol and passes non-IP packets (e.g., from AF_PACKET injected frames) to the driver with CHECKSUM_PARTIAL.
Since ice_tx_csum() strictly parses the L3 header and expects IPv4 or IPv6, returning -1 for other protocols, will this regression cause non-IP packets to be silently dropped instead of falling back to software checksums in the kernel?
Additionally, skb_csum_hwoffload_help() relies on NETIF_F_IPV6_CSUM to safely fall back to software checksums when IPv6 extension headers are present.
Does using NETIF_F_HW_CSUM bypass this safeguard, potentially causing legacy hardware (like E810) or E830 without GCS descriptors to compute incorrect pseudo-headers and silently corrupt IPv6 packets with extension headers?
Finally, for protocols other than TCP, UDP, or SCTP, the driver falls back to calling skb_checksum_help(skb) in the default case of ice_tx_csum().
However, the driver appears to ignore the return value of skb_checksum_help().
If skb_checksum_help() fails (e.g., due to -ENOMEM during pskb_expand_head()), could this result in the packet being transmitted with an uncomputed checksum?
Simon Horman
reviewerRe: [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
Quoted 5 lines · Simon Horman
From: 'Simon Horman' <[email protected]>
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://sashiko.dev
Sorry, the email I am responding to was supposed to come with some commentary - it seems my method for adding it is broken :( So I'm adding it below (as best as I can remember what it was).
Quoted 25 lines
---
ice: useNETIF_F_HW_CSUMinstead of IP/IPV6This commit replaces the IP and IPV6 checksum offload flags with
HW_CSUMin the ice driver to allow hardware checksumming for IPv6 packets with extension headers. It also removes the mutual exclusivity check between TSO and GCS.drivers/net/ethernet/intel/ice/ice_main.c void ice_set_netdev_features(struct net_device *netdev) · line 3495
Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_main.c +1
-2@@ -3491,9 +3491,8 @@ void ice_set_netdev_features(struct net_device *netdev)NETIF_F_RXHASH ; csumo_features =NETIF_F_RXCSUM | -NETIF_F_IP_CSUM |NETIF_F_SCTP_CRC | -NETIF_F_IPV6_CSUM ; +NETIF_F_HW_CSUM ;By advertising
NETIF_F_HW_CSUM, the network stack assumes the driver can handle checksums for any protocol and passes non-IP packets (e.g., fromAF_PACKETinjected frames) to the driver withCHECKSUM_PARTIAL.
Quoted 3 lines
Since
ice_tx_csum()strictly parses the L3 header and expects IPv4 or IPv6, returning -1 for other protocols, will this regression cause non-IP packets to be silently dropped instead of falling back to software checksums in the kernel?
The problem above seems to be a legitimate concern, if a corner case. It seems to also exist in i40e.
Quoted 8 lines
Additionally,
skb_csum_hwoffload_help()relies onNETIF_F_IPV6_CSUMto safely fall back to software checksums when IPv6 extension headers are present.Does using
NETIF_F_HW_CSUMbypass this safeguard, potentially causing legacy hardware (like E810) or E830 without GCS descriptors to compute incorrect pseudo-headers and silently corrupt IPv6 packets with extension headers?
The issue above seems to be a false positive as the ice driver doesn't rely on the behaviour described. Rather ice_tx_csum() uses ipv6_skip_exthdr() to correctly handle extension headers.
Quoted 8 lines
Finally, for protocols other than TCP, UDP, or SCTP, the driver falls back to calling
skb_checksum_help(skb)in the default case ofice_tx_csum().However, the driver appears to ignore the return value of
skb_checksum_help().If
skb_checksum_help()fails (e.g., due to-ENOMEMduringpskb_expand_head()), could this result in the packet being transmitted with an uncomputed checksum?
The problem above seems real to me, but it also seems to be pre-existing. So I don't think it should delay progress of this patch.
If it is a problem, it also seems to be present in i40e.
Re: [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
Quoted 11 lines · Simon Horman
Quoted 5 lines · Simon Horman
From: 'Simon Horman' <[email protected]>
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://sashiko.dev
Sorry, the email I am responding to was supposed to come with some commentary - it seems my method for adding it is broken :( So I'm adding it below (as best as I can remember what it was).
Thanks for adding the comments.
Quoted 25 lines
Quoted 25 lines
---
ice: useNETIF_F_HW_CSUMinstead of IP/IPV6This commit replaces the IP and IPV6 checksum offload flags with
HW_CSUMin the ice driver to allow hardware checksumming for IPv6 packets with extension headers. It also removes the mutual exclusivity check between TSO and GCS.drivers/net/ethernet/intel/ice/ice_main.c void ice_set_netdev_features(struct net_device *netdev) · line 3495
Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_main.c +1
-2@@ -3491,9 +3491,8 @@ void ice_set_netdev_features(struct net_device *netdev)NETIF_F_RXHASH ; csumo_features =NETIF_F_RXCSUM | -NETIF_F_IP_CSUM |NETIF_F_SCTP_CRC | -NETIF_F_IPV6_CSUM ; +NETIF_F_HW_CSUM ;By advertising
NETIF_F_HW_CSUM, the network stack assumes the driver can handle checksums for any protocol and passes non-IP packets (e.g., fromAF_PACKETinjected frames) to the driver withCHECKSUM_PARTIAL.
Quoted 7 lines
Quoted 3 lines
Since
ice_tx_csum()strictly parses the L3 header and expects IPv4 or IPv6, returning -1 for other protocols, will this regression cause non-IP packets to be silently dropped instead of falling back to software checksums in the kernel?The problem above seems to be a legitimate concern, if a corner case. It seems to also exist in i40e.
I think there is a lack of skb_checksum_help() before one error return from ice_tx_csum(). I will add it.
Quoted 4 lines
Quoted 4 lines
Additionally,
skb_csum_hwoffload_help()relies onNETIF_F_IPV6_CSUMto safely fall back to software checksums when IPv6 extension headers are present.
Quoted 9 lines
Quoted 4 lines
Does using
NETIF_F_HW_CSUMbypass this safeguard, potentially causing legacy hardware (like E810) or E830 without GCS descriptors to compute incorrect pseudo-headers and silently corrupt IPv6 packets with extension headers?The issue above seems to be a false positive as the ice driver doesn't rely on the behaviour described. Rather
ice_tx_csum()usesipv6_skip_exthdr()to correctly handle extension headers.
Yeah, righ.
Quoted 6 lines
Quoted 6 lines
Finally, for protocols other than TCP, UDP, or SCTP, the driver falls back to calling
skb_checksum_help(skb)in the default case ofice_tx_csum().However, the driver appears to ignore the return value of
skb_checksum_help().
Quoted 7 lines
Quoted 2 lines
If
skb_checksum_help()fails (e.g., due to-ENOMEMduringpskb_expand_head()), could this result in the packet being transmitted with an uncomputed checksum?The problem above seems real to me, but it also seems to be pre-existing. So I don't think it should delay progress of this patch.
If it is a problem, it also seems to be present in i40e.
idpf, igbe too. It should return error in such case and drop the packet. What do you think, should I add the patch for that here or send it separately? To be honest I prefer sending it separately as this is in already exsisting code and touch more than one driver.
Thanks
Re: [Intel-wired-lan] [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
In reply to Michal SwiatkowskiQuoted 13 lines · Michal Swiatkowski
The hardware is capable of calculating checksum for IPV6 packets with extension header. To not drop such packets switch from IP/IPV6 checksum to
HW_CSUM.
HW_CSUMis also used in previous generation (i40e).Previously
HW_CSUMwas used to indicate that hardware supports general checksum. Drop it assuming that if the hardware supports it, it is used.Disabling offload for E830 in case of TSO isn't needed anymore as the check for TSO is done in Tx path just before preparation of the special GCS descriptor.
Quoted 8 lines
The commit from Fixes didn't introduce a bug, it just shown that the driver is doing sth wrong with the checksum features.
Suggested-by Jakub Ramaseuski <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Fixes 04c20a9356f2 ("net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension")Signed-off-by Michal Swiatkowski <[email protected]>---
Am I correct in thinking that this supersedes (really, properly fixes) the patch "ice: enable NETIF_F_HW_CSUM for GSO packets" at
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/
?
Thanks,
Jake
Re: [Intel-wired-lan] [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
Quoted 22 lines · Jacob Keller
Quoted 13 lines · Michal Swiatkowski
The hardware is capable of calculating checksum for IPV6 packets with extension header. To not drop such packets switch from IP/IPV6 checksum to
HW_CSUM.
HW_CSUMis also used in previous generation (i40e).Previously
HW_CSUMwas used to indicate that hardware supports general checksum. Drop it assuming that if the hardware supports it, it is used.Disabling offload for E830 in case of TSO isn't needed anymore as the check for TSO is done in Tx path just before preparation of the special GCS descriptor.
Quoted 8 lines
The commit from Fixes didn't introduce a bug, it just shown that the driver is doing sth wrong with the checksum features.
Suggested-by Jakub Ramaseuski <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Fixes 04c20a9356f2 ("net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension")Signed-off-by Michal Swiatkowski <[email protected]>---
Quoted 7 lines
Am I correct in thinking that this supersedes (really, properly fixes) the patch "ice: enable
NETIF_F_HW_CSUMfor GSO packets" at
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/
?Thanks,
Jake
Yes, exactly. I think I linked it in cover letter, but maybe I should do it also here.
Thanks
Re: [Intel-wired-lan] [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
Quoted 28 lines · Michal Swiatkowski
Quoted 27 lines · Jacob Keller
Quoted 13 lines · Michal Swiatkowski
The hardware is capable of calculating checksum for IPV6 packets with extension header. To not drop such packets switch from IP/IPV6 checksum to
HW_CSUM.
HW_CSUMis also used in previous generation (i40e).Previously
HW_CSUMwas used to indicate that hardware supports general checksum. Drop it assuming that if the hardware supports it, it is used.Disabling offload for E830 in case of TSO isn't needed anymore as the check for TSO is done in Tx path just before preparation of the special GCS descriptor.
Quoted 8 lines
The commit from Fixes didn't introduce a bug, it just shown that the driver is doing sth wrong with the checksum features.
Suggested-by Jakub Ramaseuski <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Fixes 04c20a9356f2 ("net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension")Signed-off-by Michal Swiatkowski <[email protected]>---
Am I correct in thinking that this supersedes (really, properly fixes) the patch "ice: enable
NETIF_F_HW_CSUMfor GSO packets" at
https://patchwork.ozlabs.org/project/intel-wired-lan/patch/[email protected]/
?
Quoted 7 lines
Quoted 2 lines
Thanks,
JakeYes, exactly. I think I linked it in cover letter, but maybe I should do it also here.
Thanks
I think its fine, I just wanted to make sure I was correct in marking that patch as rejected in patchwork.
Thanks,
Jake
RE: [Intel-wired-lan] [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
In reply to Michal SwiatkowskiQuoted 23 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Michal Swiatkowski
Sent: Tuesday, April 28, 2026 12:07 AM
To: [email protected]
Cc: [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Loktionov, Aleksandr <[email protected]>; Michal Swiatkowski <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-net v1 2/2] ice: useNETIF_F_HW_CSUMinstead of IP/IPV6The hardware is capable of calculating checksum for IPV6 packets with extension header. To not drop such packets switch from IP/IPV6 checksum to
HW_CSUM.
HW_CSUMis also used in previous generation (i40e).Previously
HW_CSUMwas used to indicate that hardware supports general checksum. Drop it assuming that if the hardware supports it, it is used.Disabling offload for E830 in case of TSO isn't needed anymore as the check for TSO is done in Tx path just before preparation of the special GCS descriptor.
The commit from Fixes didn't introduce a bug, it just shown that the driver is doing sth wrong with the checksum features.
Quoted 7 lines
Suggested-by Jakub Ramaseuski <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Fixes 04c20a9356f2 ("net: skip offload for NETIF_F_IPV6_CSUM if ipv6 header contains extension")Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)
RE: [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
In reply to Michal SwiatkowskiQuoted 97 lines
-----Original Message-----
From: Michal Swiatkowski <[email protected]>
Sent: Tuesday, April 28, 2026 9:07 AM
To: [email protected]
Cc: [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Loktionov, Aleksandr <[email protected]>; Michal Swiatkowski <[email protected]>
Subject: [PATCH iwl-net v1 2/2] ice: useNETIF_F_HW_CSUMinstead of IP/IPV6The hardware is capable of calculating checksum for IPV6 packets with extension header. To not drop such packets switch from IP/IPV6 checksum to
HW_CSUM.
HW_CSUMis also used in previous generation (i40e).Previously
HW_CSUMwas used to indicate that hardware supports general checksum. Drop it assuming that if the hardware supports it, it is used.Disabling offload for E830 in case of TSO isn't needed anymore as the check for TSO is done in Tx path just before preparation of the special GCS descriptor.
The commit from Fixes didn't introduce a bug, it just shown that the driver is doing sth wrong with the checksum features.
Suggested-by Jakub Ramaseuski <[email protected]>Reviewed-by Przemek Kitszel <[email protected]>Fixes 04c20a9356f2 ("net: skip offload for NETIF_F_IPV6_CSUM if ipv6header contains extension")
Signed-off-by Michal Swiatkowski <[email protected]>--- drivers/net/ethernet/intel/ice/ice_main.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)drivers/net/ethernet/intel/ice/ice_main.c +1
-2@@ -3500,9 +3500,8 @@ void ice_set_netdev_features(struct net_device *netdev)NETIF_F_RXHASH ; csumo_features =NETIF_F_RXCSUM | -NETIF_F_IP_CSUM |NETIF_F_SCTP_CRC | -NETIF_F_IPV6_CSUM ; +NETIF_F_HW_CSUM ; vlano_features = NETIF_F_HW_VLAN_CTAG_FILTER |drivers/net/ethernet/intel/ice/ice_main.c +0
-1NETIF_F_HW_VLAN_CTAG_TX |@@ -3564,12 +3563,6 @@ void ice_set_netdev_features(struct net_device *netdev)/* Allow core to manage IRQs affinity */ netif_set_affinity_auto (netdev); -/* Mutual exclusivity for TSO and GCS is enforced by the set features
drivers/net/ethernet/intel/ice/ice_main.c +0
-6-* ndo callback. -*/ -if (ice_is_feature_supported (pf,ICE_F_GCS )) - netdev->hw_features |=NETIF_F_HW_CSUM ; -netif_set_tso_max_size (netdev,ICE_MAX_TSO_SIZE ); }@@ -6489,18 +6482,6 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)if (changed &NETIF_F_LOOPBACK ) ret =ice_set_loopback (vsi, !!(features &NETIF_F_LOOPBACK )); -/* Due to E830 hardware limitations, TSO (NETIF_F_ALL_TSO) with GCS
drivers/net/ethernet/intel/ice/ice_main.c +0
-4-* (NETIF_F_HW_CSUM) is not supported. -*/ - if (ice_is_feature_supported(pf, ICE_F_GCS) && - ((features & NETIF_F_HW_CSUM) && (features &
NETIF_F_ALL_TSO))) {drivers/net/ethernet/intel/ice/ice_main.c +0
-2-if (netdev->features &NETIF_F_HW_CSUM ) - dev_err(ice_pf_to_dev(pf), "To enable TSO, youmust first disable HW checksum.\n");
drivers/net/ethernet/intel/ice/ice_main.c +0
-2-else - dev_err(ice_pf_to_dev(pf), "To enable HWchecksum, you must first disable TSO.\n");
drivers/net/ethernet/intel/ice/ice_main.c +0
-4-return -EIO ; - } -return ret; } --
Quoted 1 line
2.49.0
[email protected]
AI reviewRe: [PATCH iwl-net v1 2/2] ice: use NETIF_F_HW_CSUM instead of IP/IPV6
In reply to Michal SwiatkowskiThank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Critical] Replacing NETIF_F_IPV6_CSUM with NETIF_F_HW_CSUM bypasses the kernel's software checksum…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Critical] Replacing NETIF_F_IPV6_CSUM with NETIF_F_HW_CSUM bypasses the kernel's software checksum fallback for IPv6 extension headers, causing hardware to silently corrupt checksums.
- [High] Advertising NETIF_F_HW_CSUM forces the kernel to offload checksums for non-IP protocols, which the driver's Tx path unconditionally drops.
- [High] Unconditionally advertising NETIF_F_HW_CSUM forces non-TCP/UDP/SCTP packets into a buggy software fallback in the driver's Tx hot path that ignores errors, leading to silently corrupted packets. --
commit f1566dd32ecb941ad20b193c17ecae7df05ca815
Author: Michal Swiatkowski <[email protected]>
ice: use NETIF_F_HW_CSUM instead of IP/IPV6
This commit replaces the IP and IPV6 checksum offload flags with HW_CSUM in the ice driver to allow hardware checksumming for IPv6 packets with extension headers. It also removes the mutual exclusivity check between TSO and GCS.
drivers/net/ethernet/intel/ice/ice_main.c void ice_set_netdev_features(struct net_device *netdev) · line 3495
Quoted 12 lines
drivers/net/ethernet/intel/ice/ice_main.c +1
-2@@ -3491,9 +3491,8 @@ void ice_set_netdev_features(struct net_device *netdev)NETIF_F_RXHASH ; csumo_features =NETIF_F_RXCSUM | -NETIF_F_IP_CSUM |NETIF_F_SCTP_CRC | -NETIF_F_IPV6_CSUM ; +NETIF_F_HW_CSUM ;
By advertising NETIF_F_HW_CSUM, the network stack assumes the driver can handle checksums for any protocol and passes non-IP packets (e.g., from AF_PACKET injected frames) to the driver with CHECKSUM_PARTIAL.
Since ice_tx_csum() strictly parses the L3 header and expects IPv4 or IPv6, returning -1 for other protocols, will this regression cause non-IP packets to be silently dropped instead of falling back to software checksums in the kernel?
Additionally, skb_csum_hwoffload_help() relies on NETIF_F_IPV6_CSUM to safely fall back to software checksums when IPv6 extension headers are present.
Does using NETIF_F_HW_CSUM bypass this safeguard, potentially causing legacy hardware (like E810) or E830 without GCS descriptors to compute incorrect pseudo-headers and silently corrupt IPv6 packets with extension headers?
Finally, for protocols other than TCP, UDP, or SCTP, the driver falls back to calling skb_checksum_help(skb) in the default case of ice_tx_csum().
However, the driver appears to ignore the return value of skb_checksum_help().
If skb_checksum_help() fails (e.g., due to -ENOMEM during pskb_expand_head()), could this result in the packet being transmitted with an uncomputed checksum?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2