linux/drivers/net/ethernet/qlogic/qed/qed_spq.c

// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
/* QLogic qed NIC Driver
 * Copyright (c) 2015-2017  QLogic Corporation
 * Copyright (c) 2019-2020 Marvell International Ltd.
 */

#include <linux/types.h>
#include <asm/byteorder.h>
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include "qed.h"
#include "qed_cxt.h"
#include "qed_dev_api.h"
#include "qed_hsi.h"
#include "qed_iro_hsi.h"
#include "qed_hw.h"
#include "qed_int.h"
#include "qed_iscsi.h"
#include "qed_mcp.h"
#include "qed_ooo.h"
#include "qed_reg_addr.h"
#include "qed_sp.h"
#include "qed_sriov.h"
#include "qed_rdma.h"

/***************************************************************************
 * Structures & Definitions
 ***************************************************************************/

#define SPQ_HIGH_PRI_RESERVE_DEFAULT

#define SPQ_BLOCK_DELAY_MAX_ITER
#define SPQ_BLOCK_DELAY_US
#define SPQ_BLOCK_SLEEP_MAX_ITER
#define SPQ_BLOCK_SLEEP_MS

/***************************************************************************
 * Blocking Imp. (BLOCK/EBLOCK mode)
 ***************************************************************************/
static void qed_spq_blocking_cb(struct qed_hwfn *p_hwfn,
				void *cookie,
				union event_ring_data *data, u8 fw_return_code)
{}

static int __qed_spq_block(struct qed_hwfn *p_hwfn,
			   struct qed_spq_entry *p_ent,
			   u8 *p_fw_ret, bool sleep_between_iter)
{}

static int qed_spq_block(struct qed_hwfn *p_hwfn,
			 struct qed_spq_entry *p_ent,
			 u8 *p_fw_ret, bool skip_quick_poll)
{}

/***************************************************************************
 * SPQ entries inner API
 ***************************************************************************/
static int qed_spq_fill_entry(struct qed_hwfn *p_hwfn,
			      struct qed_spq_entry *p_ent)
{}

/***************************************************************************
 * HSI access
 ***************************************************************************/
static void qed_spq_hw_initialize(struct qed_hwfn *p_hwfn,
				  struct qed_spq *p_spq)
{}

static int qed_spq_hw_post(struct qed_hwfn *p_hwfn,
			   struct qed_spq *p_spq, struct qed_spq_entry *p_ent)
{}

/***************************************************************************
 * Asynchronous events
 ***************************************************************************/
static int
qed_async_event_completion(struct qed_hwfn *p_hwfn,
			   struct event_ring_entry *p_eqe)
{}

int
qed_spq_register_async_cb(struct qed_hwfn *p_hwfn,
			  enum protocol_type protocol_id,
			  qed_spq_async_comp_cb cb)
{}

void
qed_spq_unregister_async_cb(struct qed_hwfn *p_hwfn,
			    enum protocol_type protocol_id)
{}

/***************************************************************************
 * EQ API
 ***************************************************************************/
void qed_eq_prod_update(struct qed_hwfn *p_hwfn, u16 prod)
{}

int qed_eq_completion(struct qed_hwfn *p_hwfn, void *cookie)
{}

int qed_eq_alloc(struct qed_hwfn *p_hwfn, u16 num_elem)
{}

void qed_eq_setup(struct qed_hwfn *p_hwfn)
{}

void qed_eq_free(struct qed_hwfn *p_hwfn)
{}

/***************************************************************************
 * CQE API - manipulate EQ functionality
 ***************************************************************************/
static int qed_cqe_completion(struct qed_hwfn *p_hwfn,
			      struct eth_slow_path_rx_cqe *cqe,
			      enum protocol_type protocol)
{}

int qed_eth_cqe_completion(struct qed_hwfn *p_hwfn,
			   struct eth_slow_path_rx_cqe *cqe)
{}

/***************************************************************************
 * Slow hwfn Queue (spq)
 ***************************************************************************/
void qed_spq_setup(struct qed_hwfn *p_hwfn)
{}

int qed_spq_alloc(struct qed_hwfn *p_hwfn)
{}

void qed_spq_free(struct qed_hwfn *p_hwfn)
{}

int qed_spq_get_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry **pp_ent)
{}

/* Locked variant; Should be called while the SPQ lock is taken */
static void __qed_spq_return_entry(struct qed_hwfn *p_hwfn,
				   struct qed_spq_entry *p_ent)
{}

void qed_spq_return_entry(struct qed_hwfn *p_hwfn, struct qed_spq_entry *p_ent)
{}

/**
 * qed_spq_add_entry() - Add a new entry to the pending list.
 *                       Should be used while lock is being held.
 *
 * @p_hwfn: HW device data.
 * @p_ent: An entry to add.
 * @priority: Desired priority.
 *
 * Adds an entry to the pending list is there is room (an empty
 * element is available in the free_pool), or else places the
 * entry in the unlimited_pending pool.
 *
 * Return: zero on success, -EINVAL on invalid @priority.
 */
static int qed_spq_add_entry(struct qed_hwfn *p_hwfn,
			     struct qed_spq_entry *p_ent,
			     enum spq_priority priority)
{}

/***************************************************************************
 * Accessor
 ***************************************************************************/
u32 qed_spq_get_cid(struct qed_hwfn *p_hwfn)
{}

/***************************************************************************
 * Posting new Ramrods
 ***************************************************************************/
static int qed_spq_post_list(struct qed_hwfn *p_hwfn,
			     struct list_head *head, u32 keep_reserve)
{}

int qed_spq_pend_post(struct qed_hwfn *p_hwfn)
{}

static void qed_spq_recov_set_ret_code(struct qed_spq_entry *p_ent,
				       u8 *fw_return_code)
{}

/* Avoid overriding of SPQ entries when getting out-of-order completions, by
 * marking the completions in a bitmap and increasing the chain consumer only
 * for the first successive completed entries.
 */
static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo)
{}

int qed_spq_post(struct qed_hwfn *p_hwfn,
		 struct qed_spq_entry *p_ent, u8 *fw_return_code)
{}

int qed_spq_completion(struct qed_hwfn *p_hwfn,
		       __le16 echo,
		       u8 fw_return_code,
		       union event_ring_data *p_data)
{}

#define QED_SPQ_CONSQ_ELEM_SIZE

int qed_consq_alloc(struct qed_hwfn *p_hwfn)
{}

void qed_consq_setup(struct qed_hwfn *p_hwfn)
{}

void qed_consq_free(struct qed_hwfn *p_hwfn)
{}