staticint mlx5e_handle_action_trap(struct mlx5e_priv *priv, int trap_id)
{ bool open_queue = !priv->en_trap; struct mlx5e_trap *trap; int err;
if (open_queue) {
trap = mlx5e_add_trap_queue(priv); if (IS_ERR(trap)) return PTR_ERR(trap);
priv->en_trap = trap;
}
switch (trap_id) { case DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_FILTER:
err = mlx5e_add_vlan_trap(priv->fs, trap_id, mlx5e_trap_get_tirn(priv->en_trap)); if (err) goto err_out; break; case DEVLINK_TRAP_GENERIC_ID_DMAC_FILTER:
err = mlx5e_add_mac_trap(priv->fs, trap_id, mlx5e_trap_get_tirn(priv->en_trap)); if (err) goto err_out; break; default:
netdev_warn(priv->netdev, "%s: Unknown trap id %d\n", __func__, trap_id);
err = -EINVAL; goto err_out;
} return 0;
err_out: if (open_queue)
mlx5e_del_trap_queue(priv); return err;
}
staticint mlx5e_handle_action_drop(struct mlx5e_priv *priv, int trap_id)
{ switch (trap_id) { case DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_FILTER:
mlx5e_remove_vlan_trap(priv->fs); break; case DEVLINK_TRAP_GENERIC_ID_DMAC_FILTER:
mlx5e_remove_mac_trap(priv->fs); break; default:
netdev_warn(priv->netdev, "%s: Unknown trap id %d\n", __func__, trap_id); return -EINVAL;
} if (priv->en_trap && !mlx5_devlink_trap_get_num_active(priv->mdev))
mlx5e_del_trap_queue(priv);
return 0;
}
int mlx5e_handle_trap_event(struct mlx5e_priv *priv, struct mlx5_trap_ctx *trap_ctx)
{ int err = 0;
/* Traps are unarmed when interface is down, no need to update * them. The configuration is saved in the core driver, * queried and applied upon interface up operation in * mlx5e_open_locked().
*/ if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) return 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.