FILE
devcom.h
File preview with syntax highlighting.
linux-6.19.14/drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.h
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2/* Copyright (c) 2018 Mellanox Technologies */ 3 4#ifndef __LIB_MLX5_DEVCOM_H__ 5#define __LIB_MLX5_DEVCOM_H__ 6 7#include <linux/mlx5/driver.h> 8 9enum mlx5_devom_match_flags { 10 MLX5_DEVCOM_MATCH_FLAGS_NS = BIT(0), 11}; 12 13#define MLX5_DEVCOM_MATCH_KEY_MAX 32 14union mlx5_devcom_match_key { 15 u64 val; 16 u8 buf[MLX5_DEVCOM_MATCH_KEY_MAX]; 17}; 18 19struct mlx5_devcom_match_attr { 20 u32 flags; 21 union mlx5_devcom_match_key key; 22 struct net *net; 23}; 24 25enum mlx5_devcom_component { 26 MLX5_DEVCOM_ESW_OFFLOADS, 27 MLX5_DEVCOM_MPV, 28 MLX5_DEVCOM_HCA_PORTS, 29 MLX5_DEVCOM_SD_GROUP, 30 MLX5_DEVCOM_SHARED_CLOCK, 31 MLX5_DEVCOM_NUM_COMPONENTS, 32}; 33 34typedef int (*mlx5_devcom_event_handler_t)(int event, 35 void *my_data, 36 void *event_data); 37 38struct mlx5_devcom_dev *mlx5_devcom_register_device(struct mlx5_core_dev *dev); 39void mlx5_devcom_unregister_device(struct mlx5_devcom_dev *devc); 40 41struct mlx5_devcom_comp_dev * 42mlx5_devcom_register_component(struct mlx5_devcom_dev *devc, 43 enum mlx5_devcom_component id, 44 const struct mlx5_devcom_match_attr *attr, 45 mlx5_devcom_event_handler_t handler, 46 void *data); 47void mlx5_devcom_unregister_component(struct mlx5_devcom_comp_dev *devcom); 48 49int mlx5_devcom_send_event(struct mlx5_devcom_comp_dev *devcom, 50 int event, int rollback_event, 51 void *event_data); 52int mlx5_devcom_comp_get_size(struct mlx5_devcom_comp_dev *devcom); 53 54void mlx5_devcom_comp_set_ready(struct mlx5_devcom_comp_dev *devcom, bool ready); 55bool mlx5_devcom_comp_is_ready(struct mlx5_devcom_comp_dev *devcom); 56 57bool mlx5_devcom_for_each_peer_begin(struct mlx5_devcom_comp_dev *devcom); 58void mlx5_devcom_for_each_peer_end(struct mlx5_devcom_comp_dev *devcom); 59void *mlx5_devcom_get_next_peer_data(struct mlx5_devcom_comp_dev *devcom, 60 struct mlx5_devcom_comp_dev **pos); 61 62#define mlx5_devcom_for_each_peer_entry(devcom, data, pos) \ 63 for (pos = NULL, data = mlx5_devcom_get_next_peer_data(devcom, &pos); \ 64 data; \ 65 data = mlx5_devcom_get_next_peer_data(devcom, &pos)) 66 67void *mlx5_devcom_get_next_peer_data_rcu(struct mlx5_devcom_comp_dev *devcom, 68 struct mlx5_devcom_comp_dev **pos); 69 70#define mlx5_devcom_for_each_peer_entry_rcu(devcom, data, pos) \ 71 for (pos = NULL, data = mlx5_devcom_get_next_peer_data_rcu(devcom, &pos); \ 72 data; \ 73 data = mlx5_devcom_get_next_peer_data_rcu(devcom, &pos)) 74 75void mlx5_devcom_comp_lock(struct mlx5_devcom_comp_dev *devcom); 76void mlx5_devcom_comp_unlock(struct mlx5_devcom_comp_dev *devcom); 77int mlx5_devcom_comp_trylock(struct mlx5_devcom_comp_dev *devcom); 78 79#endif /* __LIB_MLX5_DEVCOM_H__ */
~/
Read-only file preview.