linux/drivers/net/ethernet/qlogic/qed/qed_cxt.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 <linux/bitops.h>
#include <linux/dma-mapping.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/log2.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/string.h>
#include "qed.h"
#include "qed_cxt.h"
#include "qed_dev_api.h"
#include "qed_hsi.h"
#include "qed_hw.h"
#include "qed_init_ops.h"
#include "qed_rdma.h"
#include "qed_reg_addr.h"
#include "qed_sriov.h"

/* QM constants */
#define QM_PQ_ELEMENT_SIZE

/* Doorbell-Queue constants */
#define DQ_RANGE_SHIFT
#define DQ_RANGE_ALIGN

/* Searcher constants */
#define SRC_MIN_NUM_ELEMS

/* Timers constants */
#define TM_SHIFT
#define TM_ALIGN
#define TM_ELEM_SIZE

#define ILT_DEFAULT_HW_P_SIZE

#define ILT_PAGE_IN_BYTES(hw_p_size)
#define ILT_CFG_REG(cli, reg)

/* ILT entry structure */
#define ILT_ENTRY_PHY_ADDR_MASK
#define ILT_ENTRY_PHY_ADDR_SHIFT
#define ILT_ENTRY_VALID_MASK
#define ILT_ENTRY_VALID_SHIFT
#define ILT_ENTRY_IN_REGS
#define ILT_REG_SIZE_IN_BYTES

/* connection context union */
conn_context;

/* TYPE-0 task context - iSCSI, FCOE */
type0_task_context;

/* TYPE-1 task context - ROCE */
type1_task_context;

struct src_ent {};

#define CDUT_SEG_ALIGNMET
#define CDUT_SEG_ALIGNMET_IN_BYTES

#define CONN_CXT_SIZE(p_hwfn)

#define SRQ_CXT_SIZE
#define XRC_SRQ_CXT_SIZE

#define TYPE0_TASK_CXT_SIZE(p_hwfn)

/* Alignment is inherent to the type1_task_context structure */
#define TYPE1_TASK_CXT_SIZE(p_hwfn)

static bool src_proto(enum protocol_type type)
{}

static bool tm_cid_proto(enum protocol_type type)
{}

static bool tm_tid_proto(enum protocol_type type)
{}

/* counts the iids for the CDU/CDUC ILT client configuration */
struct qed_cdu_iids {};

static void qed_cxt_cdu_iids(struct qed_cxt_mngr *p_mngr,
			     struct qed_cdu_iids *iids)
{}

/* counts the iids for the Searcher block configuration */
struct qed_src_iids {};

static void qed_cxt_src_iids(struct qed_cxt_mngr *p_mngr,
			     struct qed_src_iids *iids)
{}

/* counts the iids for the Timers block configuration */
struct qed_tm_iids {};

static void qed_cxt_tm_iids(struct qed_hwfn *p_hwfn,
			    struct qed_cxt_mngr *p_mngr,
			    struct qed_tm_iids *iids)
{}

static void qed_cxt_qm_iids(struct qed_hwfn *p_hwfn,
			    struct qed_qm_iids *iids)
{}

static struct qed_tid_seg *qed_cxt_tid_seg_info(struct qed_hwfn *p_hwfn,
						u32 seg)
{}

static void qed_cxt_set_srq_count(struct qed_hwfn *p_hwfn,
				  u32 num_srqs, u32 num_xrc_srqs)
{}

u32 qed_cxt_get_ilt_page_size(struct qed_hwfn *p_hwfn,
			      enum ilt_clients ilt_client)
{}

static u32 qed_cxt_xrc_srqs_per_page(struct qed_hwfn *p_hwfn)
{}

u32 qed_cxt_get_total_srq_count(struct qed_hwfn *p_hwfn)
{}

/* set the iids count per protocol */
static void qed_cxt_set_proto_cid_count(struct qed_hwfn *p_hwfn,
					enum protocol_type type,
					u32 cid_count, u32 vf_cid_cnt)
{}

u32 qed_cxt_get_proto_cid_count(struct qed_hwfn *p_hwfn,
				enum protocol_type type, u32 *vf_cid)
{}

u32 qed_cxt_get_proto_cid_start(struct qed_hwfn *p_hwfn,
				enum protocol_type type)
{}

u32 qed_cxt_get_proto_tid_count(struct qed_hwfn *p_hwfn,
				enum protocol_type type)
{}

static void qed_cxt_set_proto_tid_count(struct qed_hwfn *p_hwfn,
					enum protocol_type proto,
					u8 seg,
					u8 seg_type, u32 count, bool has_fl)
{}

static void qed_ilt_cli_blk_fill(struct qed_ilt_client_cfg *p_cli,
				 struct qed_ilt_cli_blk *p_blk,
				 u32 start_line, u32 total_size, u32 elem_size)
{}

static void qed_ilt_cli_adv_line(struct qed_hwfn *p_hwfn,
				 struct qed_ilt_client_cfg *p_cli,
				 struct qed_ilt_cli_blk *p_blk,
				 u32 *p_line, enum ilt_clients client_id)
{}

static u32 qed_ilt_get_dynamic_line_cnt(struct qed_hwfn *p_hwfn,
					enum ilt_clients ilt_client)
{}

static struct qed_ilt_client_cfg *qed_cxt_set_cli(struct qed_ilt_client_cfg
						  *p_cli)
{}

static struct qed_ilt_cli_blk *qed_cxt_set_blk(struct qed_ilt_cli_blk *p_blk)
{}

static void qed_cxt_ilt_blk_reset(struct qed_hwfn *p_hwfn)
{}

int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn, u32 *line_count)
{}

u32 qed_cxt_cfg_ilt_compute_excess(struct qed_hwfn *p_hwfn, u32 used_lines)
{}

static void qed_cxt_src_t2_free(struct qed_hwfn *p_hwfn)
{}

static int
qed_cxt_t2_alloc_pages(struct qed_hwfn *p_hwfn,
		       struct qed_src_t2 *p_t2, u32 total_size, u32 page_size)
{}

static int qed_cxt_src_t2_alloc(struct qed_hwfn *p_hwfn)
{}

#define for_each_ilt_valid_client(pos, clients)				\

/* Total number of ILT lines used by this PF */
static u32 qed_cxt_ilt_shadow_size(struct qed_ilt_client_cfg *ilt_clients)
{}

static void qed_ilt_shadow_free(struct qed_hwfn *p_hwfn)
{}

static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,
			     struct qed_ilt_cli_blk *p_blk,
			     enum ilt_clients ilt_client,
			     u32 start_line_offset)
{}

static int qed_ilt_shadow_alloc(struct qed_hwfn *p_hwfn)
{}

static void qed_cid_map_free(struct qed_hwfn *p_hwfn)
{}

static int
qed_cid_map_alloc_single(struct qed_hwfn *p_hwfn,
			 u32 type,
			 u32 cid_start,
			 u32 cid_count, struct qed_cid_acquired_map *p_map)
{}

static int qed_cid_map_alloc(struct qed_hwfn *p_hwfn)
{}

int qed_cxt_mngr_alloc(struct qed_hwfn *p_hwfn)
{}

int qed_cxt_tables_alloc(struct qed_hwfn *p_hwfn)
{}

void qed_cxt_mngr_free(struct qed_hwfn *p_hwfn)
{}

void qed_cxt_mngr_setup(struct qed_hwfn *p_hwfn)
{}

/* CDU Common */
#define CDUC_CXT_SIZE_SHIFT

#define CDUC_CXT_SIZE_MASK

#define CDUC_BLOCK_WASTE_SHIFT

#define CDUC_BLOCK_WASTE_MASK

#define CDUC_NCIB_SHIFT

#define CDUC_NCIB_MASK

#define CDUT_TYPE0_CXT_SIZE_SHIFT

#define CDUT_TYPE0_CXT_SIZE_MASK

#define CDUT_TYPE0_BLOCK_WASTE_SHIFT

#define CDUT_TYPE0_BLOCK_WASTE_MASK

#define CDUT_TYPE0_NCIB_SHIFT

#define CDUT_TYPE0_NCIB_MASK

#define CDUT_TYPE1_CXT_SIZE_SHIFT

#define CDUT_TYPE1_CXT_SIZE_MASK

#define CDUT_TYPE1_BLOCK_WASTE_SHIFT

#define CDUT_TYPE1_BLOCK_WASTE_MASK

#define CDUT_TYPE1_NCIB_SHIFT

#define CDUT_TYPE1_NCIB_MASK

static void qed_cdu_init_common(struct qed_hwfn *p_hwfn)
{}

/* CDU PF */
#define CDU_SEG_REG_TYPE_SHIFT
#define CDU_SEG_REG_TYPE_MASK
#define CDU_SEG_REG_OFFSET_SHIFT
#define CDU_SEG_REG_OFFSET_MASK

static void qed_cdu_init_pf(struct qed_hwfn *p_hwfn)
{}

void qed_qm_init_pf(struct qed_hwfn *p_hwfn,
		    struct qed_ptt *p_ptt, bool is_pf_loading)
{}

/* CM PF */
static void qed_cm_init_pf(struct qed_hwfn *p_hwfn)
{}

/* DQ PF */
static void qed_dq_init_pf(struct qed_hwfn *p_hwfn)
{}

static void qed_ilt_bounds_init(struct qed_hwfn *p_hwfn)
{}

static void qed_ilt_vf_bounds_init(struct qed_hwfn *p_hwfn)
{}

/* ILT (PSWRQ2) PF */
static void qed_ilt_init_pf(struct qed_hwfn *p_hwfn)
{}

/* SRC (Searcher) PF */
static void qed_src_init_pf(struct qed_hwfn *p_hwfn)
{}

/* Timers PF */
#define TM_CFG_NUM_IDS_SHIFT
#define TM_CFG_NUM_IDS_MASK
#define TM_CFG_PRE_SCAN_OFFSET_SHIFT
#define TM_CFG_PRE_SCAN_OFFSET_MASK
#define TM_CFG_PARENT_PF_SHIFT
#define TM_CFG_PARENT_PF_MASK

#define TM_CFG_CID_PRE_SCAN_ROWS_SHIFT
#define TM_CFG_CID_PRE_SCAN_ROWS_MASK

#define TM_CFG_TID_OFFSET_SHIFT
#define TM_CFG_TID_OFFSET_MASK
#define TM_CFG_TID_PRE_SCAN_ROWS_SHIFT
#define TM_CFG_TID_PRE_SCAN_ROWS_MASK

static void qed_tm_init_pf(struct qed_hwfn *p_hwfn)
{}

static void qed_prs_init_common(struct qed_hwfn *p_hwfn)
{}

static void qed_prs_init_pf(struct qed_hwfn *p_hwfn)
{}

void qed_cxt_hw_init_common(struct qed_hwfn *p_hwfn)
{}

void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
{}

int _qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn,
			 enum protocol_type type, u32 *p_cid, u8 vfid)
{}

int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn,
			enum protocol_type type, u32 *p_cid)
{}

static bool qed_cxt_test_cid_acquired(struct qed_hwfn *p_hwfn,
				      u32 cid,
				      u8 vfid,
				      enum protocol_type *p_type,
				      struct qed_cid_acquired_map **pp_map)
{}

void _qed_cxt_release_cid(struct qed_hwfn *p_hwfn, u32 cid, u8 vfid)
{}

void qed_cxt_release_cid(struct qed_hwfn *p_hwfn, u32 cid)
{}

int qed_cxt_get_cid_info(struct qed_hwfn *p_hwfn, struct qed_cxt_info *p_info)
{}

static void qed_rdma_set_pf_params(struct qed_hwfn *p_hwfn,
				   struct qed_rdma_pf_params *p_params,
				   u32 num_tasks)
{}

int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn, u32 rdma_tasks)
{}

int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
			     struct qed_tid_mem *p_info)
{}

/* This function is very RoCE oriented, if another protocol in the future
 * will want this feature we'll need to modify the function to be more generic
 */
int
qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
			  enum qed_cxt_elem_type elem_type, u32 iid)
{}

/* This function is very RoCE oriented, if another protocol in the future
 * will want this feature we'll need to modify the function to be more generic
 */
static int
qed_cxt_free_ilt_range(struct qed_hwfn *p_hwfn,
		       enum qed_cxt_elem_type elem_type,
		       u32 start_iid, u32 count)
{}

int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto)
{}

int qed_cxt_get_task_ctx(struct qed_hwfn *p_hwfn,
			 u32 tid, u8 ctx_type, void **pp_task_ctx)
{}

static u16 qed_blk_calculate_pages(struct qed_ilt_cli_blk *p_blk)
{}

u16 qed_get_cdut_num_pf_init_pages(struct qed_hwfn *p_hwfn)
{}

u16 qed_get_cdut_num_vf_init_pages(struct qed_hwfn *p_hwfn)
{}

u16 qed_get_cdut_num_pf_work_pages(struct qed_hwfn *p_hwfn)
{}

u16 qed_get_cdut_num_vf_work_pages(struct qed_hwfn *p_hwfn)
{}