linux/drivers/net/ethernet/qlogic/qed/qed_rdma.h

/* 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.
 */

#ifndef _QED_RDMA_H
#define _QED_RDMA_H
#include <linux/types.h>
#include <linux/bitops.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/qed/qed_if.h>
#include <linux/qed/qed_rdma_if.h>
#include "qed.h"
#include "qed_dev_api.h"
#include "qed_hsi.h"
#include "qed_iwarp.h"
#include "qed_roce.h"

#define QED_RDMA_MAX_P_KEY
#define QED_RDMA_MAX_WQE
#define QED_RDMA_MAX_SRQ_WQE_ELEM
#define QED_RDMA_PAGE_SIZE_CAPS
#define QED_RDMA_ACK_DELAY
#define QED_RDMA_MAX_MR_SIZE
#define QED_RDMA_MAX_CQS
#define QED_RDMA_MAX_MRS
/* Add 1 for header element */
#define QED_RDMA_MAX_SRQ_ELEM_PER_WQE
#define QED_RDMA_MAX_SGE_PER_SRQ_WQE
#define QED_RDMA_SRQ_WQE_ELEM_SIZE
#define QED_RDMA_MAX_SRQS

#define QED_RDMA_MAX_CQE_32_BIT
#define QED_RDMA_MAX_CQE_16_BIT

/* Up to 2^16 XRC Domains are supported, but the actual number of supported XRC
 * SRQs is much smaller so there's no need to have that many domains.
 */
#define QED_RDMA_MAX_XRCDS

enum qed_rdma_toggle_bit {};

#define QED_RDMA_MAX_BMAP_NAME
struct qed_bmap {};

struct qed_rdma_info {};

struct qed_rdma_qp {};

static inline bool qed_rdma_is_xrc_qp(struct qed_rdma_qp *qp)
{}

#if IS_ENABLED(CONFIG_QED_RDMA)
void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
void qed_rdma_dpm_conf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
int qed_rdma_info_alloc(struct qed_hwfn *p_hwfn);
void qed_rdma_info_free(struct qed_hwfn *p_hwfn);
#else
static inline void qed_rdma_dpm_conf(struct qed_hwfn *p_hwfn,
				     struct qed_ptt *p_ptt) {}
static inline void qed_rdma_dpm_bar(struct qed_hwfn *p_hwfn,
				    struct qed_ptt *p_ptt) {}
static inline int qed_rdma_info_alloc(struct qed_hwfn *p_hwfn)
				      {return -EINVAL; }
static inline void qed_rdma_info_free(struct qed_hwfn *p_hwfn) {}
#endif

int
qed_rdma_bmap_alloc(struct qed_hwfn *p_hwfn,
		    struct qed_bmap *bmap, u32 max_count, char *name);

void
qed_rdma_bmap_free(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap, bool check);

int
qed_rdma_bmap_alloc_id(struct qed_hwfn *p_hwfn,
		       struct qed_bmap *bmap, u32 *id_num);

void
qed_bmap_set_id(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap, u32 id_num);

void
qed_bmap_release_id(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap, u32 id_num);

int
qed_bmap_test_id(struct qed_hwfn *p_hwfn, struct qed_bmap *bmap, u32 id_num);

void qed_rdma_set_fw_mac(__le16 *p_fw_mac, const u8 *p_qed_mac);

bool qed_rdma_allocated_qps(struct qed_hwfn *p_hwfn);
#endif