OSDN Git Service

net/mlx5e: Improve stateless offload capability check
authorMarina Varshaver <marinav@mellanox.com>
Tue, 20 Aug 2019 00:36:29 +0000 (03:36 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Wed, 28 Aug 2019 18:49:05 +0000 (11:49 -0700)
Use generic function for checking tunnel stateless offload capability
instead of separate macros.

Signed-off-by: Marina Varshaver <marinav@mellanox.com>
Reviewed-by: Aya Levin <ayal@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index 5aae3a7..68d5930 100644 (file)
@@ -238,5 +238,8 @@ void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv);
 int mlx5e_create_flow_steering(struct mlx5e_priv *priv);
 void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv);
 
+bool mlx5e_tunnel_proto_supported(struct mlx5_core_dev *mdev, u8 proto_type);
+bool mlx5e_any_tunnel_proto_supported(struct mlx5_core_dev *mdev);
+
 #endif /* __MLX5E_FLOW_STEER_H__ */
 
index b99b179..15b7f0f 100644 (file)
@@ -766,7 +766,7 @@ static struct mlx5e_etype_proto ttc_tunnel_rules[] = {
 
 };
 
-static bool mlx5e_tunnel_proto_supported(struct mlx5_core_dev *mdev, u8 proto_type)
+bool mlx5e_tunnel_proto_supported(struct mlx5_core_dev *mdev, u8 proto_type)
 {
        switch (proto_type) {
        case IPPROTO_GRE:
@@ -779,7 +779,7 @@ static bool mlx5e_tunnel_proto_supported(struct mlx5_core_dev *mdev, u8 proto_ty
        }
 }
 
-static bool mlx5e_any_tunnel_proto_supported(struct mlx5_core_dev *mdev)
+bool mlx5e_any_tunnel_proto_supported(struct mlx5_core_dev *mdev)
 {
        int tt;
 
index 2786f5b..327c90d 100644 (file)
@@ -4879,7 +4879,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
        netdev->hw_features      |= NETIF_F_HW_VLAN_STAG_TX;
 
        if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev) ||
-           MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
+           mlx5e_any_tunnel_proto_supported(mdev)) {
                netdev->hw_enc_features |= NETIF_F_HW_CSUM;
                netdev->hw_enc_features |= NETIF_F_TSO;
                netdev->hw_enc_features |= NETIF_F_TSO6;
@@ -4894,7 +4894,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
                netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM;
        }
 
-       if (MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
+       if (mlx5e_tunnel_proto_supported(mdev, IPPROTO_GRE)) {
                netdev->hw_features     |= NETIF_F_GSO_GRE |
                                           NETIF_F_GSO_GRE_CSUM;
                netdev->hw_enc_features |= NETIF_F_GSO_GRE |