net/mlx5e: Add listener to trap event
Add support for listening to blocking events in the ETH driver. Listen on trap event. If received, call mlx5e_handle_trap_event() which: 1) Verifies if driver needs open/close trap-RQ with respect to the active traps count. 2) Inspects trap id and its action (trap/drop) and add/remove the flow steering rule accordingly. Otherwise, return an error. Signed-off-by: Aya Levin <ayal@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
5543e989fe
commit
70038b73e4
|
@ -859,6 +859,7 @@ struct mlx5e_priv {
|
|||
u16 q_counter;
|
||||
u16 drop_rq_q_counter;
|
||||
struct notifier_block events_nb;
|
||||
struct notifier_block blocking_events_nb;
|
||||
int num_tc_x_num_ch;
|
||||
|
||||
struct udp_tunnel_nic_info nic_info;
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "lib/mlx5.h"
|
||||
#include "en/ptp.h"
|
||||
#include "qos.h"
|
||||
#include "en/trap.h"
|
||||
|
||||
bool mlx5e_check_fragmented_striding_rq_cap(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
|
@ -212,6 +213,33 @@ static void mlx5e_disable_async_events(struct mlx5e_priv *priv)
|
|||
mlx5_notifier_unregister(priv->mdev, &priv->events_nb);
|
||||
}
|
||||
|
||||
static int blocking_event(struct notifier_block *nb, unsigned long event, void *data)
|
||||
{
|
||||
struct mlx5e_priv *priv = container_of(nb, struct mlx5e_priv, blocking_events_nb);
|
||||
int err;
|
||||
|
||||
switch (event) {
|
||||
case MLX5_DRIVER_EVENT_TYPE_TRAP:
|
||||
err = mlx5e_handle_trap_event(priv, data);
|
||||
break;
|
||||
default:
|
||||
netdev_warn(priv->netdev, "Sync event: Unknouwn event %ld\n", event);
|
||||
err = -EINVAL;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static void mlx5e_enable_blocking_events(struct mlx5e_priv *priv)
|
||||
{
|
||||
priv->blocking_events_nb.notifier_call = blocking_event;
|
||||
mlx5_blocking_notifier_register(priv->mdev, &priv->blocking_events_nb);
|
||||
}
|
||||
|
||||
static void mlx5e_disable_blocking_events(struct mlx5e_priv *priv)
|
||||
{
|
||||
mlx5_blocking_notifier_unregister(priv->mdev, &priv->blocking_events_nb);
|
||||
}
|
||||
|
||||
static inline void mlx5e_build_umr_wqe(struct mlx5e_rq *rq,
|
||||
struct mlx5e_icosq *sq,
|
||||
struct mlx5e_umr_wqe *wqe)
|
||||
|
@ -5341,6 +5369,7 @@ static void mlx5e_nic_enable(struct mlx5e_priv *priv)
|
|||
mlx5_lag_add(mdev, netdev);
|
||||
|
||||
mlx5e_enable_async_events(priv);
|
||||
mlx5e_enable_blocking_events(priv);
|
||||
if (mlx5e_monitor_counter_supported(priv))
|
||||
mlx5e_monitor_counter_init(priv);
|
||||
|
||||
|
@ -5378,6 +5407,12 @@ static void mlx5e_nic_disable(struct mlx5e_priv *priv)
|
|||
if (mlx5e_monitor_counter_supported(priv))
|
||||
mlx5e_monitor_counter_cleanup(priv);
|
||||
|
||||
mlx5e_disable_blocking_events(priv);
|
||||
if (priv->en_trap) {
|
||||
mlx5e_deactivate_trap(priv);
|
||||
mlx5e_close_trap(priv->en_trap);
|
||||
priv->en_trap = NULL;
|
||||
}
|
||||
mlx5e_disable_async_events(priv);
|
||||
mlx5_lag_remove(mdev);
|
||||
mlx5_vxlan_reset_to_default(mdev->vxlan);
|
||||
|
|
Loading…
Reference in New Issue