linux/drivers/infiniband/hw/efa/efa_com.c

// SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
/*
 * Copyright 2018-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
 */

#include "efa_com.h"
#include "efa_regs_defs.h"

#define ADMIN_CMD_TIMEOUT_US

#define EFA_REG_READ_TIMEOUT_US
#define EFA_MMIO_READ_INVALID

#define EFA_POLL_INTERVAL_MS

#define EFA_ASYNC_QUEUE_DEPTH
#define EFA_ADMIN_QUEUE_DEPTH

#define EFA_CTRL_MAJOR
#define EFA_CTRL_MINOR
#define EFA_CTRL_SUB_MINOR

enum efa_cmd_status {};

struct efa_comp_ctx {};

static const char *efa_com_cmd_str(u8 cmd)
{}

void efa_com_set_dma_addr(dma_addr_t addr, u32 *addr_high, u32 *addr_low)
{}

static u32 efa_com_reg_read32(struct efa_com_dev *edev, u16 offset)
{}

static int efa_com_admin_init_sq(struct efa_com_dev *edev)
{}

static int efa_com_admin_init_cq(struct efa_com_dev *edev)
{}

static int efa_com_admin_init_aenq(struct efa_com_dev *edev,
				   struct efa_aenq_handlers *aenq_handlers)
{}

/* ID to be used with efa_com_get_comp_ctx */
static u16 efa_com_alloc_ctx_id(struct efa_com_admin_queue *aq)
{}

static void efa_com_dealloc_ctx_id(struct efa_com_admin_queue *aq,
				   u16 ctx_id)
{}

static inline void efa_com_put_comp_ctx(struct efa_com_admin_queue *aq,
					struct efa_comp_ctx *comp_ctx)
{}

static struct efa_comp_ctx *efa_com_get_comp_ctx(struct efa_com_admin_queue *aq,
						 u16 cmd_id, bool capture)
{}

static struct efa_comp_ctx *__efa_com_submit_admin_cmd(struct efa_com_admin_queue *aq,
						       struct efa_admin_aq_entry *cmd,
						       size_t cmd_size_in_bytes,
						       struct efa_admin_acq_entry *comp,
						       size_t comp_size_in_bytes)
{}

static inline int efa_com_init_comp_ctxt(struct efa_com_admin_queue *aq)
{}

static struct efa_comp_ctx *efa_com_submit_admin_cmd(struct efa_com_admin_queue *aq,
						     struct efa_admin_aq_entry *cmd,
						     size_t cmd_size_in_bytes,
						     struct efa_admin_acq_entry *comp,
						     size_t comp_size_in_bytes)
{}

static int efa_com_handle_single_admin_completion(struct efa_com_admin_queue *aq,
						  struct efa_admin_acq_entry *cqe)
{}

static void efa_com_handle_admin_completion(struct efa_com_admin_queue *aq)
{}

static int efa_com_comp_status_to_errno(u8 comp_status)
{}

static int efa_com_wait_and_process_admin_cq_polling(struct efa_comp_ctx *comp_ctx,
						     struct efa_com_admin_queue *aq)
{}

static int efa_com_wait_and_process_admin_cq_interrupts(struct efa_comp_ctx *comp_ctx,
							struct efa_com_admin_queue *aq)
{}

/*
 * There are two types to wait for completion.
 * Polling mode - wait until the completion is available.
 * Async mode - wait on wait queue until the completion is ready
 * (or the timeout expired).
 * It is expected that the IRQ called efa_com_handle_admin_completion
 * to mark the completions.
 */
static int efa_com_wait_and_process_admin_cq(struct efa_comp_ctx *comp_ctx,
					     struct efa_com_admin_queue *aq)
{}

/**
 * efa_com_cmd_exec - Execute admin command
 * @aq: admin queue.
 * @cmd: the admin command to execute.
 * @cmd_size: the command size.
 * @comp: command completion return entry.
 * @comp_size: command completion size.
 * Submit an admin command and then wait until the device will return a
 * completion.
 * The completion will be copied into comp.
 *
 * @return - 0 on success, negative value on failure.
 */
int efa_com_cmd_exec(struct efa_com_admin_queue *aq,
		     struct efa_admin_aq_entry *cmd,
		     size_t cmd_size,
		     struct efa_admin_acq_entry *comp,
		     size_t comp_size)
{}

/**
 * efa_com_admin_destroy - Destroy the admin and the async events queues.
 * @edev: EFA communication layer struct
 */
void efa_com_admin_destroy(struct efa_com_dev *edev)
{}

/**
 * efa_com_set_admin_polling_mode - Set the admin completion queue polling mode
 * @edev: EFA communication layer struct
 * @polling: Enable/Disable polling mode
 *
 * Set the admin completion mode.
 */
void efa_com_set_admin_polling_mode(struct efa_com_dev *edev, bool polling)
{}

static void efa_com_stats_init(struct efa_com_dev *edev)
{}

/**
 * efa_com_admin_init - Init the admin and the async queues
 * @edev: EFA communication layer struct
 * @aenq_handlers: Those handlers to be called upon event.
 *
 * Initialize the admin submission and completion queues.
 * Initialize the asynchronous events notification queues.
 *
 * @return - 0 on success, negative value on failure.
 */
int efa_com_admin_init(struct efa_com_dev *edev,
		       struct efa_aenq_handlers *aenq_handlers)
{}

/**
 * efa_com_admin_q_comp_intr_handler - admin queue interrupt handler
 * @edev: EFA communication layer struct
 *
 * This method goes over the admin completion queue and wakes up
 * all the pending threads that wait on the commands wait event.
 *
 * Note: Should be called after MSI-X interrupt.
 */
void efa_com_admin_q_comp_intr_handler(struct efa_com_dev *edev)
{}

/*
 * efa_handle_specific_aenq_event:
 * return the handler that is relevant to the specific event group
 */
static efa_aenq_handler efa_com_get_specific_aenq_cb(struct efa_com_dev *edev,
						     u16 group)
{}

/**
 * efa_com_aenq_intr_handler - AENQ interrupt handler
 * @edev: EFA communication layer struct
 * @data: Data of interrupt handler.
 *
 * Go over the async event notification queue and call the proper aenq handler.
 */
void efa_com_aenq_intr_handler(struct efa_com_dev *edev, void *data)
{}

static void efa_com_mmio_reg_read_resp_addr_init(struct efa_com_dev *edev)
{}

int efa_com_mmio_reg_read_init(struct efa_com_dev *edev)
{}

void efa_com_mmio_reg_read_destroy(struct efa_com_dev *edev)
{}

int efa_com_validate_version(struct efa_com_dev *edev)
{}

/**
 * efa_com_get_dma_width - Retrieve physical dma address width the device
 * supports.
 * @edev: EFA communication layer struct
 *
 * Retrieve the maximum physical address bits the device can handle.
 *
 * @return: > 0 on Success and negative value otherwise.
 */
int efa_com_get_dma_width(struct efa_com_dev *edev)
{}

static int wait_for_reset_state(struct efa_com_dev *edev, u32 timeout, int on)
{}

/**
 * efa_com_dev_reset - Perform device FLR to the device.
 * @edev: EFA communication layer struct
 * @reset_reason: Specify what is the trigger for the reset in case of an error.
 *
 * @return - 0 on success, negative value on failure.
 */
int efa_com_dev_reset(struct efa_com_dev *edev,
		      enum efa_regs_reset_reason_types reset_reason)
{}

static int efa_com_create_eq(struct efa_com_dev *edev,
			     struct efa_com_create_eq_params *params,
			     struct efa_com_create_eq_result *result)
{}

static void efa_com_destroy_eq(struct efa_com_dev *edev,
			       struct efa_com_destroy_eq_params *params)
{}

static void efa_com_arm_eq(struct efa_com_dev *edev, struct efa_com_eq *eeq)
{}

void efa_com_eq_comp_intr_handler(struct efa_com_dev *edev,
				  struct efa_com_eq *eeq)
{}

void efa_com_eq_destroy(struct efa_com_dev *edev, struct efa_com_eq *eeq)
{}

int efa_com_eq_init(struct efa_com_dev *edev, struct efa_com_eq *eeq,
		    efa_eqe_handler cb, u16 depth, u8 msix_vec)
{}