From 8f0779bc3eda2e9f787df1f607723c0fd148adea Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 28 Jun 2025 14:53:32 +0200 Subject: [PATCH] Updates for Kernel 6.8 compatiblity --- hifc/hifc_chipitf.c | 4 +++ hifc/hifc_cmdq.c | 4 +-- hifc/hifc_cmdq.h | 2 +- hifc/hifc_cqm_object.c | 64 ++++++++++++++++----------------- hifc/hifc_dbgtool_knl.c | 2 +- hifc/hifc_hba.c | 8 +++++ hifc/hifc_io.c | 26 ++++++++++++++ hifc/hifc_lld.c | 17 +++++---- hifc/hifc_module.c | 2 ++ hifc/hifc_portmng.c | 2 ++ hifc/hifc_queue.c | 80 ++++++++++++++++++++++++++++++++--------- hifc/hifc_service.c | 12 +++++++ hifc/hifc_tool.c | 2 +- hifc/hifc_tool_hw.c | 6 ++-- hifc/unf_event.c | 8 +++++ hifc/unf_init.c | 10 ++++-- hifc/unf_io.c | 1 + hifc/unf_io_abnormal.c | 7 ++++ hifc/unf_lport.c | 7 ++++ hifc/unf_portman.c | 1 - hifc/unf_rport.c | 2 ++ hifc/unf_scsi.c | 41 ++++++++++++++------- hifc/unf_service.c | 18 +++++----- 23 files changed, 237 insertions(+), 89 deletions(-) diff --git a/hifc/hifc_chipitf.c b/hifc/hifc_chipitf.c index 74e3df2..24a07ee 100644 --- a/hifc/hifc_chipitf.c +++ b/hifc/hifc_chipitf.c @@ -15,6 +15,10 @@ #define HIFC_MBX_MAX_TIMEOUT 10000 +void hifc_get_red_info_by_rw_type(struct unf_rw_reg_param_s *param, + struct hifc_inmbox_get_reg_info_s *v_reg_info); +void hifc_initial_dynamic_info(struct hifc_hba_s *v_fc_port); + static unsigned int hifc_recv_fc_link_up(struct hifc_hba_s *v_hba, void *v_buf_in); static unsigned int hifc_recv_fc_link_down(struct hifc_hba_s *v_hba, diff --git a/hifc/hifc_cmdq.c b/hifc/hifc_cmdq.c index 0353101..99150c1 100644 --- a/hifc/hifc_cmdq.c +++ b/hifc/hifc_cmdq.c @@ -240,7 +240,7 @@ struct hifc_cmd_buf *hifc_alloc_cmd_buf(void *hwdev) if (!cmd_buf) return NULL; - cmd_buf->buf = pci_pool_alloc(cmdqs->cmd_buf_pool, GFP_ATOMIC, + cmd_buf->buf = dma_pool_alloc(cmdqs->cmd_buf_pool, GFP_ATOMIC, &cmd_buf->dma_addr); if (!cmd_buf->buf) { sdk_err(dev, "Failed to allocate cmdq cmd buf from the pool\n"); @@ -265,7 +265,7 @@ void hifc_free_cmd_buf(void *hwdev, struct hifc_cmd_buf *cmd_buf) cmdqs = ((struct hifc_hwdev *)hwdev)->cmdqs; - pci_pool_free(cmdqs->cmd_buf_pool, cmd_buf->buf, cmd_buf->dma_addr); + dma_pool_free(cmdqs->cmd_buf_pool, cmd_buf->buf, cmd_buf->dma_addr); kfree(cmd_buf); } diff --git a/hifc/hifc_cmdq.h b/hifc/hifc_cmdq.h index cb2ac81..bf22118 100644 --- a/hifc/hifc_cmdq.h +++ b/hifc/hifc_cmdq.h @@ -183,7 +183,7 @@ struct hifc_cmdq { struct hifc_cmdqs { struct hifc_hwdev *hwdev; - struct pci_pool *cmd_buf_pool; + struct dma_pool *cmd_buf_pool; struct hifc_wq *saved_wqs; diff --git a/hifc/hifc_cqm_object.c b/hifc/hifc_cqm_object.c index 406b13f..aa38d9e 100644 --- a/hifc/hifc_cqm_object.c +++ b/hifc/hifc_cqm_object.c @@ -209,9 +209,9 @@ s32 cqm_buf_alloc_map(struct cqm_handle_s *cqm_handle, struct cqm_buf_s *buf) for (i = 0; i < (s32)buf->buf_number; i++) { va = buf->buf_list[i].va; buf->buf_list[i].pa = - pci_map_single(dev, va, buf->buf_size, - PCI_DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(dev, buf->buf_list[i].pa)) { + dma_map_single(&dev->dev, va, buf->buf_size, + DMA_BIDIRECTIONAL); + if (dma_mapping_error(&dev->dev, buf->buf_list[i].pa)) { cqm_err(handle->dev_hdl, CQM_MAP_FAIL(buf_list)); break; } @@ -220,8 +220,8 @@ s32 cqm_buf_alloc_map(struct cqm_handle_s *cqm_handle, struct cqm_buf_s *buf) if (i != buf->buf_number) { i--; for (; i >= 0; i--) { - pci_unmap_single(dev, buf->buf_list[i].pa, - buf->buf_size, PCI_DMA_BIDIRECTIONAL); + dma_unmap_single(&dev->dev, buf->buf_list[i].pa, + buf->buf_size, DMA_BIDIRECTIONAL); } return CQM_FAIL; } @@ -328,8 +328,8 @@ s32 cqm_buf_alloc(struct cqm_handle_s *cqm_handle, err3: for (i = 0; i < (s32)buf->buf_number; i++) { - pci_unmap_single(dev, buf->buf_list[i].pa, buf->buf_size, - PCI_DMA_BIDIRECTIONAL); + dma_unmap_single(&dev->dev, buf->buf_list[i].pa, buf->buf_size, + DMA_BIDIRECTIONAL); } err2: for (i = 0; i < (s32)buf->buf_number; i++) { @@ -407,9 +407,9 @@ void cqm_buf_free(struct cqm_buf_s *buf, struct pci_dev *dev) if (buf->buf_list) { for (i = 0; i < (s32)(buf->buf_number); i++) { if (buf->buf_list[i].va) { - pci_unmap_single(dev, buf->buf_list[i].pa, + dma_unmap_single(&dev->dev, buf->buf_list[i].pa, buf->buf_size, - PCI_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); free_pages((ulong)(buf->buf_list[i].va), order); buf->buf_list[i].va = NULL; } @@ -444,8 +444,8 @@ static void __free_cache_inv(struct cqm_handle_s *cqm_handle, } } - pci_unmap_single(cqm_handle->dev, buf->buf_list[buf_idx].pa, - buf->buf_size, PCI_DMA_BIDIRECTIONAL); + dma_unmap_single(&cqm_handle->dev->dev, buf->buf_list[buf_idx].pa, + buf->buf_size, DMA_BIDIRECTIONAL); free_pages((unsigned long)(buf->buf_list[buf_idx].va), order); @@ -1615,10 +1615,10 @@ s32 cqm_cla_alloc(struct cqm_handle_s *cqm_handle, /* pci mapping */ buf_node_child->pa = - pci_map_single(cqm_handle->dev, buf_node_child->va, + dma_map_single(&cqm_handle->dev->dev, buf_node_child->va, PAGE_SIZE << cla_table->trunk_order, - PCI_DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(cqm_handle->dev, buf_node_child->pa)) { + DMA_BIDIRECTIONAL); + if (dma_mapping_error(&cqm_handle->dev->dev, buf_node_child->pa)) { cqm_err(handle->dev_hdl, CQM_MAP_FAIL(buf_node_child->pa)); goto err1; } @@ -1637,9 +1637,9 @@ s32 cqm_cla_alloc(struct cqm_handle_s *cqm_handle, return CQM_SUCCESS; err2: - pci_unmap_single(cqm_handle->dev, buf_node_child->pa, + dma_unmap_single(&cqm_handle->dev->dev, buf_node_child->pa, PAGE_SIZE << cla_table->trunk_order, - PCI_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); err1: free_pages((ulong)(buf_node_child->va), cla_table->trunk_order); buf_node_child->va = NULL; @@ -1674,9 +1674,9 @@ void cqm_cla_free(struct cqm_handle_s *cqm_handle, } /* Unblock the pci mapping of the trunk page */ - pci_unmap_single(cqm_handle->dev, buf_node_child->pa, + dma_unmap_single(&cqm_handle->dev->dev, buf_node_child->pa, PAGE_SIZE << cla_table->trunk_order, - PCI_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); /* Free trunk page */ free_pages((ulong)(buf_node_child->va), cla_table->trunk_order); @@ -2578,8 +2578,8 @@ void cqm_srq_used_rq_delete(struct cqm_object_s *object) cqm_err(handle->dev_hdl, "Rq del: buffer physical addr is null\n"); return; } - pci_unmap_single(cqm_handle->dev, addr, qinfo->container_size, - PCI_DMA_BIDIRECTIONAL); + dma_unmap_single(&cqm_handle->dev->dev, addr, qinfo->container_size, + DMA_BIDIRECTIONAL); /* Get current container va from link wqe, and free it */ addr = CQM_ADDR_COMBINE(srq_link_wqe->current_buffer_addr_h, @@ -2937,9 +2937,9 @@ static s32 cqm_nonrdma_queue_ctx_create_srq(struct cqm_object_s *object) } common->q_ctx_paddr = - pci_map_single(cqm_handle->dev, common->q_ctx_vaddr, - qinfo->q_ctx_size, PCI_DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(cqm_handle->dev, common->q_ctx_paddr)) { + dma_map_single(&cqm_handle->dev->dev, common->q_ctx_vaddr, + qinfo->q_ctx_size, DMA_BIDIRECTIONAL); + if (dma_mapping_error(&cqm_handle->dev->dev, common->q_ctx_paddr)) { cqm_err(handle->dev_hdl, CQM_MAP_FAIL(q_ctx_vaddr)); cqm_kfree_align(common->q_ctx_vaddr); common->q_ctx_vaddr = NULL; @@ -3106,11 +3106,11 @@ s32 cqm_nonrdma_queue_create(struct cqm_object_s *object) } common->q_header_paddr = - pci_map_single(cqm_handle->dev, + dma_map_single(&cqm_handle->dev->dev, qinfo->common.q_header_vaddr, sizeof(struct cqm_queue_header_s), - PCI_DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(cqm_handle->dev, common->q_header_paddr)) { + DMA_BIDIRECTIONAL); + if (dma_mapping_error(&cqm_handle->dev->dev, common->q_header_paddr)) { cqm_err(handle->dev_hdl, CQM_MAP_FAIL(q_header_vaddr)); goto err2; } @@ -3125,9 +3125,9 @@ s32 cqm_nonrdma_queue_create(struct cqm_object_s *object) return CQM_SUCCESS; err3: - pci_unmap_single(cqm_handle->dev, common->q_header_paddr, + dma_unmap_single(&cqm_handle->dev->dev, common->q_header_paddr, sizeof(struct cqm_queue_header_s), - PCI_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); err2: cqm_kfree_align(qinfo->common.q_header_vaddr); qinfo->common.q_header_vaddr = NULL; @@ -3163,9 +3163,9 @@ static void cqm_nonrdma_queue_free_scq_srq(struct cqm_object_s *object, if (object->object_type == CQM_OBJECT_NONRDMA_SRQ) { /* ctx of nonrdma's SRQ is applied independently */ if (common->q_ctx_vaddr) { - pci_unmap_single(cqm_handle->dev, common->q_ctx_paddr, + dma_unmap_single(&cqm_handle->dev->dev, common->q_ctx_paddr, qinfo->q_ctx_size, - PCI_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); cqm_kfree_align(common->q_ctx_vaddr); common->q_ctx_vaddr = NULL; @@ -3228,9 +3228,9 @@ void cqm_nonrdma_queue_delete(struct cqm_object_s *object) /* Free it if exists q header */ if (qinfo->common.q_header_vaddr) { - pci_unmap_single(cqm_handle->dev, common->q_header_paddr, + dma_unmap_single(&cqm_handle->dev->dev, common->q_header_paddr, sizeof(struct cqm_queue_header_s), - PCI_DMA_BIDIRECTIONAL); + DMA_BIDIRECTIONAL); cqm_kfree_align(qinfo->common.q_header_vaddr); qinfo->common.q_header_vaddr = NULL; diff --git a/hifc/hifc_dbgtool_knl.c b/hifc/hifc_dbgtool_knl.c index d91e218..3ce527d 100644 --- a/hifc/hifc_dbgtool_knl.c +++ b/hifc/hifc_dbgtool_knl.c @@ -756,7 +756,7 @@ static int dbgtool_create_cdev(void) } /*lint -save -e160*/ - dbgtool_d_class = class_create(THIS_MODULE, CLASS_DBGTOOL); + dbgtool_d_class = class_create(CLASS_DBGTOOL); /*lint -restore*/ if (IS_ERR(dbgtool_d_class)) { pr_err("Create dgbtool class fail\n"); diff --git a/hifc/hifc_hba.c b/hifc/hifc_hba.c index bab7359..e10b130 100644 --- a/hifc/hifc_hba.c +++ b/hifc/hifc_hba.c @@ -13,6 +13,14 @@ #include "hifc_mgmt.h" #include "hifc_hba.h" +void hifc_flush_root_ctx(struct hifc_hba_s *v_hba); +void hifc_flush_srq_ctx(struct hifc_hba_s *v_hba); +void hifc_release_probe_index(unsigned int probe_index); +unsigned int hifc_assign_probe_index(unsigned int *v_probe_index); +int hifc_probe(struct hifc_lld_dev *lld_dev, void **uld_dev, char *uld_dev_name); +void hifc_remove(struct hifc_lld_dev *lld_dev, void *uld_dev); +void hifc_event(struct hifc_lld_dev *lld_dev, void *uld_dev, + struct hifc_event_info *event); struct hifc_hba_s *hifc_hba[HIFC_HBA_PORT_MAX_NUM]; unsigned long probe_bit_map[HIFC_MAX_PROBE_PORT_NUM / HIFC_PORT_NUM_PER_TABLE]; static unsigned long card_num_bit_map[HIFC_MAX_PROBE_PORT_NUM / diff --git a/hifc/hifc_io.c b/hifc/hifc_io.c index cd1c47f..29a01fe 100644 --- a/hifc/hifc_io.c +++ b/hifc/hifc_io.c @@ -23,6 +23,32 @@ ((unsigned int)(control) << 8) |\ (unsigned int)(scsi_status)) +void hifc_dif_action_forward(struct hifcoe_fc_dif_info_s *v_dif_info_l1, + struct unf_dif_control_info_s *v_dif_ctrl_u1); +void hifc_dif_action_delete(struct hifcoe_fc_dif_info_s *v_dif_info_l1, + struct unf_dif_control_info_s *v_dif_ctrl_u1); +void hifc_get_dif_info_l1(struct hifcoe_fc_dif_info_s *v_dif_info_l1, + struct unf_dif_control_info_s *v_dif_ctrl_u1); +unsigned int hifc_build_sql_by_local_sge_num(struct unf_frame_pkg_s *v_pkg, + struct hifc_hba_s *v_hba, + struct hifcoe_sqe_s *v_sqe, + int v_direct, + unsigned int bd_sge_num); +unsigned int hifc_conf_dual_sgl_info(struct unf_frame_pkg_s *v_pkg, + struct hifc_hba_s *v_hba, + struct hifcoe_sqe_s *v_sqe, + int v_direct, + unsigned int bd_sge_num, + int double_sgl); +void hifc_get_dma_direction_by_fcp_cmnd(const struct unf_fcp_cmnd_s *v_fcp_cmnd, + int *v_pi_dma_direction, + unsigned char *v_task_type); +void hifc_check_fcp_rsp_iu(struct hifcoe_scqe_iresp_s *v_iresp, + struct unf_frame_pkg_s *v_pkg); +unsigned short hifc_get_com_err_code(struct unf_frame_pkg_s *v_pkg); +void hifc_process_ini_fail_io(struct hifc_hba_s *v_hba, + struct hifcoe_scqe_iresp_s *v_iresp, + struct unf_frame_pkg_s *v_pkg); unsigned int dif_protect_op_code = INVALID_VALUE32; unsigned int dif_app_esc_check = HIFC_DIF_APP_REF_ESC_CHECK; unsigned int dif_ref_esc_check = HIFC_DIF_APP_REF_ESC_CHECK; diff --git a/hifc/hifc_lld.c b/hifc/hifc_lld.c index 0b119ca..5385ec7 100644 --- a/hifc/hifc_lld.c +++ b/hifc/hifc_lld.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -70,6 +71,10 @@ static struct hifc_lld_lock g_lld_lock; #define WAIT_LLD_DEV_NODE_CHANGED (10 * 60 * 1000) /* 10minutes */ #define WAIT_LLD_DEV_REF_CNT_EMPTY (2 * 60 * 1000) /* 2minutes */ +void hifc_event_process(void *adapter, struct hifc_event_info *event); +void *hifc_get_ppf_hwdev_by_pdev(struct pci_dev *pdev); + + /* node in chip_node will changed, tools or driver can't get node * during this situation */ @@ -539,21 +544,21 @@ static int config_pci_dma_mask(struct pci_dev *pdev) { int err; - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); + err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); if (err) { sdk_warn(&pdev->dev, "Couldn't set 64-bit DMA mask\n"); - err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); + err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err) { sdk_err(&pdev->dev, "Failed to set DMA mask\n"); return err; } } - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); + err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); if (err) { sdk_warn(&pdev->dev, "Couldn't set 64-bit coherent DMA mask\n"); - err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); + err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err) { sdk_err(&pdev->dev, "Failed to set coherent DMA mask\n"); @@ -592,7 +597,7 @@ static int hifc_pci_init(struct pci_dev *pdev) goto pci_regions_err; } - pci_enable_pcie_error_reporting(pdev); + // pci_enable_pcie_error_reporting(pdev); pci_set_master(pdev); @@ -622,7 +627,7 @@ static void hifc_pci_deinit(struct pci_dev *pdev) pci_clear_master(pdev); pci_release_regions(pdev); - pci_disable_pcie_error_reporting(pdev); + // pci_disable_pcie_error_reporting(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); kfree(pci_adapter); diff --git a/hifc/hifc_module.c b/hifc/hifc_module.c index 201d274..6a4bb1b 100644 --- a/hifc/hifc_module.c +++ b/hifc/hifc_module.c @@ -6,6 +6,8 @@ #include "hifc_module.h" +int hifc_init_module(void); +void hifc_exit_module(void); struct unf_cm_handle_op_s hifc_cm_handle; unsigned int dif_sgl_mode; unsigned int max_speed = HIFC_SPEED_32G; diff --git a/hifc/hifc_portmng.c b/hifc/hifc_portmng.c index 5b20ee4..aad0e2f 100644 --- a/hifc/hifc_portmng.c +++ b/hifc/hifc_portmng.c @@ -9,6 +9,8 @@ #include "hifc_chipitf.h" #include "hifc_portmng.h" +int hifc_dfx_get_rxtx_error_state(void *v_hba, void *v_buff_out); +unsigned int hifc_port_info(struct unf_hinicam_pkg *v_input); struct hifc_port_diag_op_s hifc_diag_op[] = { { UNF_PORT_DIAG_PORT_DETAIL, hifc_show_fc_port_detail }, { UNF_PORT_DIAG_RD_WR_REG, hifc_rw_reg }, diff --git a/hifc/hifc_queue.c b/hifc/hifc_queue.c index 1ba7ba9..ed0df9f 100644 --- a/hifc/hifc_queue.c +++ b/hifc/hifc_queue.c @@ -4,6 +4,7 @@ * */ +#include #include "unf_log.h" #include "unf_common.h" #include "hifc_queue.h" @@ -35,6 +36,51 @@ (((addr) + (HIFC_SQ_HEADER_ADDR_ALIGN_SIZE_MASK)) &\ ~(HIFC_SQ_HEADER_ADDR_ALIGN_SIZE_MASK)) +void hifc_init_parent_ctx(void *v_hba, + struct hifc_parent_queue_info_s *v_parent_qinfo); +static void hifc_init_parent_ctx_sqc_qinfo( + void *v_hba, + struct hifc_parent_queue_info_s *v_parent_qinfo); +struct hifc_parent_queue_info_s *hifc_find_parent_queue_info_by_id( + struct hifc_hba_s *v_hba, + unsigned int v_local_id, + unsigned int v_remote_id); +irqreturn_t hifc_root_sq_irq(int v_irq, void *v_sq_info); +void hifc_update_root_rq_info(struct hifc_root_rq_info_s *v_rq_info, + unsigned short v_rcv_buf_num); +void hifc_root_rqe_analysis( + struct hifc_hba_s *v_hba, + struct hifc_root_rq_info_s *v_rq_info, + struct hifc_root_rq_complet_info_s *v_completion_info, + unsigned short v_rcv_buf_num); +void hifc_set_scq_irq_cfg(struct hifc_hba_s *hba, unsigned int mode, + unsigned short msix_index); +irqreturn_t hifc_scq_irq(int v_irq, void *v_scq_info); +void hifc_invalid_parent_sq(struct hifc_parent_sq_info_s *sq_info); +unsigned int hifc_alloc_parent_sq( + struct hifc_hba_s *v_hba, + struct hifc_parent_queue_info_s *v_parentq_info, + struct unf_rport_info_s *v_rport_info); +static void hifc_init_parent_ctx_sqc_qinfo( + void *v_hba, + struct hifc_parent_queue_info_s *v_parent_qinfo); +void hifc_map_shared_queue_qid( + struct hifc_hba_s *v_hba, + struct hifc_parent_queue_info_s *v_parent_queue_info, + unsigned int rport_index); +static void hifc_free_parent_sq(struct hifc_hba_s *v_hba, + struct hifc_parent_queue_info_s *v_parentq_info); +unsigned int hifc_check_all_parent_queue_free(struct hifc_hba_s *v_hba); +void hifc_wait_root_sq_empty(void *v_hba); +void hifc_wait_all_queues_empty(struct hifc_hba_s *v_hba); +unsigned int hifc_wait_queue_set_flush_done(struct hifc_hba_s *v_hba); +void hifc_disable_queues_dispatch(struct hifc_hba_s *v_hba); +void hifc_clear_els_srq(struct hifc_hba_s *v_hba); +unsigned int hifc_wait_all_parent_queue_free(struct hifc_hba_s *v_hba); +void hifc_pop_delay_sqe(struct hifc_hba_s *v_hba, + struct hifc_delay_sqe_ctrl_info_s *v_sqe_info); +irqreturn_t hifc_root_rq_irq(int v_irq, void *v_rq_info); + static unsigned int hifc_get_parity_value(unsigned long long *v_src_data, unsigned int v_row, unsigned int v_column) @@ -3171,8 +3217,8 @@ static void hifc_free_els_srq_buff(struct hifc_hba_s *v_hba, for (buff_index = 0; buff_index < srq_info->buff_list.buf_num; buff_index++) { if (srq_info->buff_list.buflist[buff_index].paddr) { - pci_unmap_single( - v_hba->pci_dev, + dma_unmap_single( + &v_hba->pci_dev->dev, srq_info->buff_list.buflist[buff_index].paddr, srq_info->buff_list.buf_size, DMA_FROM_DEVICE); @@ -3256,12 +3302,12 @@ static unsigned int hifc_alloc_els_srq_buff(struct hifc_hba_s *v_hba, srq_info->buff_list.buf_size); srq_info->buff_list.buflist[alloc_idx].paddr = - pci_map_single( - v_hba->pci_dev, + dma_map_single( + &v_hba->pci_dev->dev, srq_info->buff_list.buflist[alloc_idx].vaddr, srq_info->buff_list.buf_size, DMA_FROM_DEVICE); - if (pci_dma_mapping_error( - v_hba->pci_dev, + if (dma_mapping_error( + &v_hba->pci_dev->dev, srq_info->buff_list.buflist[alloc_idx].paddr)) { srq_info->buff_list.buflist[alloc_idx].paddr = 0; HIFC_TRACE(UNF_EVTLOG_DRIVER_WARN, UNF_LOG_REG_ATT, @@ -3730,7 +3776,7 @@ static void hifc_free_parent_sq(struct hifc_hba_s *v_hba, hifc_free_link_list_wpg(sq_info); if (sq_info->queue_header_original) { - pci_unmap_single(v_hba->pci_dev, + dma_unmap_single(&v_hba->pci_dev->dev, sq_info->queue_hdr_phy_addr_original, sizeof(struct hifc_queue_header_s) + HIFC_SQ_HEADER_ADDR_ALIGN_SIZE, @@ -4113,13 +4159,13 @@ unsigned int hifc_alloc_parent_sq( memset((unsigned char *)sq_ctrl->queue_header_original, 0, queue_header_alloc_size); - sq_ctrl->queue_hdr_phy_addr_original = pci_map_single( - v_hba->pci_dev, + sq_ctrl->queue_hdr_phy_addr_original = dma_map_single( + &v_hba->pci_dev->dev, sq_ctrl->queue_header_original, queue_header_alloc_size, DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(v_hba->pci_dev, + if (dma_mapping_error(&v_hba->pci_dev->dev, sq_ctrl->queue_hdr_phy_addr_original)) { HIFC_TRACE(UNF_EVTLOG_DRIVER_ERR, UNF_LOG_REG_ATT, UNF_ERR, "[err]RPort(0x%x) SQ queue header DMA mapping failed", @@ -4151,7 +4197,7 @@ unsigned int hifc_alloc_parent_sq( return RETURN_OK; headwpg_create_fail: - pci_unmap_single(v_hba->pci_dev, sq_ctrl->queue_hdr_phy_addr_original, + dma_unmap_single(&v_hba->pci_dev->dev, sq_ctrl->queue_hdr_phy_addr_original, queue_header_alloc_size, DMA_BIDIRECTIONAL); qheader_dma_map_fail: @@ -4859,8 +4905,8 @@ void hifc_free_parent_queue_mgr(void *v_hba) index < parent_queue_mgr->parent_sq_buf_list.buf_num; index++) { if (parent_queue_mgr->parent_sq_buf_list.buflist[index].paddr != 0) { - pci_unmap_single( - hba->pci_dev, + dma_unmap_single( + &hba->pci_dev->dev, parent_queue_mgr->parent_sq_buf_list.buflist[index].paddr, parent_queue_mgr->parent_sq_buf_list.buf_size, DMA_BIDIRECTIONAL); @@ -4993,13 +5039,13 @@ unsigned int hifc_alloc_parent_queue_mgr(void *v_hba) 0, parent_queue_mgr->parent_sq_buf_list.buf_size); parent_queue_mgr->parent_sq_buf_list.buflist[alloc_idx].paddr = - pci_map_single( - hba->pci_dev, + dma_map_single( + &hba->pci_dev->dev, parent_queue_mgr->parent_sq_buf_list.buflist[alloc_idx].vaddr, parent_queue_mgr->parent_sq_buf_list.buf_size, DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error( - hba->pci_dev, + if (dma_mapping_error( + &hba->pci_dev->dev, parent_queue_mgr->parent_sq_buf_list.buflist[alloc_idx].paddr)) { parent_queue_mgr->parent_sq_buf_list.buflist[alloc_idx].paddr = 0; HIFC_TRACE(UNF_EVTLOG_DRIVER_WARN, UNF_LOG_REG_ATT, diff --git a/hifc/hifc_service.c b/hifc/hifc_service.c index 52c9ad7..b5a48db 100644 --- a/hifc/hifc_service.c +++ b/hifc/hifc_service.c @@ -14,6 +14,18 @@ #define HIFC_RQ_ERROR_FRAME 0x100 #define HIFC_ELS_SRQ_BUF_NUM 0x9 +unsigned int hifc_rcv_tmf_marker_sts(const struct hifc_hba_s *v_hba, + struct unf_frame_pkg_s *v_pkg, + unsigned int ox_id); +unsigned int hifc_rcv_abts_marker_sts(const struct hifc_hba_s *v_hba, + struct unf_frame_pkg_s *v_pkg, + unsigned int ox_id); +void hifc_scqe_error_pre_process(struct hifc_hba_s *v_hba, + union hifcoe_scqe_u *v_scqe); +unsigned int hifc_get_gs_req_and_rsp_pld_len(unsigned short cmd_code, + unsigned int *v_gs_pld_len, + unsigned int *v_gs_rsp_pld_len); + /* Parent SCQ Receive the ELS processing function */ static unsigned int hifc_scq_rcv_els_cmd(struct hifc_hba_s *v_hba, union hifcoe_scqe_u *v_scqe); diff --git a/hifc/hifc_tool.c b/hifc/hifc_tool.c index 7d6eb6e..fb9c98c 100644 --- a/hifc/hifc_tool.c +++ b/hifc/hifc_tool.c @@ -713,7 +713,7 @@ int hifc_tool_k_init(void) /* Create equipment */ /*lint -save -e160*/ - g_nictool_class = class_create(THIS_MODULE, HIADM_DEV_CLASS); + g_nictool_class = class_create(HIADM_DEV_CLASS); /*lint -restore*/ if (IS_ERR(g_nictool_class)) { pr_err("Create nictool_class fail\n"); diff --git a/hifc/hifc_tool_hw.c b/hifc/hifc_tool_hw.c index f4224f6..16d46a0 100644 --- a/hifc/hifc_tool_hw.c +++ b/hifc/hifc_tool_hw.c @@ -783,7 +783,7 @@ void hifc_get_fc_devname(char *devname) continue; if (dev->uld_dev) { - strlcpy(devname, (char *)dev->uld_dev_name, + strscpy(devname, (char *)dev->uld_dev_name, IFNAMSIZ); lld_dev_put(); return; @@ -999,9 +999,9 @@ void hifc_get_card_info(void *hwdev, void *bufin) if (!__is_func_valid(dev)) continue; - strlcpy(info->pf[idx].name, dev->uld_dev_name, IFNAMSIZ); + strscpy(info->pf[idx].name, dev->uld_dev_name, IFNAMSIZ); info->pf[idx].pf_type = (u32)BIT(SERVICE_T_FC); - strlcpy(info->pf[idx].bus_info, pci_name(dev->pcidev), + strscpy(info->pf[idx].bus_info, pci_name(dev->pcidev), sizeof(info->pf[idx].bus_info)); info->pf_num++; idx++; diff --git a/hifc/unf_event.c b/hifc/unf_event.c index b76f586..c2b2b19 100644 --- a/hifc/unf_event.c +++ b/hifc/unf_event.c @@ -9,6 +9,14 @@ #include "unf_event.h" #include "unf_lport.h" +void unf_init_event_node(struct unf_cm_event_report *v_event_node); +struct unf_cm_event_report *unf_get_free_event_node(void *v_lport); +void unf_check_event_mgr_status(struct unf_event_mgr *v_event_mgr); +void unf_release_event(void *v_lport, void *v_event_node); +void unf_post_event(void *v_lport, void *v_event_node); +void unf_wait_event_mgr_complete(struct unf_event_mgr *v_event_mgr); +void unf_release_global_event(void *v_event_node); +unsigned int unf_init_event_msg(struct unf_lport_s *v_lport); struct unf_event_list fc_event_list; struct unf_global_event_queue global_event_queue; diff --git a/hifc/unf_init.c b/hifc/unf_init.c index c902a7f..443d983 100644 --- a/hifc/unf_init.c +++ b/hifc/unf_init.c @@ -27,7 +27,8 @@ static int unf_get_cfg_parms(char *v_section_name, struct unf_cfg_item_s *v_cfg_parm, unsigned int *v_cfg_value, unsigned int v_item_num); - +void unf_free_port_feature_pool(void); +int unf_event_process(void *v_arg); /* global variables */ unsigned int event_thread_exit; @@ -323,7 +324,8 @@ int unf_event_process(void *v_arg) } } while (!event_thread_exit); - complete_and_exit(fc_event_handle_thd_comp, 0); + // complete_and_exit(fc_event_handle_thd_comp, 0); + complete(fc_event_handle_thd_comp); UNF_TRACE(UNF_EVTLOG_DRIVER_INFO, UNF_LOG_EVENT, UNF_MAJOR, "[event]Event thread exit"); @@ -345,7 +347,9 @@ static unsigned int unf_creat_event_center(void) event_thread = kthread_run(unf_event_process, NULL, "hifc_event"); if (IS_ERR(event_thread)) { - complete_and_exit(fc_event_handle_thd_comp, 0); + // complete_and_exit(fc_event_handle_thd_comp, 0); + complete(fc_event_handle_thd_comp); + fc_event_handle_thd_comp = NULL; UNF_TRACE(UNF_EVTLOG_DRIVER_ERR, UNF_LOG_REG_ATT, UNF_ERR, diff --git a/hifc/unf_io.c b/hifc/unf_io.c index f52b992..6373d97 100644 --- a/hifc/unf_io.c +++ b/hifc/unf_io.c @@ -34,6 +34,7 @@ struct unf_ini_error_handler { struct unf_frame_pkg_s *v_pkg, unsigned int v_status); }; +int unf_prefer_to_send_scsi_cmnd(struct unf_xchg_s *v_xchg); struct unf_ini_error_handler ini_error_handler_table[] = { { UNF_IO_SUCCESS, unf_io_success_handler }, diff --git a/hifc/unf_io_abnormal.c b/hifc/unf_io_abnormal.c index f96bd07..acea692 100644 --- a/hifc/unf_io_abnormal.c +++ b/hifc/unf_io_abnormal.c @@ -12,6 +12,13 @@ #include "unf_service.h" #include "unf_io_abnormal.h" +int unf_send_scsi_mgmt_cmnd(struct unf_xchg_s *v_xchg, + struct unf_lport_s *v_lport, + struct unf_rport_s *v_rport, + struct unf_scsi_cmd_s *v_scsi_cmnd, + enum unf_task_mgmt_cmnd_e v_task_mgnt_cmd_type); + + static int unf_send_abts_success(struct unf_lport_s *v_lport, struct unf_xchg_s *v_xchg, struct unf_scsi_cmd_s *v_scsi_cmnd, diff --git a/hifc/unf_lport.c b/hifc/unf_lport.c index 09986f1..973debd 100644 --- a/hifc/unf_lport.c +++ b/hifc/unf_lport.c @@ -14,6 +14,13 @@ #include "unf_npiv.h" static void unf_lport_timeout(struct work_struct *work); +unsigned int unf_lport_retry_flogi(struct unf_lport_s *v_lport); +int unf_get_port_params(void *v_argin, void *v_argout); +unsigned int unf_lport_name_server_register( + struct unf_lport_s *v_lport, + enum unf_lport_login_state_e states); +unsigned int unf_lport_enter_sns_logo(struct unf_lport_s *v_lport, + struct unf_rport_s *v_rport); void unf_cmmark_dirty_mem(struct unf_lport_s *v_lport, enum unf_lport_dirty_flag_e v_etype) diff --git a/hifc/unf_portman.c b/hifc/unf_portman.c index 94132eb..a74d600 100644 --- a/hifc/unf_portman.c +++ b/hifc/unf_portman.c @@ -4137,7 +4137,6 @@ static int unf_cm_set_vport(struct unf_lport_s *v_lport, low32 = buff_in->arg[1]; port_name = ((unsigned long)high32 << 32) | low32; fallthrough; - //lint -fallthrough case 3: /* create vport and autogeneration wwpn */ ret = unf_npiv_conf(port_id, port_name); diff --git a/hifc/unf_rport.c b/hifc/unf_rport.c index 3b21676..c99e0a1 100644 --- a/hifc/unf_rport.c +++ b/hifc/unf_rport.c @@ -15,6 +15,8 @@ /* rport state: */ /* ready --->>> link_down --->>> cloing --->>> timeout --->>> delete */ +struct unf_rport_s *unf_get_rport_by_wwn(struct unf_lport_s *v_lport, + unsigned long long v_wwpn); struct unf_rport_feature_pool_s *port_fea_pool; /* diff --git a/hifc/unf_scsi.c b/hifc/unf_scsi.c index b3732e8..c84764c 100644 --- a/hifc/unf_scsi.c +++ b/hifc/unf_scsi.c @@ -12,6 +12,19 @@ #include "unf_exchg.h" #include "unf_io.h" +int unf_scsi_create_vport(struct fc_vport *fc_port, bool disabled); +int unf_scsi_delete_vport(struct fc_vport *fc_port); +void unf_scsi_done(struct unf_scsi_cmd_s *v_scsi_cmnd); +void unf_host_init_attr_setting(unf_scsi_host_s *scsi_host); +unsigned int unf_get_frame_entry_buf(void *v_up_cmnd, + void *v_driver_sgl, + void **v_upper_sgl, + unsigned int *v_port_id, + unsigned int *v_index, + char **v_buf, + unsigned int *v_buf_len); + + static int unf_scsi_queue_cmd(struct Scsi_Host *shost, struct scsi_cmnd *v_cmnd); static int unf_scsi_abort_scsi_cmnd(struct scsi_cmnd *v_cmnd); @@ -489,7 +502,7 @@ struct scsi_host_template scsi_host_template = { .this_id = -1, .cmd_per_lun = 3, - .shost_attrs = NULL, + .shost_groups = NULL, .sg_tablesize = SG_ALL, .max_sectors = 0xFFFF, .supported_mode = MODE_INITIATOR, @@ -520,14 +533,16 @@ void unf_scsi_done(struct unf_scsi_cmd_s *v_scsi_cmnd) UNF_CHECK_VALID(0x509, UNF_TRUE, v_scsi_cmnd, return); cmnd = (struct scsi_cmnd *)v_scsi_cmnd->upper_cmnd; UNF_CHECK_VALID(0x510, UNF_TRUE, cmnd, return); - UNF_CHECK_VALID(0x511, UNF_TRUE, cmnd->scsi_done, return); + // UNF_CHECK_VALID(0x511, UNF_TRUE, cmnd->scsi_done, return); scsi_set_resid(cmnd, (int)v_scsi_cmnd->resid); cmnd->result = v_scsi_cmnd->result; scsi_dma_unmap(cmnd); unf_unmap_prot_sgl(cmnd); - return cmnd->scsi_done(cmnd); + // return cmnd->scsi_done(cmnd); + scsi_done(cmnd); + return; } void unf_host_init_attr_setting(unf_scsi_host_s *scsi_host) @@ -807,7 +822,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, /* scsi_done & return 0 & I/O error */ cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); return 0; } @@ -821,7 +836,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, /* scsi_done & return 0 & I/O error */ cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); return 0; } @@ -838,7 +853,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, /* scsi_done & return 0 & I/O error */ cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_NO_CONNECT; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); return 0; @@ -849,7 +864,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, "[warn]Port(0x%x) WwnRportInfoTable NULL", lport->port_id); cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_NO_CONNECT; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); return 0; @@ -861,7 +876,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, lport->port_id, scsi_id, p_rport, p_rport->scsi_target_id, cmd); cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_NO_CONNECT; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); return 0; @@ -891,7 +906,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, cmd->cmnd[0]); cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_NO_CONNECT; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); @@ -913,7 +928,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, lport->port_id, scsi_id, p_rport, p_rport->scsi_target_id, cmd); cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_NO_CONNECT; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); @@ -933,7 +948,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, lport->port_id, scsi_id, p_rport, p_rport->scsi_target_id, cmd); cmd->result = DID_BUS_BUSY << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_BUS_BUSY; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); return SCSI_MLQUEUE_HOST_BUSY; @@ -973,7 +988,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, ret = unf_get_protect_mode(lport, cmd, &scsi_cmnd); if (ret != RETURN_OK) { cmd->result = DID_BUS_BUSY << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_BUS_BUSY; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); @@ -1018,7 +1033,7 @@ static int unf_scsi_queue_cmd(struct Scsi_Host *shost, cmd->cmnd[0], cmnd_result); cmd->result = DID_NO_CONNECT << 16; - cmd->scsi_done(cmd); + // cmd->scsi_done(cmd); ret_value = DID_NO_CONNECT; UNF_IO_RESULT_CNT(scsi_image_table, scsi_id, ret_value); scsi_dma_unmap(cmd); diff --git a/hifc/unf_service.c b/hifc/unf_service.c index 208954b..65b7369 100644 --- a/hifc/unf_service.c +++ b/hifc/unf_service.c @@ -1565,10 +1565,10 @@ unsigned int unf_send_echo(struct unf_lport_s *v_lport, } fc_entry->echo.echo_pld = echo_pld; - phy_echo_addr = pci_map_single(v_lport->low_level_func.dev, echo_pld, + phy_echo_addr = dma_map_single(&v_lport->low_level_func.dev->dev, echo_pld, UNF_ECHO_PAYLOAD_LEN, DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error( - v_lport->low_level_func.dev, phy_echo_addr)) { + if (dma_mapping_error( + &v_lport->low_level_func.dev->dev, phy_echo_addr)) { UNF_TRACE(UNF_EVTLOG_DRIVER_WARN, UNF_LOG_LOGIN_ATT, UNF_WARN, "[warn]Port(0x%x) pci map err", v_lport->port_id); @@ -1627,7 +1627,7 @@ unsigned int unf_send_echo(struct unf_lport_s *v_lport, } } - pci_unmap_single(v_lport->low_level_func.dev, phy_echo_addr, + dma_unmap_single(&v_lport->low_level_func.dev->dev, phy_echo_addr, UNF_ECHO_PAYLOAD_LEN, DMA_BIDIRECTIONAL); fc_entry->echo.phy_echo_addr = 0; unf_xchg_ref_dec(xchg, SEND_ELS); @@ -6957,8 +6957,8 @@ static void unf_echo_acc_callback(struct unf_xchg_s *v_xchg) UNF_CHECK_VALID(0x3517, UNF_TRUE, lport, return); if (v_xchg->fcp_sfs_union.sfs_entry.fc_sfs_entry_ptr->echo_acc.phy_echo_addr) { - pci_unmap_single( - lport->low_level_func.dev, + dma_unmap_single( + &lport->low_level_func.dev->dev, v_xchg->fcp_sfs_union.sfs_entry.fc_sfs_entry_ptr->echo_acc.phy_echo_addr, UNF_ECHO_PAYLOAD_LEN, DMA_BIDIRECTIONAL); @@ -7011,11 +7011,11 @@ static unsigned int unf_send_echo_acc(struct unf_lport_s *v_lport, unf_fill_echo_acc_pld(echo_acc); ox_id = v_xchg->ox_id; rx_id = v_xchg->rx_id; - phy_echo_acc_addr = pci_map_single(v_lport->low_level_func.dev, + phy_echo_acc_addr = dma_map_single(&v_lport->low_level_func.dev->dev, echo_acc->echo_pld, UNF_ECHO_PAYLOAD_LEN, DMA_BIDIRECTIONAL); - if (pci_dma_mapping_error(v_lport->low_level_func.dev, + if (dma_mapping_error(&v_lport->low_level_func.dev->dev, phy_echo_acc_addr)) { UNF_TRACE(UNF_EVTLOG_DRIVER_WARN, UNF_LOG_LOGIN_ATT, UNF_WARN, @@ -7028,7 +7028,7 @@ static unsigned int unf_send_echo_acc(struct unf_lport_s *v_lport, ret = unf_els_cmnd_send(v_lport, &pkg, v_xchg); if (ret != RETURN_OK) { - pci_unmap_single(v_lport->low_level_func.dev, + dma_unmap_single(&v_lport->low_level_func.dev->dev, phy_echo_acc_addr, UNF_ECHO_PAYLOAD_LEN, DMA_BIDIRECTIONAL);