net/mlx5e: Use the new mlx5 core notifier API
Remove the deprecated mlx5_interface->event mlx5e callback and use new mlx5 notifier API to subscribe for mlx5 events, handle port change event as received from FW rather than handling the mlx5 core processed port change software version event. Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
7a17955530
commit
7cffaddd39
|
@ -631,7 +631,6 @@ struct mlx5e_channel_stats {
|
|||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
enum {
|
||||
MLX5E_STATE_ASYNC_EVENTS_ENABLED,
|
||||
MLX5E_STATE_OPENED,
|
||||
MLX5E_STATE_DESTROYING,
|
||||
};
|
||||
|
@ -690,6 +689,8 @@ struct mlx5e_priv {
|
|||
struct hwtstamp_config tstamp;
|
||||
u16 q_counter;
|
||||
u16 drop_rq_q_counter;
|
||||
struct notifier_block events_nb;
|
||||
|
||||
#ifdef CONFIG_MLX5_CORE_EN_DCB
|
||||
struct mlx5e_dcbx dcbx;
|
||||
#endif
|
||||
|
|
|
@ -294,33 +294,35 @@ void mlx5e_queue_update_stats(struct mlx5e_priv *priv)
|
|||
queue_work(priv->wq, &priv->update_stats_work);
|
||||
}
|
||||
|
||||
static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv,
|
||||
enum mlx5_dev_event event, unsigned long param)
|
||||
static int async_event(struct notifier_block *nb, unsigned long event, void *data)
|
||||
{
|
||||
struct mlx5e_priv *priv = vpriv;
|
||||
struct mlx5e_priv *priv = container_of(nb, struct mlx5e_priv, events_nb);
|
||||
struct mlx5_eqe *eqe = data;
|
||||
|
||||
if (!test_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLED, &priv->state))
|
||||
return;
|
||||
if (event != MLX5_EVENT_TYPE_PORT_CHANGE)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
switch (event) {
|
||||
case MLX5_DEV_EVENT_PORT_UP:
|
||||
case MLX5_DEV_EVENT_PORT_DOWN:
|
||||
switch (eqe->sub_type) {
|
||||
case MLX5_PORT_CHANGE_SUBTYPE_DOWN:
|
||||
case MLX5_PORT_CHANGE_SUBTYPE_ACTIVE:
|
||||
queue_work(priv->wq, &priv->update_carrier_work);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static void mlx5e_enable_async_events(struct mlx5e_priv *priv)
|
||||
{
|
||||
set_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLED, &priv->state);
|
||||
priv->events_nb.notifier_call = async_event;
|
||||
mlx5_notifier_register(priv->mdev, &priv->events_nb);
|
||||
}
|
||||
|
||||
static void mlx5e_disable_async_events(struct mlx5e_priv *priv)
|
||||
{
|
||||
clear_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLED, &priv->state);
|
||||
mlx5_eq_synchronize_async_irq(priv->mdev);
|
||||
mlx5_notifier_unregister(priv->mdev, &priv->events_nb);
|
||||
}
|
||||
|
||||
static inline void mlx5e_build_umr_wqe(struct mlx5e_rq *rq,
|
||||
|
@ -5170,7 +5172,6 @@ static struct mlx5_interface mlx5e_interface = {
|
|||
.remove = mlx5e_remove,
|
||||
.attach = mlx5e_attach,
|
||||
.detach = mlx5e_detach,
|
||||
.event = mlx5e_async_event,
|
||||
.protocol = MLX5_INTERFACE_PROTOCOL_ETH,
|
||||
.get_dev = mlx5e_get_netdev,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue