linux/drivers/infiniband/hw/irdma/main.h

/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2015 - 2021 Intel Corporation */
#ifndef IRDMA_MAIN_H
#define IRDMA_MAIN_H

#include <linux/ip.h>
#include <linux/tcp.h>
#include <linux/if_vlan.h>
#include <net/addrconf.h>
#include <net/netevent.h>
#include <net/tcp.h>
#include <net/ip6_route.h>
#include <net/flow.h>
#include <net/secure_seq.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/inetdevice.h>
#include <linux/spinlock.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/workqueue.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/crc32c.h>
#include <linux/kthread.h>
#ifndef CONFIG_64BIT
#include <linux/io-64-nonatomic-lo-hi.h>
#endif
#include <linux/auxiliary_bus.h>
#include <linux/net/intel/iidc.h>
#include <crypto/hash.h>
#include <rdma/ib_smi.h>
#include <rdma/ib_verbs.h>
#include <rdma/ib_pack.h>
#include <rdma/rdma_cm.h>
#include <rdma/iw_cm.h>
#include <rdma/ib_user_verbs.h>
#include <rdma/ib_umem.h>
#include <rdma/ib_cache.h>
#include <rdma/uverbs_ioctl.h>
#include "osdep.h"
#include "defs.h"
#include "hmc.h"
#include "type.h"
#include "ws.h"
#include "protos.h"
#include "pble.h"
#include "cm.h"
#include <rdma/irdma-abi.h>
#include "verbs.h"
#include "user.h"
#include "puda.h"

extern struct auxiliary_driver i40iw_auxiliary_drv;

#define IRDMA_FW_VER_DEFAULT
#define IRDMA_HW_VER

#define IRDMA_ARP_ADD
#define IRDMA_ARP_DELETE
#define IRDMA_ARP_RESOLVE

#define IRDMA_MACIP_ADD
#define IRDMA_MACIP_DELETE

#define IW_CCQ_SIZE
#define IW_CEQ_SIZE
#define IW_AEQ_SIZE

#define RX_BUF_SIZE
#define IW_REG0_SIZE
#define IW_TX_TIMEOUT
#define IW_FIRST_QPN

#define IW_SW_CONTEXT_ALIGN

#define MAX_DPC_ITERATIONS

#define IRDMA_EVENT_TIMEOUT_MS
#define IRDMA_VCHNL_EVENT_TIMEOUT
#define IRDMA_RST_TIMEOUT_HZ

#define IRDMA_NO_QSET

#define IW_CFG_FPM_QP_COUNT
#define IRDMA_MAX_PAGES_PER_FMR
#define IRDMA_MIN_PAGES_PER_FMR
#define IRDMA_CQP_COMPL_RQ_WQE_FLUSHED
#define IRDMA_CQP_COMPL_SQ_WQE_FLUSHED

#define IRDMA_Q_TYPE_PE_AEQ
#define IRDMA_Q_INVALID_IDX
#define IRDMA_REM_ENDPOINT_TRK_QPID

#define IRDMA_DRV_OPT_ENA_MPA_VER_0
#define IRDMA_DRV_OPT_DISABLE_MPA_CRC
#define IRDMA_DRV_OPT_DISABLE_FIRST_WRITE
#define IRDMA_DRV_OPT_DISABLE_INTF
#define IRDMA_DRV_OPT_ENA_MSI
#define IRDMA_DRV_OPT_DUAL_LOGICAL_PORT
#define IRDMA_DRV_OPT_NO_INLINE_DATA
#define IRDMA_DRV_OPT_DISABLE_INT_MOD
#define IRDMA_DRV_OPT_DISABLE_VIRT_WQ
#define IRDMA_DRV_OPT_ENA_PAU
#define IRDMA_DRV_OPT_MCAST_LOGPORT_MAP

#define IW_HMC_OBJ_TYPE_NUM
#define IRDMA_ROCE_CWND_DEFAULT
#define IRDMA_ROCE_ACKCREDS_DEFAULT

#define IRDMA_FLUSH_SQ
#define IRDMA_FLUSH_RQ
#define IRDMA_REFLUSH
#define IRDMA_FLUSH_WAIT

#define IRDMA_IRQ_NAME_STR_LEN

enum init_completion_state {};

struct irdma_rsrc_limits {};

struct irdma_cqp_err_info {};

struct irdma_cqp_compl_info {};

struct irdma_cqp_request {};

struct irdma_cqp {};

struct irdma_ccq {};

struct irdma_ceq {};

struct irdma_aeq {};

struct irdma_arp_entry {};

struct irdma_msix_vector {};

struct irdma_mc_table_info {};

struct mc_table_list {};

struct irdma_qv_info {};

struct irdma_qvlist_info {};

struct irdma_gen_ops {};

struct irdma_pci_f {};

struct irdma_device {};

static inline struct irdma_device *to_iwdev(struct ib_device *ibdev)
{}

static inline struct irdma_ucontext *to_ucontext(struct ib_ucontext *ibucontext)
{}

static inline struct irdma_user_mmap_entry *
to_irdma_mmap_entry(struct rdma_user_mmap_entry *rdma_entry)
{}

static inline struct irdma_pd *to_iwpd(struct ib_pd *ibpd)
{}

static inline struct irdma_ah *to_iwah(struct ib_ah *ibah)
{}

static inline struct irdma_mr *to_iwmr(struct ib_mr *ibmr)
{}

static inline struct irdma_mr *to_iwmw(struct ib_mw *ibmw)
{}

static inline struct irdma_cq *to_iwcq(struct ib_cq *ibcq)
{}

static inline struct irdma_qp *to_iwqp(struct ib_qp *ibqp)
{}

static inline struct irdma_pci_f *dev_to_rf(struct irdma_sc_dev *dev)
{}

/**
 * irdma_alloc_resource - allocate a resource
 * @iwdev: device pointer
 * @resource_array: resource bit array:
 * @max_resources: maximum resource number
 * @req_resources_num: Allocated resource number
 * @next: next free id
 **/
static inline int irdma_alloc_rsrc(struct irdma_pci_f *rf,
				   unsigned long *rsrc_array, u32 max_rsrc,
				   u32 *req_rsrc_num, u32 *next)
{}

/**
 * irdma_free_resource - free a resource
 * @iwdev: device pointer
 * @resource_array: resource array for the resource_num
 * @resource_num: resource number to free
 **/
static inline void irdma_free_rsrc(struct irdma_pci_f *rf,
				   unsigned long *rsrc_array, u32 rsrc_num)
{}

int irdma_ctrl_init_hw(struct irdma_pci_f *rf);
void irdma_ctrl_deinit_hw(struct irdma_pci_f *rf);
int irdma_rt_init_hw(struct irdma_device *iwdev,
		     struct irdma_l2params *l2params);
void irdma_rt_deinit_hw(struct irdma_device *iwdev);
void irdma_qp_add_ref(struct ib_qp *ibqp);
void irdma_qp_rem_ref(struct ib_qp *ibqp);
void irdma_free_lsmm_rsrc(struct irdma_qp *iwqp);
struct ib_qp *irdma_get_qp(struct ib_device *ibdev, int qpn);
void irdma_flush_wqes(struct irdma_qp *iwqp, u32 flush_mask);
void irdma_manage_arp_cache(struct irdma_pci_f *rf,
			    const unsigned char *mac_addr,
			    u32 *ip_addr, bool ipv4, u32 action);
struct irdma_apbvt_entry *irdma_add_apbvt(struct irdma_device *iwdev, u16 port);
void irdma_del_apbvt(struct irdma_device *iwdev,
		     struct irdma_apbvt_entry *entry);
struct irdma_cqp_request *irdma_alloc_and_get_cqp_request(struct irdma_cqp *cqp,
							  bool wait);
void irdma_free_cqp_request(struct irdma_cqp *cqp,
			    struct irdma_cqp_request *cqp_request);
void irdma_put_cqp_request(struct irdma_cqp *cqp,
			   struct irdma_cqp_request *cqp_request);
int irdma_alloc_local_mac_entry(struct irdma_pci_f *rf, u16 *mac_tbl_idx);
int irdma_add_local_mac_entry(struct irdma_pci_f *rf, const u8 *mac_addr, u16 idx);
void irdma_del_local_mac_entry(struct irdma_pci_f *rf, u16 idx);

u32 irdma_initialize_hw_rsrc(struct irdma_pci_f *rf);
void irdma_port_ibevent(struct irdma_device *iwdev);
void irdma_cm_disconn(struct irdma_qp *qp);

bool irdma_cqp_crit_err(struct irdma_sc_dev *dev, u8 cqp_cmd,
			u16 maj_err_code, u16 min_err_code);
int irdma_handle_cqp_op(struct irdma_pci_f *rf,
			struct irdma_cqp_request *cqp_request);

int irdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
		    struct ib_udata *udata);
int irdma_modify_qp_roce(struct ib_qp *ibqp, struct ib_qp_attr *attr,
			 int attr_mask, struct ib_udata *udata);
void irdma_cq_add_ref(struct ib_cq *ibcq);
void irdma_cq_rem_ref(struct ib_cq *ibcq);
void irdma_cq_wq_destroy(struct irdma_pci_f *rf, struct irdma_sc_cq *cq);

void irdma_cleanup_pending_cqp_op(struct irdma_pci_f *rf);
int irdma_hw_modify_qp(struct irdma_device *iwdev, struct irdma_qp *iwqp,
		       struct irdma_modify_qp_info *info, bool wait);
int irdma_qp_suspend_resume(struct irdma_sc_qp *qp, bool suspend);
int irdma_manage_qhash(struct irdma_device *iwdev, struct irdma_cm_info *cminfo,
		       enum irdma_quad_entry_type etype,
		       enum irdma_quad_hash_manage_type mtype, void *cmnode,
		       bool wait);
void irdma_receive_ilq(struct irdma_sc_vsi *vsi, struct irdma_puda_buf *rbuf);
void irdma_free_sqbuf(struct irdma_sc_vsi *vsi, void *bufp);
void irdma_free_qp_rsrc(struct irdma_qp *iwqp);
int irdma_setup_cm_core(struct irdma_device *iwdev, u8 ver);
void irdma_cleanup_cm_core(struct irdma_cm_core *cm_core);
void irdma_next_iw_state(struct irdma_qp *iwqp, u8 state, u8 del_hash, u8 term,
			 u8 term_len);
int irdma_send_syn(struct irdma_cm_node *cm_node, u32 sendack);
int irdma_send_reset(struct irdma_cm_node *cm_node);
struct irdma_cm_node *irdma_find_node(struct irdma_cm_core *cm_core,
				      u16 rem_port, u32 *rem_addr, u16 loc_port,
				      u32 *loc_addr, u16 vlan_id);
int irdma_hw_flush_wqes(struct irdma_pci_f *rf, struct irdma_sc_qp *qp,
			struct irdma_qp_flush_info *info, bool wait);
void irdma_gen_ae(struct irdma_pci_f *rf, struct irdma_sc_qp *qp,
		  struct irdma_gen_ae_info *info, bool wait);
void irdma_copy_ip_ntohl(u32 *dst, __be32 *src);
void irdma_copy_ip_htonl(__be32 *dst, u32 *src);
u16 irdma_get_vlan_ipv4(u32 *addr);
void irdma_get_vlan_mac_ipv6(u32 *addr, u16 *vlan_id, u8 *mac);
struct ib_mr *irdma_reg_phys_mr(struct ib_pd *ib_pd, u64 addr, u64 size,
				int acc, u64 *iova_start);
int irdma_upload_qp_context(struct irdma_qp *iwqp, bool freeze, bool raw);
void irdma_cqp_ce_handler(struct irdma_pci_f *rf, struct irdma_sc_cq *cq);
int irdma_ah_cqp_op(struct irdma_pci_f *rf, struct irdma_sc_ah *sc_ah, u8 cmd,
		    bool wait,
		    void (*callback_fcn)(struct irdma_cqp_request *cqp_request),
		    void *cb_param);
void irdma_gsi_ud_qp_ah_cb(struct irdma_cqp_request *cqp_request);
bool irdma_cq_empty(struct irdma_cq *iwcq);
int irdma_inetaddr_event(struct notifier_block *notifier, unsigned long event,
			 void *ptr);
int irdma_inet6addr_event(struct notifier_block *notifier, unsigned long event,
			  void *ptr);
int irdma_net_event(struct notifier_block *notifier, unsigned long event,
		    void *ptr);
int irdma_netdevice_event(struct notifier_block *notifier, unsigned long event,
			  void *ptr);
void irdma_add_ip(struct irdma_device *iwdev);
void cqp_compl_worker(struct work_struct *work);
#endif /* IRDMA_MAIN_H */