Commit 7cffaddd authored by Saeed Mahameed's avatar Saeed Mahameed

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: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 7a179555
...@@ -631,7 +631,6 @@ struct mlx5e_channel_stats { ...@@ -631,7 +631,6 @@ struct mlx5e_channel_stats {
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
enum { enum {
MLX5E_STATE_ASYNC_EVENTS_ENABLED,
MLX5E_STATE_OPENED, MLX5E_STATE_OPENED,
MLX5E_STATE_DESTROYING, MLX5E_STATE_DESTROYING,
}; };
...@@ -690,6 +689,8 @@ struct mlx5e_priv { ...@@ -690,6 +689,8 @@ struct mlx5e_priv {
struct hwtstamp_config tstamp; struct hwtstamp_config tstamp;
u16 q_counter; u16 q_counter;
u16 drop_rq_q_counter; u16 drop_rq_q_counter;
struct notifier_block events_nb;
#ifdef CONFIG_MLX5_CORE_EN_DCB #ifdef CONFIG_MLX5_CORE_EN_DCB
struct mlx5e_dcbx dcbx; struct mlx5e_dcbx dcbx;
#endif #endif
......
...@@ -294,33 +294,35 @@ void mlx5e_queue_update_stats(struct mlx5e_priv *priv) ...@@ -294,33 +294,35 @@ void mlx5e_queue_update_stats(struct mlx5e_priv *priv)
queue_work(priv->wq, &priv->update_stats_work); queue_work(priv->wq, &priv->update_stats_work);
} }
static void mlx5e_async_event(struct mlx5_core_dev *mdev, void *vpriv, static int async_event(struct notifier_block *nb, unsigned long event, void *data)
enum mlx5_dev_event event, unsigned long param)
{ {
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)) if (event != MLX5_EVENT_TYPE_PORT_CHANGE)
return; return NOTIFY_DONE;
switch (event) { switch (eqe->sub_type) {
case MLX5_DEV_EVENT_PORT_UP: case MLX5_PORT_CHANGE_SUBTYPE_DOWN:
case MLX5_DEV_EVENT_PORT_DOWN: case MLX5_PORT_CHANGE_SUBTYPE_ACTIVE:
queue_work(priv->wq, &priv->update_carrier_work); queue_work(priv->wq, &priv->update_carrier_work);
break; break;
default: default:
break; return NOTIFY_DONE;
} }
return NOTIFY_OK;
} }
static void mlx5e_enable_async_events(struct mlx5e_priv *priv) 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) static void mlx5e_disable_async_events(struct mlx5e_priv *priv)
{ {
clear_bit(MLX5E_STATE_ASYNC_EVENTS_ENABLED, &priv->state); mlx5_notifier_unregister(priv->mdev, &priv->events_nb);
mlx5_eq_synchronize_async_irq(priv->mdev);
} }
static inline void mlx5e_build_umr_wqe(struct mlx5e_rq *rq, static inline void mlx5e_build_umr_wqe(struct mlx5e_rq *rq,
...@@ -5170,7 +5172,6 @@ static struct mlx5_interface mlx5e_interface = { ...@@ -5170,7 +5172,6 @@ static struct mlx5_interface mlx5e_interface = {
.remove = mlx5e_remove, .remove = mlx5e_remove,
.attach = mlx5e_attach, .attach = mlx5e_attach,
.detach = mlx5e_detach, .detach = mlx5e_detach,
.event = mlx5e_async_event,
.protocol = MLX5_INTERFACE_PROTOCOL_ETH, .protocol = MLX5_INTERFACE_PROTOCOL_ETH,
.get_dev = mlx5e_get_netdev, .get_dev = mlx5e_get_netdev,
}; };
......
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