linux/drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c

// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/* Copyright (c) 2019 Mellanox Technologies. */

#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/notifier.h>
#include <linux/mlx5/driver.h>
#include <linux/mlx5/vport.h>
#include "mlx5_core.h"
#include "mlx5_irq.h"
#include "pci_irq.h"
#include "lib/sf.h"
#include "lib/eq.h"
#ifdef CONFIG_RFS_ACCEL
#include <linux/cpu_rmap.h>
#endif

#define MLX5_SFS_PER_CTRL_IRQ
#define MLX5_MAX_MSIX_PER_SF
#define MLX5_IRQ_CTRL_SF_MAX
/* min num of vectors for SFs to be enabled */
#define MLX5_IRQ_VEC_COMP_BASE_SF
#define MLX5_IRQ_VEC_COMP_BASE

#define MLX5_EQ_SHARE_IRQ_MAX_COMP
#define MLX5_EQ_SHARE_IRQ_MAX_CTRL
#define MLX5_EQ_SHARE_IRQ_MIN_COMP
#define MLX5_EQ_SHARE_IRQ_MIN_CTRL

struct mlx5_irq {};

struct mlx5_irq_table {};

static int mlx5_core_func_to_vport(const struct mlx5_core_dev *dev,
				   int func,
				   bool ec_vf_func)
{}

/**
 * mlx5_get_default_msix_vec_count - Get the default number of MSI-X vectors
 *                                   to be ssigned to each VF.
 * @dev: PF to work on
 * @num_vfs: Number of enabled VFs
 */
int mlx5_get_default_msix_vec_count(struct mlx5_core_dev *dev, int num_vfs)
{}

/**
 * mlx5_set_msix_vec_count - Set dynamically allocated MSI-X on the VF
 * @dev: PF to work on
 * @function_id: Internal PCI VF function IDd
 * @msix_vec_count: Number of MSI-X vectors to set
 */
int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id,
			    int msix_vec_count)
{}

/* mlx5_system_free_irq - Free an IRQ
 * @irq: IRQ to free
 *
 * Free the IRQ and other resources such as rmap from the system.
 * BUT doesn't free or remove reference from mlx5.
 * This function is very important for the shutdown flow, where we need to
 * cleanup system resoruces but keep mlx5 objects alive,
 * see mlx5_irq_table_free_irqs().
 */
static void mlx5_system_free_irq(struct mlx5_irq *irq)
{}

static void irq_release(struct mlx5_irq *irq)
{}

int mlx5_irq_put(struct mlx5_irq *irq)
{}

int mlx5_irq_read_locked(struct mlx5_irq *irq)
{}

int mlx5_irq_get_locked(struct mlx5_irq *irq)
{}

static int irq_get(struct mlx5_irq *irq)
{}

static irqreturn_t irq_int_handler(int irq, void *nh)
{}

static void irq_sf_set_name(struct mlx5_irq_pool *pool, char *name, int vecidx)
{}

static void irq_set_name(struct mlx5_irq_pool *pool, char *name, int vecidx)
{}

struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,
				struct irq_affinity_desc *af_desc,
				struct cpu_rmap **rmap)
{}

int mlx5_irq_attach_nb(struct mlx5_irq *irq, struct notifier_block *nb)
{}

int mlx5_irq_detach_nb(struct mlx5_irq *irq, struct notifier_block *nb)
{}

struct cpumask *mlx5_irq_get_affinity_mask(struct mlx5_irq *irq)
{}

int mlx5_irq_get_irq(const struct mlx5_irq *irq)
{}

int mlx5_irq_get_index(struct mlx5_irq *irq)
{}

/* irq_pool API */

/* requesting an irq from a given pool according to given index */
static struct mlx5_irq *
irq_pool_request_vector(struct mlx5_irq_pool *pool, int vecidx,
			struct irq_affinity_desc *af_desc,
			struct cpu_rmap **rmap)
{}

static struct mlx5_irq_pool *sf_ctrl_irq_pool_get(struct mlx5_irq_table *irq_table)
{}

static struct mlx5_irq_pool *sf_irq_pool_get(struct mlx5_irq_table *irq_table)
{}

struct mlx5_irq_pool *mlx5_irq_pool_get(struct mlx5_core_dev *dev)
{}

static struct mlx5_irq_pool *ctrl_irq_pool_get(struct mlx5_core_dev *dev)
{}

static void _mlx5_irq_release(struct mlx5_irq *irq)
{}

/**
 * mlx5_ctrl_irq_release - release a ctrl IRQ back to the system.
 * @dev: mlx5 device that releasing the IRQ.
 * @ctrl_irq: ctrl IRQ to be released.
 */
void mlx5_ctrl_irq_release(struct mlx5_core_dev *dev, struct mlx5_irq *ctrl_irq)
{}

/**
 * mlx5_ctrl_irq_request - request a ctrl IRQ for mlx5 device.
 * @dev: mlx5 device that requesting the IRQ.
 *
 * This function returns a pointer to IRQ, or ERR_PTR in case of error.
 */
struct mlx5_irq *mlx5_ctrl_irq_request(struct mlx5_core_dev *dev)
{}

/**
 * mlx5_irq_request - request an IRQ for mlx5 PF/VF device.
 * @dev: mlx5 device that requesting the IRQ.
 * @vecidx: vector index of the IRQ. This argument is ignore if affinity is
 * provided.
 * @af_desc: affinity descriptor for this IRQ.
 * @rmap: pointer to reverse map pointer for completion interrupts
 *
 * This function returns a pointer to IRQ, or ERR_PTR in case of error.
 */
struct mlx5_irq *mlx5_irq_request(struct mlx5_core_dev *dev, u16 vecidx,
				  struct irq_affinity_desc *af_desc,
				  struct cpu_rmap **rmap)
{}

/**
 * mlx5_irq_release_vector - release one IRQ back to the system.
 * @irq: the irq to release.
 */
void mlx5_irq_release_vector(struct mlx5_irq *irq)
{}

/**
 * mlx5_irq_request_vector - request one IRQ for mlx5 device.
 * @dev: mlx5 device that is requesting the IRQ.
 * @cpu: CPU to bind the IRQ to.
 * @vecidx: vector index to request an IRQ for.
 * @rmap: pointer to reverse map pointer for completion interrupts
 *
 * Each IRQ is bound to at most 1 CPU.
 * This function is requests one IRQ, for the given @vecidx.
 *
 * This function returns a pointer to the irq on success, or an error pointer
 * in case of an error.
 */
struct mlx5_irq *mlx5_irq_request_vector(struct mlx5_core_dev *dev, u16 cpu,
					 u16 vecidx, struct cpu_rmap **rmap)
{}

static struct mlx5_irq_pool *
irq_pool_alloc(struct mlx5_core_dev *dev, int start, int size, char *name,
	       u32 min_threshold, u32 max_threshold)
{}

static void irq_pool_free(struct mlx5_irq_pool *pool)
{}

static int irq_pools_init(struct mlx5_core_dev *dev, int sf_vec, int pcif_vec)
{}

static void irq_pools_destroy(struct mlx5_irq_table *table)
{}

static void mlx5_irq_pool_free_irqs(struct mlx5_irq_pool *pool)
{}

static void mlx5_irq_pools_free_irqs(struct mlx5_irq_table *table)
{}

/* irq_table API */

int mlx5_irq_table_init(struct mlx5_core_dev *dev)
{}

void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev)
{}

int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table)
{}

int mlx5_irq_table_create(struct mlx5_core_dev *dev)
{}

void mlx5_irq_table_destroy(struct mlx5_core_dev *dev)
{}

void mlx5_irq_table_free_irqs(struct mlx5_core_dev *dev)
{}

int mlx5_irq_table_get_sfs_vec(struct mlx5_irq_table *table)
{}

struct mlx5_irq_table *mlx5_irq_table_get(struct mlx5_core_dev *dev)
{}