Skip to content

Commit 93d085d

Browse files
committed
Merge branch 'end-of-ip-csum'
Tom Herbert says: ==================== net: The beginning of the end for NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM Background: This patch set starts to address one front in the battle against protocol ossification. Protocol ossification describes the state that we have arrived at in the evolution of the Internet where we are materially limited to only using a very narrow range of protocols and protocol features. For instance, only TCP and UDP is sufficiently supported on the Internet so that deploying alternative protocols, such as SCTP and DCCP, are non-starters. Similarly, IP options and IPv6 extension headers are typically not considered feasible for wide deployment, so we have loss the extensibility of IP protocols. Protocol ossification is not only a problem on the Internet, but in the data center as well. A root cause of this seems to be narrow, protocol specific optimizations implemented in switches (for doing EMCP) and in NICs (NIC offloads). These tend to be performance optimization around TCP and UDP packets, and these have become requirements to implement performant network solutions at scale. Attempts to deal with protocol ossification in data center have yielded ad hoc, sub-optimal solutions. A main driver of foo-over-UDP (e.g. GRE/UDP, MPLS/UDP) is to leverage the existing EMCP and RSS support for UDP by setting the source port as an entropy value. This has seen some success, but the cost of additional overhead and layering limits its usefulness. An even more extreme solution is STT where non-TCP packets are spoofed as TCP to leverage NIC offloads. This patch set endeavours to address protocol ossification caused by techniques used in transmit checksum offload for NICs. Future work will address protocol ossification in the other primary NIC offloads-- namely receive checksum offload, LSO, LRO, and RSS. NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM: NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM exemplify the problem of protocol ossification. These features are relics from a simpler time in the Internet, before encapsulation, before GRE and IPIP. Many hardware vendors only saw the need to provide checksum offload for simple UDP and TCP packets over IPv4 (IPv6 support is an afterthought also). In today's Internet and data centers, checksum offload is well established as a valuable feature, but we can no longer afford to be contsrained to use a handful of protocols and features that are supported at the discretion of NIC vendors. Generic and protocol agnostic methods are needed. The actual interface that the stack uses with drivers for checksum offload is CHECKSUM_PARTIAL. This is a generic and protocol agnostic interface. A driver for a device that supports this generic interface advertises NETIF_F_HW_CSUM. Goals of this patch set: We propose that drivers advertise NETIF_F_HW_CSUM instead of protocol specific values of NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM. If the driver's device is constrained (for instance it can only offlaod simple IPv4 and IPv6 packets) then these constraints can be checked in the transmit path and skb_checksum_help would be called for packets that the driver is unable to offload. In order to facilitate this, we add some helper functions that takes a specification argument indicating the type of packets a device is able to offload. If a packet does not match the specification, the helper function calls skb_checksum_help. Benefits of this approach are: - Simplify the stack and clarify the interface for checksum offload - Encourage NIC vendors to implement the generic. protocol agnostic checksum offload methods in hardware - Encourage feature parity in NIC offloads for IPv4 and IPv6 Many drivers advertise NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM and it probably isn't feasible to convert them all in a given time frame (although if we could this would be a great simplification to the stack). A reasonable direction may be to declare that new drivers must use NETIF_F_HW_CSUM as NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM are considered deprecated. There is a class of drivers that should now be converted to advertise NETIF_F_HW_CSUM, namely those that support offload of ecapsulated checksums. These drivers have to date been using skb->encapsulation to infer that checksum offload is being performed for an encapsulated checksum. This is strictly not correct. skb->encapsulation indicates that the inner headers are valid in the skbuff, whereas the stack indicates checksum offload arguments exclusively in csum_start and csum_offset. At some point we may want to set the inner headers for an skbuff but offload the outer transport checksum, so this needs to be fixed. In this patch set: - Rename some of constants involved in checksum offload to be more reflective of their function - Eliminate NETIF_F_GEN_CSUM and NETIF_F_V[46]_CSUM entirely as unnecessary convolutions - Fix conditions in tcp_sendpage and tcp_sendmsg to take IP protocol into account when determining if checksum offload can be done - Add driver helper functions for determining if a checksum can be offloaded to a device. If not, the helper function can call skb_checksum_help - Document the checksum offload interface between the stack and drivers with detail and specifics Testing: Have been testing ixgbe and mlx4. No noticeable regressions seen yet. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents b4bc88a + 7a6ae71 commit 93d085d

File tree

41 files changed

+437
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+437
-114
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,12 +1067,12 @@ static netdev_features_t bond_fix_features(struct net_device *dev,
10671067
return features;
10681068
}
10691069

1070-
#define BOND_VLAN_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | \
1070+
#define BOND_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
10711071
NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
10721072
NETIF_F_HIGHDMA | NETIF_F_LRO)
10731073

1074-
#define BOND_ENC_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | NETIF_F_RXCSUM |\
1075-
NETIF_F_ALL_TSO)
1074+
#define BOND_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
1075+
NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
10761076

10771077
static void bond_compute_features(struct bonding *bond)
10781078
{
@@ -4182,7 +4182,6 @@ void bond_setup(struct net_device *bond_dev)
41824182
NETIF_F_HW_VLAN_CTAG_RX |
41834183
NETIF_F_HW_VLAN_CTAG_FILTER;
41844184

4185-
bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
41864185
bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL;
41874186
bond_dev->features |= bond_dev->hw_features;
41884187
}

drivers/net/ethernet/emulex/benet/be_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5289,7 +5289,7 @@ static netdev_features_t be_features_check(struct sk_buff *skb,
52895289
skb->inner_protocol != htons(ETH_P_TEB) ||
52905290
skb_inner_mac_header(skb) - skb_transport_header(skb) !=
52915291
sizeof(struct udphdr) + sizeof(struct vxlanhdr))
5292-
return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
5292+
return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
52935293

52945294
return features;
52955295
}

drivers/net/ethernet/ibm/ibmveth.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ static netdev_features_t ibmveth_fix_features(struct net_device *dev,
763763
*/
764764

765765
if (!(features & NETIF_F_RXCSUM))
766-
features &= ~NETIF_F_ALL_CSUM;
766+
features &= ~NETIF_F_CSUM_MASK;
767767

768768
return features;
769769
}
@@ -928,7 +928,8 @@ static int ibmveth_set_features(struct net_device *dev,
928928
rc1 = ibmveth_set_csum_offload(dev, rx_csum);
929929
if (rc1 && !adapter->rx_csum)
930930
dev->features =
931-
features & ~(NETIF_F_ALL_CSUM | NETIF_F_RXCSUM);
931+
features & ~(NETIF_F_CSUM_MASK |
932+
NETIF_F_RXCSUM);
932933
}
933934

934935
if (large_send != adapter->large_send) {

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@ static netdev_features_t fm10k_features_check(struct sk_buff *skb,
13571357
if (!skb->encapsulation || fm10k_tx_encap_offload(skb))
13581358
return features;
13591359

1360-
return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
1360+
return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
13611361
}
13621362

13631363
static const struct net_device_ops fm10k_netdev_ops = {

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8766,7 +8766,7 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,
87668766
if (skb->encapsulation &&
87678767
(skb_inner_mac_header(skb) - skb_transport_header(skb) >
87688768
I40E_MAX_TUNNEL_HDR_LEN))
8769-
return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
8769+
return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
87708770

87718771
return features;
87728772
}
@@ -8842,7 +8842,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
88428842

88438843
netdev->features = NETIF_F_SG |
88448844
NETIF_F_IP_CSUM |
8845-
NETIF_F_SCTP_CSUM |
8845+
NETIF_F_SCTP_CRC |
88468846
NETIF_F_HIGHDMA |
88478847
NETIF_F_GSO_UDP_TUNNEL |
88488848
NETIF_F_GSO_GRE |

drivers/net/ethernet/intel/i40evf/i40evf_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2321,7 +2321,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
23212321
netdev->features |= NETIF_F_HIGHDMA |
23222322
NETIF_F_SG |
23232323
NETIF_F_IP_CSUM |
2324-
NETIF_F_SCTP_CSUM |
2324+
NETIF_F_SCTP_CRC |
23252325
NETIF_F_IPV6_CSUM |
23262326
NETIF_F_TSO |
23272327
NETIF_F_TSO6 |

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2379,8 +2379,8 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
23792379
}
23802380

23812381
if (hw->mac.type >= e1000_82576) {
2382-
netdev->hw_features |= NETIF_F_SCTP_CSUM;
2383-
netdev->features |= NETIF_F_SCTP_CSUM;
2382+
netdev->hw_features |= NETIF_F_SCTP_CRC;
2383+
netdev->features |= NETIF_F_SCTP_CRC;
23842384
}
23852385

23862386
netdev->priv_flags |= IFF_UNICAST_FLT;

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8598,7 +8598,7 @@ ixgbe_features_check(struct sk_buff *skb, struct net_device *dev,
85988598

85998599
if (unlikely(skb_inner_mac_header(skb) - skb_transport_header(skb) >
86008600
IXGBE_MAX_TUNNEL_HDR_LEN))
8601-
return features & ~NETIF_F_ALL_CSUM;
8601+
return features & ~NETIF_F_CSUM_MASK;
86028602

86038603
return features;
86048604
}
@@ -8995,8 +8995,8 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
89958995
case ixgbe_mac_X540:
89968996
case ixgbe_mac_X550:
89978997
case ixgbe_mac_X550EM_x:
8998-
netdev->features |= NETIF_F_SCTP_CSUM;
8999-
netdev->hw_features |= NETIF_F_SCTP_CSUM |
8998+
netdev->features |= NETIF_F_SCTP_CRC;
8999+
netdev->hw_features |= NETIF_F_SCTP_CRC |
90009000
NETIF_F_NTUPLE;
90019001
break;
90029002
default:

drivers/net/ethernet/jme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2753,7 +2753,7 @@ static netdev_features_t
27532753
jme_fix_features(struct net_device *netdev, netdev_features_t features)
27542754
{
27552755
if (netdev->mtu > 1900)
2756-
features &= ~(NETIF_F_ALL_TSO | NETIF_F_ALL_CSUM);
2756+
features &= ~(NETIF_F_ALL_TSO | NETIF_F_CSUM_MASK);
27572757
return features;
27582758
}
27592759

drivers/net/ethernet/marvell/sky2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4380,7 +4380,7 @@ static netdev_features_t sky2_fix_features(struct net_device *dev,
43804380
*/
43814381
if (dev->mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_EC_U) {
43824382
netdev_info(dev, "checksum offload not possible with jumbo frames\n");
4383-
features &= ~(NETIF_F_TSO|NETIF_F_SG|NETIF_F_ALL_CSUM);
4383+
features &= ~(NETIF_F_TSO | NETIF_F_SG | NETIF_F_CSUM_MASK);
43844384
}
43854385

43864386
/* Some hardware requires receive checksum for RSS to work. */

drivers/net/ethernet/netronome/nfp/nfp_net_common.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,7 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev,
20712071
l4_hdr = ipv6_hdr(skb)->nexthdr;
20722072
break;
20732073
default:
2074-
return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
2074+
return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
20752075
}
20762076

20772077
if (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
@@ -2080,7 +2080,7 @@ nfp_net_features_check(struct sk_buff *skb, struct net_device *dev,
20802080
(l4_hdr == IPPROTO_UDP &&
20812081
(skb_inner_mac_header(skb) - skb_transport_header(skb) !=
20822082
sizeof(struct udphdr) + sizeof(struct vxlanhdr))))
2083-
return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
2083+
return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
20842084

20852085
return features;
20862086
}

drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ void pch_gbe_check_options(struct pch_gbe_adapter *adapter)
500500
val = XsumTX;
501501
pch_gbe_validate_option(&val, &opt, adapter);
502502
if (!val)
503-
dev->features &= ~NETIF_F_ALL_CSUM;
503+
dev->features &= ~NETIF_F_CSUM_MASK;
504504
}
505505
{ /* Flow Control */
506506
static const struct pch_gbe_option opt = {

drivers/net/ethernet/sfc/efx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,10 +3128,10 @@ static int efx_pci_probe(struct pci_dev *pci_dev,
31283128
net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
31293129
NETIF_F_HIGHDMA | NETIF_F_TSO |
31303130
NETIF_F_RXCSUM);
3131-
if (efx->type->offload_features & NETIF_F_V6_CSUM)
3131+
if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM))
31323132
net_dev->features |= NETIF_F_TSO6;
31333133
/* Mask for features that also apply to VLAN devices */
3134-
net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG |
3134+
net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG |
31353135
NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
31363136
NETIF_F_RXCSUM);
31373137
/* All offloads can be toggled */

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,15 +2402,15 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
24022402
features &= ~NETIF_F_RXCSUM;
24032403

24042404
if (!priv->plat->tx_coe)
2405-
features &= ~NETIF_F_ALL_CSUM;
2405+
features &= ~NETIF_F_CSUM_MASK;
24062406

24072407
/* Some GMAC devices have a bugged Jumbo frame support that
24082408
* needs to have the Tx COE disabled for oversized frames
24092409
* (due to limited buffer sizes). In this case we disable
24102410
* the TX csum insertionin the TDES and not use SF.
24112411
*/
24122412
if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN))
2413-
features &= ~NETIF_F_ALL_CSUM;
2413+
features &= ~NETIF_F_CSUM_MASK;
24142414

24152415
return features;
24162416
}

drivers/net/ipvlan/ipvlan_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static struct lock_class_key ipvlan_netdev_xmit_lock_key;
8888
static struct lock_class_key ipvlan_netdev_addr_lock_key;
8989

9090
#define IPVLAN_FEATURES \
91-
(NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
91+
(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
9292
NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_GSO_ROBUST | \
9393
NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \
9494
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)

drivers/net/loopback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static void loopback_setup(struct net_device *dev)
175175
| NETIF_F_UFO
176176
| NETIF_F_HW_CSUM
177177
| NETIF_F_RXCSUM
178-
| NETIF_F_SCTP_CSUM
178+
| NETIF_F_SCTP_CRC
179179
| NETIF_F_HIGHDMA
180180
| NETIF_F_LLTX
181181
| NETIF_F_NETNS_LOCAL

drivers/net/macvlan.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,11 @@ static struct lock_class_key macvlan_netdev_xmit_lock_key;
758758
static struct lock_class_key macvlan_netdev_addr_lock_key;
759759

760760
#define ALWAYS_ON_FEATURES \
761-
(NETIF_F_SG | NETIF_F_GEN_CSUM | NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX | \
761+
(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_GSO_SOFTWARE | NETIF_F_LLTX | \
762762
NETIF_F_GSO_ROBUST)
763763

764764
#define MACVLAN_FEATURES \
765-
(NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
765+
(NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
766766
NETIF_F_GSO | NETIF_F_TSO | NETIF_F_UFO | NETIF_F_LRO | \
767767
NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \
768768
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)

drivers/net/macvtap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static rx_handler_result_t macvtap_handle_frame(struct sk_buff **pskb)
388388
* check, we either support them all or none.
389389
*/
390390
if (skb->ip_summed == CHECKSUM_PARTIAL &&
391-
!(features & NETIF_F_ALL_CSUM) &&
391+
!(features & NETIF_F_CSUM_MASK) &&
392392
skb_checksum_help(skb))
393393
goto drop;
394394
skb_queue_tail(&q->sk.sk_receive_queue, skb);

drivers/net/team/team.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static void team_port_disable(struct team *team,
981981
team_lower_state_changed(port);
982982
}
983983

984-
#define TEAM_VLAN_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | \
984+
#define TEAM_VLAN_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
985985
NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
986986
NETIF_F_HIGHDMA | NETIF_F_LRO)
987987

@@ -2091,7 +2091,6 @@ static void team_setup(struct net_device *dev)
20912091
NETIF_F_HW_VLAN_CTAG_RX |
20922092
NETIF_F_HW_VLAN_CTAG_FILTER;
20932093

2094-
dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM);
20952094
dev->features |= dev->hw_features;
20962095
}
20972096

drivers/net/usb/r8152.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,7 @@ rtl8152_features_check(struct sk_buff *skb, struct net_device *dev,
19861986
int offset = skb_transport_offset(skb);
19871987

19881988
if ((mss || skb->ip_summed == CHECKSUM_PARTIAL) && offset > max_offset)
1989-
features &= ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
1989+
features &= ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
19901990
else if ((skb->len + sizeof(struct tx_desc)) > agg_buf_sz)
19911991
features &= ~NETIF_F_GSO_MASK;
19921992

drivers/scsi/fcoe/fcoe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp)
16251625

16261626
/* crc offload */
16271627
if (likely(lport->crc_offload)) {
1628-
skb->ip_summed = CHECKSUM_UNNECESSARY;
1628+
skb->ip_summed = CHECKSUM_PARTIAL;
16291629
skb->csum_start = skb_headroom(skb);
16301630
skb->csum_offset = skb->len;
16311631
crc = 0;

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ksocknal_lib_zc_capable(ksock_conn_t *conn)
6969

7070
/* ZC if the socket supports scatter/gather and doesn't need software
7171
* checksums */
72-
return ((caps & NETIF_F_SG) != 0 && (caps & NETIF_F_ALL_CSUM) != 0);
72+
return ((caps & NETIF_F_SG) != 0 && (caps & NETIF_F_CSUM_MASK) != 0);
7373
}
7474

7575
int

include/linux/if_vlan.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ static inline netdev_features_t vlan_features_check(const struct sk_buff *skb,
621621
NETIF_F_SG |
622622
NETIF_F_HIGHDMA |
623623
NETIF_F_FRAGLIST |
624-
NETIF_F_GEN_CSUM |
624+
NETIF_F_HW_CSUM |
625625
NETIF_F_HW_VLAN_CTAG_TX |
626626
NETIF_F_HW_VLAN_STAG_TX);
627627

include/linux/netdev_features.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ enum {
5252
NETIF_F_GSO_TUNNEL_REMCSUM_BIT,
5353

5454
NETIF_F_FCOE_CRC_BIT, /* FCoE CRC32 */
55-
NETIF_F_SCTP_CSUM_BIT, /* SCTP checksum offload */
55+
NETIF_F_SCTP_CRC_BIT, /* SCTP checksum offload */
5656
NETIF_F_FCOE_MTU_BIT, /* Supports max FCoE MTU, 2158 bytes*/
5757
NETIF_F_NTUPLE_BIT, /* N-tuple filters supported */
5858
NETIF_F_RXHASH_BIT, /* Receive hashing offload */
@@ -103,7 +103,7 @@ enum {
103103
#define NETIF_F_NTUPLE __NETIF_F(NTUPLE)
104104
#define NETIF_F_RXCSUM __NETIF_F(RXCSUM)
105105
#define NETIF_F_RXHASH __NETIF_F(RXHASH)
106-
#define NETIF_F_SCTP_CSUM __NETIF_F(SCTP_CSUM)
106+
#define NETIF_F_SCTP_CRC __NETIF_F(SCTP_CRC)
107107
#define NETIF_F_SG __NETIF_F(SG)
108108
#define NETIF_F_TSO6 __NETIF_F(TSO6)
109109
#define NETIF_F_TSO_ECN __NETIF_F(TSO_ECN)
@@ -146,10 +146,12 @@ enum {
146146
#define NETIF_F_GSO_SOFTWARE (NETIF_F_TSO | NETIF_F_TSO_ECN | \
147147
NETIF_F_TSO6 | NETIF_F_UFO)
148148

149-
#define NETIF_F_GEN_CSUM NETIF_F_HW_CSUM
150-
#define NETIF_F_V4_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IP_CSUM)
151-
#define NETIF_F_V6_CSUM (NETIF_F_GEN_CSUM | NETIF_F_IPV6_CSUM)
152-
#define NETIF_F_ALL_CSUM (NETIF_F_V4_CSUM | NETIF_F_V6_CSUM)
149+
/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be
150+
* set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--
151+
* this would be contradictory
152+
*/
153+
#define NETIF_F_CSUM_MASK (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
154+
NETIF_F_HW_CSUM)
153155

154156
#define NETIF_F_ALL_TSO (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
155157

0 commit comments

Comments
 (0)