Skip to content

Commit a970d8d

Browse files
Tariq Toukandavem330
authored andcommitted
net/mlx4_en: RX csum, pre-define enabled protocols for IP status masking
Pre-define a mask for IP status of a completion, that tests the MLX4_CQE_STATUS_IPV6 only in case CONFIG_IPV6 is enabled. Use it for IP status testing upon completion, instead of separating the datapath into two flows. This takes common code structures (such as closing parenthesis) back to their original place, and makes code more readable. Signed-off-by: Tariq Toukan <[email protected]> Suggested-by: David S. Miller <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1cb8b12 commit a970d8d

File tree

1 file changed

+7
-6
lines changed
  • drivers/net/ethernet/mellanox/mlx4

1 file changed

+7
-6
lines changed

drivers/net/ethernet/mellanox/mlx4/en_rx.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,12 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
649649
return get_fixed_ipv4_csum(hw_checksum, skb, hdr);
650650
}
651651

652+
#if IS_ENABLED(CONFIG_IPV6)
653+
#define MLX4_CQE_STATUS_IP_ANY (MLX4_CQE_STATUS_IPV4 | MLX4_CQE_STATUS_IPV6)
654+
#else
655+
#define MLX4_CQE_STATUS_IP_ANY (MLX4_CQE_STATUS_IPV4)
656+
#endif
657+
652658
int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int budget)
653659
{
654660
struct mlx4_en_priv *priv = netdev_priv(dev);
@@ -835,12 +841,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
835841
ring->csum_ok++;
836842
} else {
837843
if (!(priv->flags & MLX4_EN_FLAG_RX_CSUM_NON_TCP_UDP &&
838-
(cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 |
839-
#if IS_ENABLED(CONFIG_IPV6)
840-
MLX4_CQE_STATUS_IPV6))))
841-
#else
842-
0))))
843-
#endif
844+
(cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IP_ANY))))
844845
goto csum_none;
845846
if (check_csum(cqe, skb, va, dev->features))
846847
goto csum_none;

0 commit comments

Comments
 (0)