net/mlx4_en: RX csum, reorder branches
Use early goto commands, and save else branches. This uses less indentations and brackets, making the code more readable. Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
345ef18c24
commit
dc484851ed
|
@ -816,39 +816,35 @@ xdp_drop_no_cnt:
|
||||||
if (likely(dev->features & NETIF_F_RXCSUM)) {
|
if (likely(dev->features & NETIF_F_RXCSUM)) {
|
||||||
if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_TCP |
|
if (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_TCP |
|
||||||
MLX4_CQE_STATUS_UDP)) {
|
MLX4_CQE_STATUS_UDP)) {
|
||||||
if ((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) &&
|
bool l2_tunnel;
|
||||||
cqe->checksum == cpu_to_be16(0xffff)) {
|
|
||||||
bool l2_tunnel = (dev->hw_enc_features & NETIF_F_RXCSUM) &&
|
|
||||||
(cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_L2_TUNNEL));
|
|
||||||
|
|
||||||
|
if (!((cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPOK)) &&
|
||||||
|
cqe->checksum == cpu_to_be16(0xffff)))
|
||||||
|
goto csum_none;
|
||||||
|
|
||||||
|
l2_tunnel = (dev->hw_enc_features & NETIF_F_RXCSUM) &&
|
||||||
|
(cqe->vlan_my_qpn & cpu_to_be32(MLX4_CQE_L2_TUNNEL));
|
||||||
ip_summed = CHECKSUM_UNNECESSARY;
|
ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
hash_type = PKT_HASH_TYPE_L4;
|
hash_type = PKT_HASH_TYPE_L4;
|
||||||
if (l2_tunnel)
|
if (l2_tunnel)
|
||||||
skb->csum_level = 1;
|
skb->csum_level = 1;
|
||||||
ring->csum_ok++;
|
ring->csum_ok++;
|
||||||
} else {
|
} else {
|
||||||
goto csum_none;
|
if (!(priv->flags & MLX4_EN_FLAG_RX_CSUM_NON_TCP_UDP &&
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (priv->flags & MLX4_EN_FLAG_RX_CSUM_NON_TCP_UDP &&
|
|
||||||
(cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 |
|
(cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 |
|
||||||
#if IS_ENABLED(CONFIG_IPV6)
|
#if IS_ENABLED(CONFIG_IPV6)
|
||||||
MLX4_CQE_STATUS_IPV6))) {
|
MLX4_CQE_STATUS_IPV6))))
|
||||||
#else
|
#else
|
||||||
0))) {
|
0))))
|
||||||
#endif
|
#endif
|
||||||
if (check_csum(cqe, skb, va, dev->features)) {
|
|
||||||
goto csum_none;
|
goto csum_none;
|
||||||
} else {
|
if (check_csum(cqe, skb, va, dev->features))
|
||||||
|
goto csum_none;
|
||||||
ip_summed = CHECKSUM_COMPLETE;
|
ip_summed = CHECKSUM_COMPLETE;
|
||||||
hash_type = PKT_HASH_TYPE_L3;
|
hash_type = PKT_HASH_TYPE_L3;
|
||||||
ring->csum_complete++;
|
ring->csum_complete++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
goto csum_none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
csum_none:
|
csum_none:
|
||||||
ip_summed = CHECKSUM_NONE;
|
ip_summed = CHECKSUM_NONE;
|
||||||
hash_type = PKT_HASH_TYPE_L3;
|
hash_type = PKT_HASH_TYPE_L3;
|
||||||
|
|
Loading…
Reference in New Issue