1 /* SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB */ 2 /* Copyright (c) 2015 - 2021 Intel Corporation */ 3 #ifndef IRDMA_OSDEP_H 4 #define IRDMA_OSDEP_H 5 6 #include <linux/pci.h> 7 #include <linux/bitfield.h> 8 #include <linux/net/intel/iidc.h> 9 #include <crypto/hash.h> 10 #include <rdma/ib_verbs.h> 11 12 #define STATS_TIMER_DELAY 60000 13 14 struct irdma_dma_info { 15 dma_addr_t *dmaaddrs; 16 }; 17 18 struct irdma_dma_mem { 19 void *va; 20 dma_addr_t pa; 21 u32 size; 22 } __packed; 23 24 struct irdma_virt_mem { 25 void *va; 26 u32 size; 27 } __packed; 28 29 struct irdma_sc_vsi; 30 struct irdma_sc_dev; 31 struct irdma_sc_qp; 32 struct irdma_puda_buf; 33 struct irdma_puda_cmpl_info; 34 struct irdma_update_sds_info; 35 struct irdma_hmc_fcn_info; 36 struct irdma_manage_vf_pble_info; 37 struct irdma_hw; 38 struct irdma_pci_f; 39 40 struct ib_device *to_ibdev(struct irdma_sc_dev *dev); 41 void irdma_ieq_mpa_crc_ae(struct irdma_sc_dev *dev, struct irdma_sc_qp *qp); 42 enum irdma_status_code irdma_vf_wait_vchnl_resp(struct irdma_sc_dev *dev); 43 bool irdma_vf_clear_to_send(struct irdma_sc_dev *dev); 44 void irdma_add_dev_ref(struct irdma_sc_dev *dev); 45 void irdma_put_dev_ref(struct irdma_sc_dev *dev); 46 int irdma_ieq_check_mpacrc(struct shash_desc *desc, void *addr, u32 len, 47 u32 val); 48 struct irdma_sc_qp *irdma_ieq_get_qp(struct irdma_sc_dev *dev, 49 struct irdma_puda_buf *buf); 50 void irdma_send_ieq_ack(struct irdma_sc_qp *qp); 51 void irdma_ieq_update_tcpip_info(struct irdma_puda_buf *buf, u16 len, 52 u32 seqnum); 53 void irdma_free_hash_desc(struct shash_desc *hash_desc); 54 int irdma_init_hash_desc(struct shash_desc **hash_desc); 55 int irdma_puda_get_tcpip_info(struct irdma_puda_cmpl_info *info, 56 struct irdma_puda_buf *buf); 57 int irdma_cqp_sds_cmd(struct irdma_sc_dev *dev, 58 struct irdma_update_sds_info *info); 59 int irdma_cqp_manage_hmc_fcn_cmd(struct irdma_sc_dev *dev, 60 struct irdma_hmc_fcn_info *hmcfcninfo, 61 u16 *pmf_idx); 62 int irdma_cqp_query_fpm_val_cmd(struct irdma_sc_dev *dev, 63 struct irdma_dma_mem *val_mem, u8 hmc_fn_id); 64 int irdma_cqp_commit_fpm_val_cmd(struct irdma_sc_dev *dev, 65 struct irdma_dma_mem *val_mem, u8 hmc_fn_id); 66 int irdma_alloc_query_fpm_buf(struct irdma_sc_dev *dev, 67 struct irdma_dma_mem *mem); 68 void *irdma_remove_cqp_head(struct irdma_sc_dev *dev); 69 void irdma_term_modify_qp(struct irdma_sc_qp *qp, u8 next_state, u8 term, 70 u8 term_len); 71 void irdma_terminate_done(struct irdma_sc_qp *qp, int timeout_occurred); 72 void irdma_terminate_start_timer(struct irdma_sc_qp *qp); 73 void irdma_terminate_del_timer(struct irdma_sc_qp *qp); 74 void irdma_hw_stats_start_timer(struct irdma_sc_vsi *vsi); 75 void irdma_hw_stats_stop_timer(struct irdma_sc_vsi *vsi); 76 void wr32(struct irdma_hw *hw, u32 reg, u32 val); 77 u32 rd32(struct irdma_hw *hw, u32 reg); 78 u64 rd64(struct irdma_hw *hw, u32 reg); 79 int irdma_map_vm_page_list(struct irdma_hw *hw, void *va, dma_addr_t *pg_dma, 80 u32 pg_cnt); 81 void irdma_unmap_vm_page_list(struct irdma_hw *hw, dma_addr_t *pg_dma, u32 pg_cnt); 82 #endif /* IRDMA_OSDEP_H */ 83