Commit 59ece1c9 authored by Shaker Daibes's avatar Shaker Daibes Committed by David S. Miller

net/mlx5e: Moves pflags to priv->params

pflags is a configuration parameter for the netdev, naturally it belongs
to priv->params.
Also introduce MLX5E_GET_PFLAG
Signed-off-by: default avatarShaker Daibes <shakerd@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0952da79
...@@ -177,14 +177,16 @@ enum mlx5e_priv_flag { ...@@ -177,14 +177,16 @@ enum mlx5e_priv_flag {
MLX5E_PFLAG_RX_CQE_BASED_MODER = (1 << 0), MLX5E_PFLAG_RX_CQE_BASED_MODER = (1 << 0),
}; };
#define MLX5E_SET_PRIV_FLAG(priv, pflag, enable) \ #define MLX5E_SET_PFLAG(priv, pflag, enable) \
do { \ do { \
if (enable) \ if (enable) \
priv->pflags |= pflag; \ (priv)->params.pflags |= (pflag); \
else \ else \
priv->pflags &= ~pflag; \ (priv)->params.pflags &= ~(pflag); \
} while (0) } while (0)
#define MLX5E_GET_PFLAG(priv, pflag) (!!((priv)->params.pflags & (pflag)))
#ifdef CONFIG_MLX5_CORE_EN_DCB #ifdef CONFIG_MLX5_CORE_EN_DCB
#define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */ #define MLX5E_MAX_BW_ALLOC 100 /* Max percentage of BW allocation */
#endif #endif
...@@ -218,6 +220,7 @@ struct mlx5e_params { ...@@ -218,6 +220,7 @@ struct mlx5e_params {
bool vlan_strip_disable; bool vlan_strip_disable;
bool rx_am_enabled; bool rx_am_enabled;
u32 lro_timeout; u32 lro_timeout;
u32 pflags;
}; };
#ifdef CONFIG_MLX5_CORE_EN_DCB #ifdef CONFIG_MLX5_CORE_EN_DCB
...@@ -705,7 +708,6 @@ struct mlx5e_priv { ...@@ -705,7 +708,6 @@ struct mlx5e_priv {
struct work_struct tx_timeout_work; struct work_struct tx_timeout_work;
struct delayed_work update_stats_work; struct delayed_work update_stats_work;
u32 pflags;
struct mlx5_core_dev *mdev; struct mlx5_core_dev *mdev;
struct net_device *netdev; struct net_device *netdev;
struct mlx5e_stats stats; struct mlx5e_stats stats;
......
...@@ -1488,7 +1488,7 @@ static int mlx5e_handle_pflag(struct net_device *netdev, ...@@ -1488,7 +1488,7 @@ static int mlx5e_handle_pflag(struct net_device *netdev,
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
bool enable = !!(wanted_flags & flag); bool enable = !!(wanted_flags & flag);
u32 changes = wanted_flags ^ priv->pflags; u32 changes = wanted_flags ^ priv->params.pflags;
int err; int err;
if (!(changes & flag)) if (!(changes & flag))
...@@ -1501,7 +1501,7 @@ static int mlx5e_handle_pflag(struct net_device *netdev, ...@@ -1501,7 +1501,7 @@ static int mlx5e_handle_pflag(struct net_device *netdev,
return err; return err;
} }
MLX5E_SET_PRIV_FLAG(priv, flag, enable); MLX5E_SET_PFLAG(priv, flag, enable);
return 0; return 0;
} }
...@@ -1524,7 +1524,7 @@ static u32 mlx5e_get_priv_flags(struct net_device *netdev) ...@@ -1524,7 +1524,7 @@ static u32 mlx5e_get_priv_flags(struct net_device *netdev)
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
return priv->pflags; return priv->params.pflags;
} }
static int mlx5e_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) static int mlx5e_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
......
...@@ -3488,7 +3488,7 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev, ...@@ -3488,7 +3488,7 @@ static void mlx5e_build_nic_netdev_priv(struct mlx5_core_dev *mdev,
SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
/* Initialize pflags */ /* Initialize pflags */
MLX5E_SET_PRIV_FLAG(priv, MLX5E_PFLAG_RX_CQE_BASED_MODER, MLX5E_SET_PFLAG(priv, MLX5E_PFLAG_RX_CQE_BASED_MODER,
priv->params.rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE); priv->params.rx_cq_period_mode == MLX5_CQ_PERIOD_MODE_START_FROM_CQE);
mutex_init(&priv->state_lock); mutex_init(&priv->state_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment