// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* Copyright (c) 2015 - 2021 Intel Corporation */ #include <linux/etherdevice.h> #include "osdep.h" #include "hmc.h" #include "defs.h" #include "type.h" #include "ws.h" #include "protos.h" /** * irdma_get_qp_from_list - get next qp from a list * @head: Listhead of qp's * @qp: current qp */ struct irdma_sc_qp *irdma_get_qp_from_list(struct list_head *head, struct irdma_sc_qp *qp) { … } /** * irdma_sc_suspend_resume_qps - suspend/resume all qp's on VSI * @vsi: the VSI struct pointer * @op: Set to IRDMA_OP_RESUME or IRDMA_OP_SUSPEND */ void irdma_sc_suspend_resume_qps(struct irdma_sc_vsi *vsi, u8 op) { … } static void irdma_set_qos_info(struct irdma_sc_vsi *vsi, struct irdma_l2params *l2p) { … } /** * irdma_change_l2params - given the new l2 parameters, change all qp * @vsi: RDMA VSI pointer * @l2params: New parameters from l2 */ void irdma_change_l2params(struct irdma_sc_vsi *vsi, struct irdma_l2params *l2params) { … } /** * irdma_qp_rem_qos - remove qp from qos lists during destroy qp * @qp: qp to be removed from qos */ void irdma_qp_rem_qos(struct irdma_sc_qp *qp) { … } /** * irdma_qp_add_qos - called during setctx for qp to be added to qos * @qp: qp to be added to qos */ void irdma_qp_add_qos(struct irdma_sc_qp *qp) { … } /** * irdma_sc_pd_init - initialize sc pd struct * @dev: sc device struct * @pd: sc pd ptr * @pd_id: pd_id for allocated pd * @abi_ver: User/Kernel ABI version */ void irdma_sc_pd_init(struct irdma_sc_dev *dev, struct irdma_sc_pd *pd, u32 pd_id, int abi_ver) { … } /** * irdma_sc_add_arp_cache_entry - cqp wqe add arp cache entry * @cqp: struct for cqp hw * @info: arp entry information * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_add_arp_cache_entry(struct irdma_sc_cqp *cqp, struct irdma_add_arp_cache_entry_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_del_arp_cache_entry - dele arp cache entry * @cqp: struct for cqp hw * @scratch: u64 saved to be used during cqp completion * @arp_index: arp index to delete arp entry * @post_sq: flag for cqp db to ring */ static int irdma_sc_del_arp_cache_entry(struct irdma_sc_cqp *cqp, u64 scratch, u16 arp_index, bool post_sq) { … } /** * irdma_sc_manage_apbvt_entry - for adding and deleting apbvt entries * @cqp: struct for cqp hw * @info: info for apbvt entry to add or delete * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_manage_apbvt_entry(struct irdma_sc_cqp *cqp, struct irdma_apbvt_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_manage_qhash_table_entry - manage quad hash entries * @cqp: struct for cqp hw * @info: info for quad hash to manage * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring * * This is called before connection establishment is started. * For passive connections, when listener is created, it will * call with entry type of IRDMA_QHASH_TYPE_TCP_SYN with local * ip address and tcp port. When SYN is received (passive * connections) or sent (active connections), this routine is * called with entry type of IRDMA_QHASH_TYPE_TCP_ESTABLISHED * and quad is passed in info. * * When iwarp connection is done and its state moves to RTS, the * quad hash entry in the hardware will point to iwarp's qp * number and requires no calls from the driver. */ static int irdma_sc_manage_qhash_table_entry(struct irdma_sc_cqp *cqp, struct irdma_qhash_table_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_qp_init - initialize qp * @qp: sc qp * @info: initialization qp info */ int irdma_sc_qp_init(struct irdma_sc_qp *qp, struct irdma_qp_init_info *info) { … } /** * irdma_sc_qp_create - create qp * @qp: sc qp * @info: qp create info * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ int irdma_sc_qp_create(struct irdma_sc_qp *qp, struct irdma_create_qp_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_qp_modify - modify qp cqp wqe * @qp: sc qp * @info: modify qp info * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ int irdma_sc_qp_modify(struct irdma_sc_qp *qp, struct irdma_modify_qp_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_qp_destroy - cqp destroy qp * @qp: sc qp * @scratch: u64 saved to be used during cqp completion * @remove_hash_idx: flag if to remove hash idx * @ignore_mw_bnd: memory window bind flag * @post_sq: flag for cqp db to ring */ int irdma_sc_qp_destroy(struct irdma_sc_qp *qp, u64 scratch, bool remove_hash_idx, bool ignore_mw_bnd, bool post_sq) { … } /** * irdma_sc_get_encoded_ird_size - * @ird_size: IRD size * The ird from the connection is rounded to a supported HW setting and then encoded * for ird_size field of qp_ctx. Consumers are expected to provide valid ird size based * on hardware attributes. IRD size defaults to a value of 4 in case of invalid input */ static u8 irdma_sc_get_encoded_ird_size(u16 ird_size) { … } /** * irdma_sc_qp_setctx_roce - set qp's context * @qp: sc qp * @qp_ctx: context ptr * @info: ctx info */ void irdma_sc_qp_setctx_roce(struct irdma_sc_qp *qp, __le64 *qp_ctx, struct irdma_qp_host_ctx_info *info) { … } /* irdma_sc_alloc_local_mac_entry - allocate a mac entry * @cqp: struct for cqp hw * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_alloc_local_mac_entry(struct irdma_sc_cqp *cqp, u64 scratch, bool post_sq) { … } /** * irdma_sc_add_local_mac_entry - add mac enry * @cqp: struct for cqp hw * @info:mac addr info * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_add_local_mac_entry(struct irdma_sc_cqp *cqp, struct irdma_local_mac_entry_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_del_local_mac_entry - cqp wqe to dele local mac * @cqp: struct for cqp hw * @scratch: u64 saved to be used during cqp completion * @entry_idx: index of mac entry * @ignore_ref_count: to force mac adde delete * @post_sq: flag for cqp db to ring */ static int irdma_sc_del_local_mac_entry(struct irdma_sc_cqp *cqp, u64 scratch, u16 entry_idx, u8 ignore_ref_count, bool post_sq) { … } /** * irdma_sc_qp_setctx - set qp's context * @qp: sc qp * @qp_ctx: context ptr * @info: ctx info */ void irdma_sc_qp_setctx(struct irdma_sc_qp *qp, __le64 *qp_ctx, struct irdma_qp_host_ctx_info *info) { … } /** * irdma_sc_alloc_stag - mr stag alloc * @dev: sc device struct * @info: stag info * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_alloc_stag(struct irdma_sc_dev *dev, struct irdma_allocate_stag_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_mr_reg_non_shared - non-shared mr registration * @dev: sc device struct * @info: mr info * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_mr_reg_non_shared(struct irdma_sc_dev *dev, struct irdma_reg_ns_stag_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_dealloc_stag - deallocate stag * @dev: sc device struct * @info: dealloc stag info * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_dealloc_stag(struct irdma_sc_dev *dev, struct irdma_dealloc_stag_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_mw_alloc - mw allocate * @dev: sc device struct * @info: memory window allocation information * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_mw_alloc(struct irdma_sc_dev *dev, struct irdma_mw_alloc_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_mr_fast_register - Posts RDMA fast register mr WR to iwarp qp * @qp: sc qp struct * @info: fast mr info * @post_sq: flag for cqp db to ring */ int irdma_sc_mr_fast_register(struct irdma_sc_qp *qp, struct irdma_fast_reg_stag_info *info, bool post_sq) { … } /** * irdma_sc_gen_rts_ae - request AE generated after RTS * @qp: sc qp struct */ static void irdma_sc_gen_rts_ae(struct irdma_sc_qp *qp) { … } /** * irdma_sc_send_lsmm - send last streaming mode message * @qp: sc qp struct * @lsmm_buf: buffer with lsmm message * @size: size of lsmm buffer * @stag: stag of lsmm buffer */ void irdma_sc_send_lsmm(struct irdma_sc_qp *qp, void *lsmm_buf, u32 size, irdma_stag stag) { … } /** * irdma_sc_send_rtt - send last read0 or write0 * @qp: sc qp struct * @read: Do read0 or write0 */ void irdma_sc_send_rtt(struct irdma_sc_qp *qp, bool read) { … } /** * irdma_iwarp_opcode - determine if incoming is rdma layer * @info: aeq info for the packet * @pkt: packet for error */ static u32 irdma_iwarp_opcode(struct irdma_aeqe_info *info, u8 *pkt) { … } /** * irdma_locate_mpa - return pointer to mpa in the pkt * @pkt: packet with data */ static u8 *irdma_locate_mpa(u8 *pkt) { … } /** * irdma_bld_termhdr_ctrl - setup terminate hdr control fields * @qp: sc qp ptr for pkt * @hdr: term hdr * @opcode: flush opcode for termhdr * @layer_etype: error layer + error type * @err: error cod ein the header */ static void irdma_bld_termhdr_ctrl(struct irdma_sc_qp *qp, struct irdma_terminate_hdr *hdr, enum irdma_flush_opcode opcode, u8 layer_etype, u8 err) { … } /** * irdma_bld_termhdr_ddp_rdma - setup ddp and rdma hdrs in terminate hdr * @pkt: ptr to mpa in offending pkt * @hdr: term hdr * @copy_len: offending pkt length to be copied to term hdr * @is_tagged: DDP tagged or untagged */ static void irdma_bld_termhdr_ddp_rdma(u8 *pkt, struct irdma_terminate_hdr *hdr, int *copy_len, u8 *is_tagged) { … } /** * irdma_bld_terminate_hdr - build terminate message header * @qp: qp associated with received terminate AE * @info: the struct contiaing AE information */ static int irdma_bld_terminate_hdr(struct irdma_sc_qp *qp, struct irdma_aeqe_info *info) { … } /** * irdma_terminate_send_fin() - Send fin for terminate message * @qp: qp associated with received terminate AE */ void irdma_terminate_send_fin(struct irdma_sc_qp *qp) { … } /** * irdma_terminate_connection() - Bad AE and send terminate to remote QP * @qp: qp associated with received terminate AE * @info: the struct contiaing AE information */ void irdma_terminate_connection(struct irdma_sc_qp *qp, struct irdma_aeqe_info *info) { … } /** * irdma_terminate_received - handle terminate received AE * @qp: qp associated with received terminate AE * @info: the struct contiaing AE information */ void irdma_terminate_received(struct irdma_sc_qp *qp, struct irdma_aeqe_info *info) { … } static int irdma_null_ws_add(struct irdma_sc_vsi *vsi, u8 user_pri) { … } static void irdma_null_ws_remove(struct irdma_sc_vsi *vsi, u8 user_pri) { … } static void irdma_null_ws_reset(struct irdma_sc_vsi *vsi) { … } /** * irdma_sc_vsi_init - Init the vsi structure * @vsi: pointer to vsi structure to initialize * @info: the info used to initialize the vsi struct */ void irdma_sc_vsi_init(struct irdma_sc_vsi *vsi, struct irdma_vsi_init_info *info) { … } /** * irdma_get_stats_idx - Return stats index * @vsi: pointer to the vsi */ static u8 irdma_get_stats_idx(struct irdma_sc_vsi *vsi) { … } /** * irdma_hw_stats_init_gen1 - Initialize stat reg table used for gen1 * @vsi: vsi structure where hw_regs are set * * Populate the HW stats table */ static void irdma_hw_stats_init_gen1(struct irdma_sc_vsi *vsi) { … } /** * irdma_vsi_stats_init - Initialize the vsi statistics * @vsi: pointer to the vsi structure * @info: The info structure used for initialization */ int irdma_vsi_stats_init(struct irdma_sc_vsi *vsi, struct irdma_vsi_stats_info *info) { … } /** * irdma_vsi_stats_free - Free the vsi stats * @vsi: pointer to the vsi structure */ void irdma_vsi_stats_free(struct irdma_sc_vsi *vsi) { … } /** * irdma_get_encoded_wqe_size - given wq size, returns hardware encoded size * @wqsize: size of the wq (sq, rq) to encoded_size * @queue_type: queue type selected for the calculation algorithm */ u8 irdma_get_encoded_wqe_size(u32 wqsize, enum irdma_queue_type queue_type) { … } /** * irdma_sc_gather_stats - collect the statistics * @cqp: struct for cqp hw * @info: gather stats info structure * @scratch: u64 saved to be used during cqp completion */ static int irdma_sc_gather_stats(struct irdma_sc_cqp *cqp, struct irdma_stats_gather_info *info, u64 scratch) { … } /** * irdma_sc_manage_stats_inst - allocate or free stats instance * @cqp: struct for cqp hw * @info: stats info structure * @alloc: alloc vs. delete flag * @scratch: u64 saved to be used during cqp completion */ static int irdma_sc_manage_stats_inst(struct irdma_sc_cqp *cqp, struct irdma_stats_inst_info *info, bool alloc, u64 scratch) { … } /** * irdma_sc_set_up_map - set the up map table * @cqp: struct for cqp hw * @info: User priority map info * @scratch: u64 saved to be used during cqp completion */ static int irdma_sc_set_up_map(struct irdma_sc_cqp *cqp, struct irdma_up_info *info, u64 scratch) { … } /** * irdma_sc_manage_ws_node - create/modify/destroy WS node * @cqp: struct for cqp hw * @info: node info structure * @node_op: 0 for add 1 for modify, 2 for delete * @scratch: u64 saved to be used during cqp completion */ static int irdma_sc_manage_ws_node(struct irdma_sc_cqp *cqp, struct irdma_ws_node_info *info, enum irdma_ws_node_op node_op, u64 scratch) { … } /** * irdma_sc_qp_flush_wqes - flush qp's wqe * @qp: sc qp * @info: dlush information * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ int irdma_sc_qp_flush_wqes(struct irdma_sc_qp *qp, struct irdma_qp_flush_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_gen_ae - generate AE, uses flush WQE CQP OP * @qp: sc qp * @info: gen ae information * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_gen_ae(struct irdma_sc_qp *qp, struct irdma_gen_ae_info *info, u64 scratch, bool post_sq) { … } /*** irdma_sc_qp_upload_context - upload qp's context * @dev: sc device struct * @info: upload context info ptr for return * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_qp_upload_context(struct irdma_sc_dev *dev, struct irdma_upload_context_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_manage_push_page - Handle push page * @cqp: struct for cqp hw * @info: push page info * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_manage_push_page(struct irdma_sc_cqp *cqp, struct irdma_cqp_manage_push_page_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_suspend_qp - suspend qp for param change * @cqp: struct for cqp hw * @qp: sc qp struct * @scratch: u64 saved to be used during cqp completion */ static int irdma_sc_suspend_qp(struct irdma_sc_cqp *cqp, struct irdma_sc_qp *qp, u64 scratch) { … } /** * irdma_sc_resume_qp - resume qp after suspend * @cqp: struct for cqp hw * @qp: sc qp struct * @scratch: u64 saved to be used during cqp completion */ static int irdma_sc_resume_qp(struct irdma_sc_cqp *cqp, struct irdma_sc_qp *qp, u64 scratch) { … } /** * irdma_sc_cq_ack - acknowledge completion q * @cq: cq struct */ static inline void irdma_sc_cq_ack(struct irdma_sc_cq *cq) { … } /** * irdma_sc_cq_init - initialize completion q * @cq: cq struct * @info: cq initialization info */ int irdma_sc_cq_init(struct irdma_sc_cq *cq, struct irdma_cq_init_info *info) { … } /** * irdma_sc_cq_create - create completion q * @cq: cq struct * @scratch: u64 saved to be used during cqp completion * @check_overflow: flag for overflow check * @post_sq: flag for cqp db to ring */ static int irdma_sc_cq_create(struct irdma_sc_cq *cq, u64 scratch, bool check_overflow, bool post_sq) { … } /** * irdma_sc_cq_destroy - destroy completion q * @cq: cq struct * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ int irdma_sc_cq_destroy(struct irdma_sc_cq *cq, u64 scratch, bool post_sq) { … } /** * irdma_sc_cq_resize - set resized cq buffer info * @cq: resized cq * @info: resized cq buffer info */ void irdma_sc_cq_resize(struct irdma_sc_cq *cq, struct irdma_modify_cq_info *info) { … } /** * irdma_sc_cq_modify - modify a Completion Queue * @cq: cq struct * @info: modification info struct * @scratch: u64 saved to be used during cqp completion * @post_sq: flag to post to sq */ static int irdma_sc_cq_modify(struct irdma_sc_cq *cq, struct irdma_modify_cq_info *info, u64 scratch, bool post_sq) { … } /** * irdma_check_cqp_progress - check cqp processing progress * @timeout: timeout info struct * @dev: sc device struct */ void irdma_check_cqp_progress(struct irdma_cqp_timeout *timeout, struct irdma_sc_dev *dev) { … } /** * irdma_get_cqp_reg_info - get head and tail for cqp using registers * @cqp: struct for cqp hw * @val: cqp tail register value * @tail: wqtail register value * @error: cqp processing err */ static inline void irdma_get_cqp_reg_info(struct irdma_sc_cqp *cqp, u32 *val, u32 *tail, u32 *error) { … } /** * irdma_cqp_poll_registers - poll cqp registers * @cqp: struct for cqp hw * @tail: wqtail register value * @count: how many times to try for completion */ static int irdma_cqp_poll_registers(struct irdma_sc_cqp *cqp, u32 tail, u32 count) { … } /** * irdma_sc_decode_fpm_commit - decode a 64 bit value into count and base * @dev: sc device struct * @buf: pointer to commit buffer * @buf_idx: buffer index * @obj_info: object info pointer * @rsrc_idx: indexs of memory resource */ static u64 irdma_sc_decode_fpm_commit(struct irdma_sc_dev *dev, __le64 *buf, u32 buf_idx, struct irdma_hmc_obj_info *obj_info, u32 rsrc_idx) { … } /** * irdma_sc_parse_fpm_commit_buf - parse fpm commit buffer * @dev: pointer to dev struct * @buf: ptr to fpm commit buffer * @info: ptr to irdma_hmc_obj_info struct * @sd: number of SDs for HMC objects * * parses fpm commit info and copy base value * of hmc objects in hmc_info */ static void irdma_sc_parse_fpm_commit_buf(struct irdma_sc_dev *dev, __le64 *buf, struct irdma_hmc_obj_info *info, u32 *sd) { … } /** * irdma_sc_decode_fpm_query() - Decode a 64 bit value into max count and size * @buf: ptr to fpm query buffer * @buf_idx: index into buf * @obj_info: ptr to irdma_hmc_obj_info struct * @rsrc_idx: resource index into info * * Decode a 64 bit value from fpm query buffer into max count and size */ static u64 irdma_sc_decode_fpm_query(__le64 *buf, u32 buf_idx, struct irdma_hmc_obj_info *obj_info, u32 rsrc_idx) { … } /** * irdma_sc_parse_fpm_query_buf() - parses fpm query buffer * @dev: ptr to shared code device * @buf: ptr to fpm query buffer * @hmc_info: ptr to irdma_hmc_obj_info struct * @hmc_fpm_misc: ptr to fpm data * * parses fpm query buffer and copy max_cnt and * size value of hmc objects in hmc_info */ static int irdma_sc_parse_fpm_query_buf(struct irdma_sc_dev *dev, __le64 *buf, struct irdma_hmc_info *hmc_info, struct irdma_hmc_fpm_misc *hmc_fpm_misc) { … } /** * irdma_sc_find_reg_cq - find cq ctx index * @ceq: ceq sc structure * @cq: cq sc structure */ static u32 irdma_sc_find_reg_cq(struct irdma_sc_ceq *ceq, struct irdma_sc_cq *cq) { … } /** * irdma_sc_add_cq_ctx - add cq ctx tracking for ceq * @ceq: ceq sc structure * @cq: cq sc structure */ int irdma_sc_add_cq_ctx(struct irdma_sc_ceq *ceq, struct irdma_sc_cq *cq) { … } /** * irdma_sc_remove_cq_ctx - remove cq ctx tracking for ceq * @ceq: ceq sc structure * @cq: cq sc structure */ void irdma_sc_remove_cq_ctx(struct irdma_sc_ceq *ceq, struct irdma_sc_cq *cq) { … } /** * irdma_sc_cqp_init - Initialize buffers for a control Queue Pair * @cqp: IWARP control queue pair pointer * @info: IWARP control queue pair init info pointer * * Initializes the object and context buffers for a control Queue Pair. */ int irdma_sc_cqp_init(struct irdma_sc_cqp *cqp, struct irdma_cqp_init_info *info) { … } /** * irdma_sc_cqp_create - create cqp during bringup * @cqp: struct for cqp hw * @maj_err: If error, major err number * @min_err: If error, minor err number */ int irdma_sc_cqp_create(struct irdma_sc_cqp *cqp, u16 *maj_err, u16 *min_err) { … } /** * irdma_sc_cqp_post_sq - post of cqp's sq * @cqp: struct for cqp hw */ void irdma_sc_cqp_post_sq(struct irdma_sc_cqp *cqp) { … } /** * irdma_sc_cqp_get_next_send_wqe_idx - get next wqe on cqp sq * and pass back index * @cqp: CQP HW structure * @scratch: private data for CQP WQE * @wqe_idx: WQE index of CQP SQ */ __le64 *irdma_sc_cqp_get_next_send_wqe_idx(struct irdma_sc_cqp *cqp, u64 scratch, u32 *wqe_idx) { … } /** * irdma_sc_cqp_destroy - destroy cqp during close * @cqp: struct for cqp hw */ int irdma_sc_cqp_destroy(struct irdma_sc_cqp *cqp) { … } /** * irdma_sc_ccq_arm - enable intr for control cq * @ccq: ccq sc struct */ void irdma_sc_ccq_arm(struct irdma_sc_cq *ccq) { … } /** * irdma_sc_ccq_get_cqe_info - get ccq's cq entry * @ccq: ccq sc struct * @info: completion q entry to return */ int irdma_sc_ccq_get_cqe_info(struct irdma_sc_cq *ccq, struct irdma_ccq_cqe_info *info) { … } /** * irdma_sc_poll_for_cqp_op_done - Waits for last write to complete in CQP SQ * @cqp: struct for cqp hw * @op_code: cqp opcode for completion * @compl_info: completion q entry to return */ int irdma_sc_poll_for_cqp_op_done(struct irdma_sc_cqp *cqp, u8 op_code, struct irdma_ccq_cqe_info *compl_info) { … } /** * irdma_sc_manage_hmc_pm_func_table - manage of function table * @cqp: struct for cqp hw * @scratch: u64 saved to be used during cqp completion * @info: info for the manage function table operation * @post_sq: flag for cqp db to ring */ static int irdma_sc_manage_hmc_pm_func_table(struct irdma_sc_cqp *cqp, struct irdma_hmc_fcn_info *info, u64 scratch, bool post_sq) { … } /** * irdma_sc_commit_fpm_val_done - wait for cqp eqe completion * for fpm commit * @cqp: struct for cqp hw */ static int irdma_sc_commit_fpm_val_done(struct irdma_sc_cqp *cqp) { … } /** * irdma_sc_commit_fpm_val - cqp wqe for commit fpm values * @cqp: struct for cqp hw * @scratch: u64 saved to be used during cqp completion * @hmc_fn_id: hmc function id * @commit_fpm_mem: Memory for fpm values * @post_sq: flag for cqp db to ring * @wait_type: poll ccq or cqp registers for cqp completion */ static int irdma_sc_commit_fpm_val(struct irdma_sc_cqp *cqp, u64 scratch, u8 hmc_fn_id, struct irdma_dma_mem *commit_fpm_mem, bool post_sq, u8 wait_type) { … } /** * irdma_sc_query_fpm_val_done - poll for cqp wqe completion for * query fpm * @cqp: struct for cqp hw */ static int irdma_sc_query_fpm_val_done(struct irdma_sc_cqp *cqp) { … } /** * irdma_sc_query_fpm_val - cqp wqe query fpm values * @cqp: struct for cqp hw * @scratch: u64 saved to be used during cqp completion * @hmc_fn_id: hmc function id * @query_fpm_mem: memory for return fpm values * @post_sq: flag for cqp db to ring * @wait_type: poll ccq or cqp registers for cqp completion */ static int irdma_sc_query_fpm_val(struct irdma_sc_cqp *cqp, u64 scratch, u8 hmc_fn_id, struct irdma_dma_mem *query_fpm_mem, bool post_sq, u8 wait_type) { … } /** * irdma_sc_ceq_init - initialize ceq * @ceq: ceq sc structure * @info: ceq initialization info */ int irdma_sc_ceq_init(struct irdma_sc_ceq *ceq, struct irdma_ceq_init_info *info) { … } /** * irdma_sc_ceq_create - create ceq wqe * @ceq: ceq sc structure * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_ceq_create(struct irdma_sc_ceq *ceq, u64 scratch, bool post_sq) { … } /** * irdma_sc_cceq_create_done - poll for control ceq wqe to complete * @ceq: ceq sc structure */ static int irdma_sc_cceq_create_done(struct irdma_sc_ceq *ceq) { … } /** * irdma_sc_cceq_destroy_done - poll for destroy cceq to complete * @ceq: ceq sc structure */ int irdma_sc_cceq_destroy_done(struct irdma_sc_ceq *ceq) { … } /** * irdma_sc_cceq_create - create cceq * @ceq: ceq sc structure * @scratch: u64 saved to be used during cqp completion */ int irdma_sc_cceq_create(struct irdma_sc_ceq *ceq, u64 scratch) { … } /** * irdma_sc_ceq_destroy - destroy ceq * @ceq: ceq sc structure * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ int irdma_sc_ceq_destroy(struct irdma_sc_ceq *ceq, u64 scratch, bool post_sq) { … } /** * irdma_sc_process_ceq - process ceq * @dev: sc device struct * @ceq: ceq sc structure * * It is expected caller serializes this function with cleanup_ceqes() * because these functions manipulate the same ceq */ void *irdma_sc_process_ceq(struct irdma_sc_dev *dev, struct irdma_sc_ceq *ceq) { … } /** * irdma_sc_cleanup_ceqes - clear the valid ceqes ctx matching the cq * @cq: cq for which the ceqes need to be cleaned up * @ceq: ceq ptr * * The function is called after the cq is destroyed to cleanup * its pending ceqe entries. It is expected caller serializes this * function with process_ceq() in interrupt context. */ void irdma_sc_cleanup_ceqes(struct irdma_sc_cq *cq, struct irdma_sc_ceq *ceq) { … } /** * irdma_sc_aeq_init - initialize aeq * @aeq: aeq structure ptr * @info: aeq initialization info */ int irdma_sc_aeq_init(struct irdma_sc_aeq *aeq, struct irdma_aeq_init_info *info) { … } /** * irdma_sc_aeq_create - create aeq * @aeq: aeq structure ptr * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_aeq_create(struct irdma_sc_aeq *aeq, u64 scratch, bool post_sq) { … } /** * irdma_sc_aeq_destroy - destroy aeq during close * @aeq: aeq structure ptr * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ static int irdma_sc_aeq_destroy(struct irdma_sc_aeq *aeq, u64 scratch, bool post_sq) { … } /** * irdma_sc_get_next_aeqe - get next aeq entry * @aeq: aeq structure ptr * @info: aeqe info to be returned */ int irdma_sc_get_next_aeqe(struct irdma_sc_aeq *aeq, struct irdma_aeqe_info *info) { … } /** * irdma_sc_repost_aeq_entries - repost completed aeq entries * @dev: sc device struct * @count: allocate count */ void irdma_sc_repost_aeq_entries(struct irdma_sc_dev *dev, u32 count) { … } /** * irdma_sc_ccq_init - initialize control cq * @cq: sc's cq ctruct * @info: info for control cq initialization */ int irdma_sc_ccq_init(struct irdma_sc_cq *cq, struct irdma_ccq_init_info *info) { … } /** * irdma_sc_ccq_create_done - poll cqp for ccq create * @ccq: ccq sc struct */ static inline int irdma_sc_ccq_create_done(struct irdma_sc_cq *ccq) { … } /** * irdma_sc_ccq_create - create control cq * @ccq: ccq sc struct * @scratch: u64 saved to be used during cqp completion * @check_overflow: overlow flag for ccq * @post_sq: flag for cqp db to ring */ int irdma_sc_ccq_create(struct irdma_sc_cq *ccq, u64 scratch, bool check_overflow, bool post_sq) { … } /** * irdma_sc_ccq_destroy - destroy ccq during close * @ccq: ccq sc struct * @scratch: u64 saved to be used during cqp completion * @post_sq: flag for cqp db to ring */ int irdma_sc_ccq_destroy(struct irdma_sc_cq *ccq, u64 scratch, bool post_sq) { … } /** * irdma_sc_init_iw_hmc() - queries fpm values using cqp and populates hmc_info * @dev : ptr to irdma_dev struct * @hmc_fn_id: hmc function id */ int irdma_sc_init_iw_hmc(struct irdma_sc_dev *dev, u8 hmc_fn_id) { … } /** * irdma_sc_cfg_iw_fpm() - commits hmc obj cnt values using cqp * command and populates fpm base address in hmc_info * @dev : ptr to irdma_dev struct * @hmc_fn_id: hmc function id */ static int irdma_sc_cfg_iw_fpm(struct irdma_sc_dev *dev, u8 hmc_fn_id) { … } /** * cqp_sds_wqe_fill - fill cqp wqe doe sd * @cqp: struct for cqp hw * @info: sd info for wqe * @scratch: u64 saved to be used during cqp completion */ static int cqp_sds_wqe_fill(struct irdma_sc_cqp *cqp, struct irdma_update_sds_info *info, u64 scratch) { … } /** * irdma_update_pe_sds - cqp wqe for sd * @dev: ptr to irdma_dev struct * @info: sd info for sd's * @scratch: u64 saved to be used during cqp completion */ static int irdma_update_pe_sds(struct irdma_sc_dev *dev, struct irdma_update_sds_info *info, u64 scratch) { … } /** * irdma_update_sds_noccq - update sd before ccq created * @dev: sc device struct * @info: sd info for sd's */ int irdma_update_sds_noccq(struct irdma_sc_dev *dev, struct irdma_update_sds_info *info) { … } /** * irdma_sc_static_hmc_pages_allocated - cqp wqe to allocate hmc pages * @cqp: struct for cqp hw * @scratch: u64 saved to be used during cqp completion * @hmc_fn_id: hmc function id * @post_sq: flag for cqp db to ring * @poll_registers: flag to poll register for cqp completion */ int irdma_sc_static_hmc_pages_allocated(struct irdma_sc_cqp *cqp, u64 scratch, u8 hmc_fn_id, bool post_sq, bool poll_registers) { … } /** * irdma_cqp_ring_full - check if cqp ring is full * @cqp: struct for cqp hw */ static bool irdma_cqp_ring_full(struct irdma_sc_cqp *cqp) { … } /** * irdma_est_sd - returns approximate number of SDs for HMC * @dev: sc device struct * @hmc_info: hmc structure, size and count for HMC objects */ static u32 irdma_est_sd(struct irdma_sc_dev *dev, struct irdma_hmc_info *hmc_info) { … } /** * irdma_sc_query_rdma_features_done - poll cqp for query features done * @cqp: struct for cqp hw */ static int irdma_sc_query_rdma_features_done(struct irdma_sc_cqp *cqp) { … } /** * irdma_sc_query_rdma_features - query RDMA features and FW ver * @cqp: struct for cqp hw * @buf: buffer to hold query info * @scratch: u64 saved to be used during cqp completion */ static int irdma_sc_query_rdma_features(struct irdma_sc_cqp *cqp, struct irdma_dma_mem *buf, u64 scratch) { … } /** * irdma_get_rdma_features - get RDMA features * @dev: sc device struct */ int irdma_get_rdma_features(struct irdma_sc_dev *dev) { … } static u32 irdma_q1_cnt(struct irdma_sc_dev *dev, struct irdma_hmc_info *hmc_info, u32 qpwanted) { … } static void cfg_fpm_value_gen_1(struct irdma_sc_dev *dev, struct irdma_hmc_info *hmc_info, u32 qpwanted) { … } static void cfg_fpm_value_gen_2(struct irdma_sc_dev *dev, struct irdma_hmc_info *hmc_info, u32 qpwanted) { … } /** * irdma_cfg_fpm_val - configure HMC objects * @dev: sc device struct * @qp_count: desired qp count */ int irdma_cfg_fpm_val(struct irdma_sc_dev *dev, u32 qp_count) { … } /** * irdma_exec_cqp_cmd - execute cqp cmd when wqe are available * @dev: rdma device * @pcmdinfo: cqp command info */ static int irdma_exec_cqp_cmd(struct irdma_sc_dev *dev, struct cqp_cmds_info *pcmdinfo) { … } /** * irdma_process_cqp_cmd - process all cqp commands * @dev: sc device struct * @pcmdinfo: cqp command info */ int irdma_process_cqp_cmd(struct irdma_sc_dev *dev, struct cqp_cmds_info *pcmdinfo) { … } /** * irdma_process_bh - called from tasklet for cqp list * @dev: sc device struct */ int irdma_process_bh(struct irdma_sc_dev *dev) { … } /** * irdma_cfg_aeq- Configure AEQ interrupt * @dev: pointer to the device structure * @idx: vector index * @enable: True to enable, False disables */ void irdma_cfg_aeq(struct irdma_sc_dev *dev, u32 idx, bool enable) { … } /** * sc_vsi_update_stats - Update statistics * @vsi: sc_vsi instance to update */ void sc_vsi_update_stats(struct irdma_sc_vsi *vsi) { … } /** * irdma_wait_pe_ready - Check if firmware is ready * @dev: provides access to registers */ static int irdma_wait_pe_ready(struct irdma_sc_dev *dev) { … } static inline void irdma_sc_init_hw(struct irdma_sc_dev *dev) { … } /** * irdma_sc_dev_init - Initialize control part of device * @ver: version * @dev: Device pointer * @info: Device init info */ int irdma_sc_dev_init(enum irdma_vers ver, struct irdma_sc_dev *dev, struct irdma_device_init_info *info) { … } /** * irdma_stat_val - Extract HW counter value from statistics buffer * @stats_val: pointer to statistics buffer * @byteoff: byte offset of counter value in the buffer (8B-aligned) * @bitoff: bit offset of counter value within 8B entry * @bitmask: maximum counter value (e.g. 0xffffff for 24-bit counter) */ static inline u64 irdma_stat_val(const u64 *stats_val, u16 byteoff, u8 bitoff, u64 bitmask) { … } /** * irdma_stat_delta - Calculate counter delta * @new_val: updated counter value * @old_val: last counter value * @max_val: maximum counter value (e.g. 0xffffff for 24-bit counter) */ static inline u64 irdma_stat_delta(u64 new_val, u64 old_val, u64 max_val) { … } /** * irdma_update_stats - Update statistics * @hw_stats: hw_stats instance to update * @gather_stats: updated stat counters * @last_gather_stats: last stat counters * @map: HW stat map (hw_stats => gather_stats) * @max_stat_idx: number of HW stats */ void irdma_update_stats(struct irdma_dev_hw_stats *hw_stats, struct irdma_gather_stats *gather_stats, struct irdma_gather_stats *last_gather_stats, const struct irdma_hw_stat_map *map, u16 max_stat_idx) { … }