mlx5_irq.h (2334B)
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2/* Copyright (c) 2021 Mellanox Technologies. */ 3 4#ifndef __MLX5_IRQ_H__ 5#define __MLX5_IRQ_H__ 6 7#include <linux/mlx5/driver.h> 8 9#define MLX5_COMP_EQS_PER_SF 8 10 11struct mlx5_irq; 12 13int mlx5_irq_table_init(struct mlx5_core_dev *dev); 14void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev); 15int mlx5_irq_table_create(struct mlx5_core_dev *dev); 16void mlx5_irq_table_destroy(struct mlx5_core_dev *dev); 17int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table); 18int mlx5_irq_table_get_sfs_vec(struct mlx5_irq_table *table); 19struct mlx5_irq_table *mlx5_irq_table_get(struct mlx5_core_dev *dev); 20 21int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int devfn, 22 int msix_vec_count); 23int mlx5_get_default_msix_vec_count(struct mlx5_core_dev *dev, int num_vfs); 24 25struct mlx5_irq *mlx5_ctrl_irq_request(struct mlx5_core_dev *dev); 26void mlx5_ctrl_irq_release(struct mlx5_irq *ctrl_irq); 27struct mlx5_irq *mlx5_irq_request(struct mlx5_core_dev *dev, u16 vecidx, 28 struct cpumask *affinity); 29int mlx5_irqs_request_vectors(struct mlx5_core_dev *dev, u16 *cpus, int nirqs, 30 struct mlx5_irq **irqs); 31void mlx5_irqs_release_vectors(struct mlx5_irq **irqs, int nirqs); 32int mlx5_irq_attach_nb(struct mlx5_irq *irq, struct notifier_block *nb); 33int mlx5_irq_detach_nb(struct mlx5_irq *irq, struct notifier_block *nb); 34struct cpumask *mlx5_irq_get_affinity_mask(struct mlx5_irq *irq); 35int mlx5_irq_get_index(struct mlx5_irq *irq); 36 37struct mlx5_irq_pool; 38#ifdef CONFIG_MLX5_SF 39int mlx5_irq_affinity_irqs_request_auto(struct mlx5_core_dev *dev, int nirqs, 40 struct mlx5_irq **irqs); 41struct mlx5_irq *mlx5_irq_affinity_request(struct mlx5_irq_pool *pool, 42 const struct cpumask *req_mask); 43void mlx5_irq_affinity_irqs_release(struct mlx5_core_dev *dev, struct mlx5_irq **irqs, 44 int num_irqs); 45#else 46static inline int mlx5_irq_affinity_irqs_request_auto(struct mlx5_core_dev *dev, int nirqs, 47 struct mlx5_irq **irqs) 48{ 49 return -EOPNOTSUPP; 50} 51 52static inline struct mlx5_irq * 53mlx5_irq_affinity_request(struct mlx5_irq_pool *pool, const struct cpumask *req_mask) 54{ 55 return ERR_PTR(-EOPNOTSUPP); 56} 57 58static inline void mlx5_irq_affinity_irqs_release(struct mlx5_core_dev *dev, 59 struct mlx5_irq **irqs, int num_irqs) {} 60#endif 61#endif /* __MLX5_IRQ_H__ */