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