aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTariq Toukan <tariqt@mellanox.com>2018-02-27 09:17:22 -0500
committerDavid S. Miller <davem@davemloft.net>2018-02-27 14:53:26 -0500
commita970d8dba5dab199218d13080dcad4e22cbaf8b5 (patch)
tree6f9011a103a1f1103eb8d0d914da095384f411fa
parent1cb8b1216c427ddbec51b8c3e77459dd44f85bcc (diff)
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 <tariqt@mellanox.com> Suggested-by: David S. Miller <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_rx.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index 1e8f21b7fed8..c2c6bd7578fd 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -649,6 +649,12 @@ static int check_csum(struct mlx4_cqe *cqe, struct sk_buff *skb, void *va,
649 return get_fixed_ipv4_csum(hw_checksum, skb, hdr); 649 return get_fixed_ipv4_csum(hw_checksum, skb, hdr);
650} 650}
651 651
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
652int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int budget) 658int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int budget)
653{ 659{
654 struct mlx4_en_priv *priv = netdev_priv(dev); 660 struct mlx4_en_priv *priv = netdev_priv(dev);
@@ -835,12 +841,7 @@ xdp_drop_no_cnt:
835 ring->csum_ok++; 841 ring->csum_ok++;
836 } else { 842 } else {
837 if (!(priv->flags & MLX4_EN_FLAG_RX_CSUM_NON_TCP_UDP && 843 if (!(priv->flags & MLX4_EN_FLAG_RX_CSUM_NON_TCP_UDP &&
838 (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4 | 844 (cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IP_ANY))))
839#if IS_ENABLED(CONFIG_IPV6)
840 MLX4_CQE_STATUS_IPV6))))
841#else
842 0))))
843#endif
844 goto csum_none; 845 goto csum_none;
845 if (check_csum(cqe, skb, va, dev->features)) 846 if (check_csum(cqe, skb, va, dev->features))
846 goto csum_none; 847 goto csum_none;