net: Eliminate NETIF_F_GEN_CSUM and NETIF_F_V[46]_CSUM
These netif flags are unnecessary convolutions. It is more
straightforward to just use NETIF_F_HW_CSUM, NETIF_F_IP_CSUM,
and NETIF_F_IPV6_CSUM directly.
This patch also:
- Cleans up can_checksum_protocol
- Simplifies netdev_intersect_features
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a188222b6e
commit
c8cd0989bd
13 changed files with 50 additions and 39 deletions
|
|
@ -3691,13 +3691,24 @@ __be16 skb_network_protocol(struct sk_buff *skb, int *depth);
|
|||
static inline bool can_checksum_protocol(netdev_features_t features,
|
||||
__be16 protocol)
|
||||
{
|
||||
return ((features & NETIF_F_GEN_CSUM) ||
|
||||
((features & NETIF_F_V4_CSUM) &&
|
||||
protocol == htons(ETH_P_IP)) ||
|
||||
((features & NETIF_F_V6_CSUM) &&
|
||||
protocol == htons(ETH_P_IPV6)) ||
|
||||
((features & NETIF_F_FCOE_CRC) &&
|
||||
protocol == htons(ETH_P_FCOE)));
|
||||
if (protocol == htons(ETH_P_FCOE))
|
||||
return !!(features & NETIF_F_FCOE_CRC);
|
||||
|
||||
/* Assume this is an IP checksum (not SCTP CRC) */
|
||||
|
||||
if (features & NETIF_F_HW_CSUM) {
|
||||
/* Can checksum everything */
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (protocol) {
|
||||
case htons(ETH_P_IP):
|
||||
return !!(features & NETIF_F_IP_CSUM);
|
||||
case htons(ETH_P_IPV6):
|
||||
return !!(features & NETIF_F_IPV6_CSUM);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BUG
|
||||
|
|
@ -3762,15 +3773,14 @@ void linkwatch_run_queue(void);
|
|||
static inline netdev_features_t netdev_intersect_features(netdev_features_t f1,
|
||||
netdev_features_t f2)
|
||||
{
|
||||
if (f1 & NETIF_F_GEN_CSUM)
|
||||
f1 |= (NETIF_F_CSUM_MASK & ~NETIF_F_GEN_CSUM);
|
||||
if (f2 & NETIF_F_GEN_CSUM)
|
||||
f2 |= (NETIF_F_CSUM_MASK & ~NETIF_F_GEN_CSUM);
|
||||
f1 &= f2;
|
||||
if (f1 & NETIF_F_GEN_CSUM)
|
||||
f1 &= ~(NETIF_F_CSUM_MASK & ~NETIF_F_GEN_CSUM);
|
||||
if ((f1 ^ f2) & NETIF_F_HW_CSUM) {
|
||||
if (f1 & NETIF_F_HW_CSUM)
|
||||
f1 |= (NETIF_F_IP_CSUM|NETIF_F_IP_CSUM);
|
||||
else
|
||||
f2 |= (NETIF_F_IP_CSUM|NETIF_F_IP_CSUM);
|
||||
}
|
||||
|
||||
return f1;
|
||||
return f1 & f2;
|
||||
}
|
||||
|
||||
static inline netdev_features_t netdev_get_wanted_features(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue