• Home
  • Raw
  • Download

Lines Matching refs:rdev

107 static int bnxt_re_unregister_netdev(struct bnxt_re_dev *rdev, bool lock_wait)  in bnxt_re_unregister_netdev()  argument
112 if (!rdev) in bnxt_re_unregister_netdev()
115 en_dev = rdev->en_dev; in bnxt_re_unregister_netdev()
120 rc = en_dev->en_ops->bnxt_unregister_device(rdev->en_dev, in bnxt_re_unregister_netdev()
127 static int bnxt_re_register_netdev(struct bnxt_re_dev *rdev) in bnxt_re_register_netdev() argument
132 if (!rdev) in bnxt_re_register_netdev()
135 en_dev = rdev->en_dev; in bnxt_re_register_netdev()
139 &bnxt_re_ulp_ops, rdev); in bnxt_re_register_netdev()
144 static int bnxt_re_free_msix(struct bnxt_re_dev *rdev, bool lock_wait) in bnxt_re_free_msix() argument
149 if (!rdev) in bnxt_re_free_msix()
152 en_dev = rdev->en_dev; in bnxt_re_free_msix()
157 rc = en_dev->en_ops->bnxt_free_msix(rdev->en_dev, BNXT_ROCE_ULP); in bnxt_re_free_msix()
164 static int bnxt_re_request_msix(struct bnxt_re_dev *rdev) in bnxt_re_request_msix() argument
169 if (!rdev) in bnxt_re_request_msix()
172 en_dev = rdev->en_dev; in bnxt_re_request_msix()
178 rdev->msix_entries, in bnxt_re_request_msix()
185 dev_warn(rdev_to_dev(rdev), in bnxt_re_request_msix()
189 rdev->num_msix = num_msix_got; in bnxt_re_request_msix()
195 static void bnxt_re_init_hwrm_hdr(struct bnxt_re_dev *rdev, struct input *hdr, in bnxt_re_init_hwrm_hdr() argument
214 static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id, in bnxt_re_net_ring_free() argument
217 struct bnxt_en_dev *en_dev = rdev->en_dev; in bnxt_re_net_ring_free()
233 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_FREE, -1, -1); in bnxt_re_net_ring_free()
240 dev_err(rdev_to_dev(rdev), in bnxt_re_net_ring_free()
247 static int bnxt_re_net_ring_alloc(struct bnxt_re_dev *rdev, dma_addr_t *dma_arr, in bnxt_re_net_ring_alloc() argument
251 struct bnxt_en_dev *en_dev = rdev->en_dev; in bnxt_re_net_ring_alloc()
262 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_RING_ALLOC, -1, -1); in bnxt_re_net_ring_alloc()
286 static int bnxt_re_net_stats_ctx_free(struct bnxt_re_dev *rdev, in bnxt_re_net_stats_ctx_free() argument
289 struct bnxt_en_dev *en_dev = rdev->en_dev; in bnxt_re_net_stats_ctx_free()
304 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_FREE, -1, -1); in bnxt_re_net_stats_ctx_free()
310 dev_err(rdev_to_dev(rdev), in bnxt_re_net_stats_ctx_free()
318 static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev, in bnxt_re_net_stats_ctx_alloc() argument
324 struct bnxt_en_dev *en_dev = rdev->en_dev; in bnxt_re_net_stats_ctx_alloc()
336 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, HWRM_STAT_CTX_ALLOC, -1, -1); in bnxt_re_net_stats_ctx_alloc()
369 struct bnxt_re_dev *rdev; in bnxt_re_from_netdev() local
372 list_for_each_entry_rcu(rdev, &bnxt_re_dev_list, list) { in bnxt_re_from_netdev()
373 if (rdev->netdev == netdev) { in bnxt_re_from_netdev()
375 return rdev; in bnxt_re_from_netdev()
423 static void bnxt_re_unregister_ib(struct bnxt_re_dev *rdev) in bnxt_re_unregister_ib() argument
425 ib_unregister_device(&rdev->ibdev); in bnxt_re_unregister_ib()
428 static int bnxt_re_register_ib(struct bnxt_re_dev *rdev) in bnxt_re_register_ib() argument
430 struct ib_device *ibdev = &rdev->ibdev; in bnxt_re_register_ib()
440 bnxt_qplib_get_guid(rdev->netdev->dev_addr, (u8 *)&ibdev->node_guid); in bnxt_re_register_ib()
443 ibdev->dev.parent = &rdev->en_dev->pdev->dev; in bnxt_re_register_ib()
527 struct bnxt_re_dev *rdev = to_bnxt_re_dev(device, ibdev.dev); in show_rev() local
529 return scnprintf(buf, PAGE_SIZE, "0x%x\n", rdev->en_dev->pdev->vendor); in show_rev()
535 struct bnxt_re_dev *rdev = to_bnxt_re_dev(device, ibdev.dev); in show_fw_ver() local
537 return scnprintf(buf, PAGE_SIZE, "%s\n", rdev->dev_attr.fw_ver); in show_fw_ver()
543 struct bnxt_re_dev *rdev = to_bnxt_re_dev(device, ibdev.dev); in show_hca() local
545 return scnprintf(buf, PAGE_SIZE, "%s\n", rdev->ibdev.node_desc); in show_hca()
558 static void bnxt_re_dev_remove(struct bnxt_re_dev *rdev) in bnxt_re_dev_remove() argument
560 dev_put(rdev->netdev); in bnxt_re_dev_remove()
561 rdev->netdev = NULL; in bnxt_re_dev_remove()
564 list_del_rcu(&rdev->list); in bnxt_re_dev_remove()
570 ib_dealloc_device(&rdev->ibdev); in bnxt_re_dev_remove()
577 struct bnxt_re_dev *rdev; in bnxt_re_dev_add() local
580 rdev = (struct bnxt_re_dev *)ib_alloc_device(sizeof(*rdev)); in bnxt_re_dev_add()
581 if (!rdev) { in bnxt_re_dev_add()
587 rdev->netdev = netdev; in bnxt_re_dev_add()
588 dev_hold(rdev->netdev); in bnxt_re_dev_add()
589 rdev->en_dev = en_dev; in bnxt_re_dev_add()
590 rdev->id = rdev->en_dev->pdev->devfn; in bnxt_re_dev_add()
591 INIT_LIST_HEAD(&rdev->qp_list); in bnxt_re_dev_add()
592 mutex_init(&rdev->qp_lock); in bnxt_re_dev_add()
593 atomic_set(&rdev->qp_count, 0); in bnxt_re_dev_add()
594 atomic_set(&rdev->cq_count, 0); in bnxt_re_dev_add()
595 atomic_set(&rdev->srq_count, 0); in bnxt_re_dev_add()
596 atomic_set(&rdev->mr_count, 0); in bnxt_re_dev_add()
597 atomic_set(&rdev->mw_count, 0); in bnxt_re_dev_add()
598 rdev->cosq[0] = 0xFFFF; in bnxt_re_dev_add()
599 rdev->cosq[1] = 0xFFFF; in bnxt_re_dev_add()
602 list_add_tail_rcu(&rdev->list, &bnxt_re_dev_list); in bnxt_re_dev_add()
604 return rdev; in bnxt_re_dev_add()
658 static void bnxt_re_cleanup_res(struct bnxt_re_dev *rdev) in bnxt_re_cleanup_res() argument
662 if (rdev->nq[0].hwq.max_elements) { in bnxt_re_cleanup_res()
663 for (i = 1; i < rdev->num_msix; i++) in bnxt_re_cleanup_res()
664 bnxt_qplib_disable_nq(&rdev->nq[i - 1]); in bnxt_re_cleanup_res()
667 if (rdev->qplib_res.rcfw) in bnxt_re_cleanup_res()
668 bnxt_qplib_cleanup_res(&rdev->qplib_res); in bnxt_re_cleanup_res()
671 static int bnxt_re_init_res(struct bnxt_re_dev *rdev) in bnxt_re_init_res() argument
675 bnxt_qplib_init_res(&rdev->qplib_res); in bnxt_re_init_res()
677 for (i = 1; i < rdev->num_msix ; i++) { in bnxt_re_init_res()
678 rc = bnxt_qplib_enable_nq(rdev->en_dev->pdev, &rdev->nq[i - 1], in bnxt_re_init_res()
679 i - 1, rdev->msix_entries[i].vector, in bnxt_re_init_res()
680 rdev->msix_entries[i].db_offset, in bnxt_re_init_res()
684 dev_err(rdev_to_dev(rdev), in bnxt_re_init_res()
694 static void bnxt_re_free_nq_res(struct bnxt_re_dev *rdev, bool lock_wait) in bnxt_re_free_nq_res() argument
698 for (i = 0; i < rdev->num_msix - 1; i++) { in bnxt_re_free_nq_res()
699 bnxt_re_net_ring_free(rdev, rdev->nq[i].ring_id, lock_wait); in bnxt_re_free_nq_res()
700 bnxt_qplib_free_nq(&rdev->nq[i]); in bnxt_re_free_nq_res()
704 static void bnxt_re_free_res(struct bnxt_re_dev *rdev, bool lock_wait) in bnxt_re_free_res() argument
706 bnxt_re_free_nq_res(rdev, lock_wait); in bnxt_re_free_res()
708 if (rdev->qplib_res.dpi_tbl.max) { in bnxt_re_free_res()
709 bnxt_qplib_dealloc_dpi(&rdev->qplib_res, in bnxt_re_free_res()
710 &rdev->qplib_res.dpi_tbl, in bnxt_re_free_res()
711 &rdev->dpi_privileged); in bnxt_re_free_res()
713 if (rdev->qplib_res.rcfw) { in bnxt_re_free_res()
714 bnxt_qplib_free_res(&rdev->qplib_res); in bnxt_re_free_res()
715 rdev->qplib_res.rcfw = NULL; in bnxt_re_free_res()
719 static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) in bnxt_re_alloc_res() argument
724 rdev->qplib_res.rcfw = &rdev->rcfw; in bnxt_re_alloc_res()
725 rc = bnxt_qplib_get_dev_attr(&rdev->rcfw, &rdev->dev_attr); in bnxt_re_alloc_res()
729 rc = bnxt_qplib_alloc_res(&rdev->qplib_res, rdev->en_dev->pdev, in bnxt_re_alloc_res()
730 rdev->netdev, &rdev->dev_attr); in bnxt_re_alloc_res()
734 rc = bnxt_qplib_alloc_dpi(&rdev->qplib_res.dpi_tbl, in bnxt_re_alloc_res()
735 &rdev->dpi_privileged, in bnxt_re_alloc_res()
736 rdev); in bnxt_re_alloc_res()
740 for (i = 0; i < rdev->num_msix - 1; i++) { in bnxt_re_alloc_res()
741 rdev->nq[i].hwq.max_elements = BNXT_RE_MAX_CQ_COUNT + in bnxt_re_alloc_res()
743 rc = bnxt_qplib_alloc_nq(rdev->en_dev->pdev, &rdev->nq[i]); in bnxt_re_alloc_res()
745 dev_err(rdev_to_dev(rdev), "Alloc Failed NQ%d rc:%#x", in bnxt_re_alloc_res()
750 (rdev, rdev->nq[i].hwq.pbl[PBL_LVL_0].pg_map_arr, in bnxt_re_alloc_res()
751 rdev->nq[i].hwq.pbl[rdev->nq[i].hwq.level].pg_count, in bnxt_re_alloc_res()
754 rdev->msix_entries[i + 1].ring_idx, in bnxt_re_alloc_res()
755 &rdev->nq[i].ring_id); in bnxt_re_alloc_res()
757 dev_err(rdev_to_dev(rdev), in bnxt_re_alloc_res()
765 for (i = 0; i < rdev->num_msix - 1; i++) in bnxt_re_alloc_res()
766 bnxt_qplib_free_nq(&rdev->nq[i]); in bnxt_re_alloc_res()
768 bnxt_qplib_dealloc_dpi(&rdev->qplib_res, in bnxt_re_alloc_res()
769 &rdev->qplib_res.dpi_tbl, in bnxt_re_alloc_res()
770 &rdev->dpi_privileged); in bnxt_re_alloc_res()
772 bnxt_qplib_free_res(&rdev->qplib_res); in bnxt_re_alloc_res()
775 rdev->qplib_res.rcfw = NULL; in bnxt_re_alloc_res()
799 static int bnxt_re_query_hwrm_pri2cos(struct bnxt_re_dev *rdev, u8 dir, in bnxt_re_query_hwrm_pri2cos() argument
803 struct bnxt *bp = netdev_priv(rdev->netdev); in bnxt_re_query_hwrm_pri2cos()
805 struct bnxt_en_dev *en_dev = rdev->en_dev; in bnxt_re_query_hwrm_pri2cos()
815 bnxt_re_init_hwrm_hdr(rdev, (void *)&req, in bnxt_re_query_hwrm_pri2cos()
829 dev_warn(rdev_to_dev(rdev), in bnxt_re_query_hwrm_pri2cos()
831 dev_warn(rdev_to_dev(rdev), in bnxt_re_query_hwrm_pri2cos()
842 static bool bnxt_re_is_qp1_or_shadow_qp(struct bnxt_re_dev *rdev, in bnxt_re_is_qp1_or_shadow_qp() argument
845 return (qp->ib_qp.qp_type == IB_QPT_GSI) || (qp == rdev->qp1_sqp); in bnxt_re_is_qp1_or_shadow_qp()
848 static void bnxt_re_dev_stop(struct bnxt_re_dev *rdev) in bnxt_re_dev_stop() argument
855 mutex_lock(&rdev->qp_lock); in bnxt_re_dev_stop()
856 list_for_each_entry(qp, &rdev->qp_list, list) { in bnxt_re_dev_stop()
858 if (!bnxt_re_is_qp1_or_shadow_qp(rdev, qp)) { in bnxt_re_dev_stop()
863 bnxt_re_dispatch_event(&rdev->ibdev, &qp->ib_qp, in bnxt_re_dev_stop()
870 mutex_unlock(&rdev->qp_lock); in bnxt_re_dev_stop()
873 static int bnxt_re_update_gid(struct bnxt_re_dev *rdev) in bnxt_re_update_gid() argument
875 struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl; in bnxt_re_update_gid()
880 if (!test_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags)) in bnxt_re_update_gid()
884 dev_err(rdev_to_dev(rdev), "QPLIB: SGID table not allocated"); in bnxt_re_update_gid()
903 rdev->qplib_res.netdev->dev_addr); in bnxt_re_update_gid()
909 static u32 bnxt_re_get_priority_mask(struct bnxt_re_dev *rdev) in bnxt_re_get_priority_mask() argument
915 netdev = rdev->netdev; in bnxt_re_get_priority_mask()
946 static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev) in bnxt_re_setup_qos() argument
953 prio_map = bnxt_re_get_priority_mask(rdev); in bnxt_re_setup_qos()
955 if (prio_map == rdev->cur_prio_map) in bnxt_re_setup_qos()
957 rdev->cur_prio_map = prio_map; in bnxt_re_setup_qos()
959 rc = bnxt_re_query_hwrm_pri2cos(rdev, 0, &cid_map); in bnxt_re_setup_qos()
961 dev_warn(rdev_to_dev(rdev), "no cos for p_mask %x\n", prio_map); in bnxt_re_setup_qos()
965 bnxt_re_parse_cid_map(prio_map, (u8 *)&cid_map, rdev->cosq); in bnxt_re_setup_qos()
968 rc = bnxt_qplib_map_tc2cos(&rdev->qplib_res, rdev->cosq); in bnxt_re_setup_qos()
970 dev_warn(rdev_to_dev(rdev), "no tc for cos{%x, %x}\n", in bnxt_re_setup_qos()
971 rdev->cosq[0], rdev->cosq[1]); in bnxt_re_setup_qos()
978 if ((prio_map == 0 && rdev->qplib_res.prio) || in bnxt_re_setup_qos()
979 (prio_map != 0 && !rdev->qplib_res.prio)) { in bnxt_re_setup_qos()
980 rdev->qplib_res.prio = prio_map ? true : false; in bnxt_re_setup_qos()
982 bnxt_re_update_gid(rdev); in bnxt_re_setup_qos()
988 static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait) in bnxt_re_ib_unreg() argument
992 if (test_and_clear_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags)) { in bnxt_re_ib_unreg()
994 device_remove_file(&rdev->ibdev.dev, in bnxt_re_ib_unreg()
997 bnxt_re_unregister_ib(rdev); in bnxt_re_ib_unreg()
999 if (test_and_clear_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags)) in bnxt_re_ib_unreg()
1000 cancel_delayed_work(&rdev->worker); in bnxt_re_ib_unreg()
1002 bnxt_re_cleanup_res(rdev); in bnxt_re_ib_unreg()
1003 bnxt_re_free_res(rdev, lock_wait); in bnxt_re_ib_unreg()
1005 if (test_and_clear_bit(BNXT_RE_FLAG_RCFW_CHANNEL_EN, &rdev->flags)) { in bnxt_re_ib_unreg()
1006 rc = bnxt_qplib_deinit_rcfw(&rdev->rcfw); in bnxt_re_ib_unreg()
1008 dev_warn(rdev_to_dev(rdev), in bnxt_re_ib_unreg()
1010 bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id, in bnxt_re_ib_unreg()
1012 bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx); in bnxt_re_ib_unreg()
1013 bnxt_qplib_disable_rcfw_channel(&rdev->rcfw); in bnxt_re_ib_unreg()
1014 bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, lock_wait); in bnxt_re_ib_unreg()
1015 bnxt_qplib_free_rcfw_channel(&rdev->rcfw); in bnxt_re_ib_unreg()
1017 if (test_and_clear_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags)) { in bnxt_re_ib_unreg()
1018 rc = bnxt_re_free_msix(rdev, lock_wait); in bnxt_re_ib_unreg()
1020 dev_warn(rdev_to_dev(rdev), in bnxt_re_ib_unreg()
1023 if (test_and_clear_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags)) { in bnxt_re_ib_unreg()
1024 rc = bnxt_re_unregister_netdev(rdev, lock_wait); in bnxt_re_ib_unreg()
1026 dev_warn(rdev_to_dev(rdev), in bnxt_re_ib_unreg()
1031 static void bnxt_re_set_resource_limits(struct bnxt_re_dev *rdev) in bnxt_re_set_resource_limits() argument
1035 rdev->qplib_ctx.qpc_count = BNXT_RE_MAX_QPC_COUNT; in bnxt_re_set_resource_limits()
1036 rdev->qplib_ctx.mrw_count = BNXT_RE_MAX_MRW_COUNT; in bnxt_re_set_resource_limits()
1037 rdev->qplib_ctx.srqc_count = BNXT_RE_MAX_SRQC_COUNT; in bnxt_re_set_resource_limits()
1038 rdev->qplib_ctx.cq_count = BNXT_RE_MAX_CQ_COUNT; in bnxt_re_set_resource_limits()
1040 rdev->qplib_ctx.tqm_count[i] = in bnxt_re_set_resource_limits()
1041 rdev->dev_attr.tqm_alloc_reqs[i]; in bnxt_re_set_resource_limits()
1047 struct bnxt_re_dev *rdev = container_of(work, struct bnxt_re_dev, in bnxt_re_worker() local
1050 bnxt_re_setup_qos(rdev); in bnxt_re_worker()
1051 schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000)); in bnxt_re_worker()
1054 static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev) in bnxt_re_ib_reg() argument
1059 rc = bnxt_re_register_netdev(rdev); in bnxt_re_ib_reg()
1064 set_bit(BNXT_RE_FLAG_NETDEV_REGISTERED, &rdev->flags); in bnxt_re_ib_reg()
1066 rc = bnxt_re_request_msix(rdev); in bnxt_re_ib_reg()
1072 set_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags); in bnxt_re_ib_reg()
1077 rc = bnxt_qplib_alloc_rcfw_channel(rdev->en_dev->pdev, &rdev->rcfw, in bnxt_re_ib_reg()
1083 (rdev, rdev->rcfw.creq.pbl[PBL_LVL_0].pg_map_arr, in bnxt_re_ib_reg()
1084 rdev->rcfw.creq.pbl[rdev->rcfw.creq.level].pg_count, in bnxt_re_ib_reg()
1086 rdev->msix_entries[BNXT_RE_AEQ_IDX].ring_idx, in bnxt_re_ib_reg()
1087 &rdev->rcfw.creq_ring_id); in bnxt_re_ib_reg()
1093 (rdev->en_dev->pdev, &rdev->rcfw, in bnxt_re_ib_reg()
1094 rdev->msix_entries[BNXT_RE_AEQ_IDX].vector, in bnxt_re_ib_reg()
1095 rdev->msix_entries[BNXT_RE_AEQ_IDX].db_offset, in bnxt_re_ib_reg()
1102 rc = bnxt_qplib_get_dev_attr(&rdev->rcfw, &rdev->dev_attr); in bnxt_re_ib_reg()
1105 bnxt_re_set_resource_limits(rdev); in bnxt_re_ib_reg()
1107 rc = bnxt_qplib_alloc_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx, 0); in bnxt_re_ib_reg()
1112 rc = bnxt_re_net_stats_ctx_alloc(rdev, in bnxt_re_ib_reg()
1113 rdev->qplib_ctx.stats.dma_map, in bnxt_re_ib_reg()
1114 &rdev->qplib_ctx.stats.fw_id); in bnxt_re_ib_reg()
1120 rc = bnxt_qplib_init_rcfw(&rdev->rcfw, &rdev->qplib_ctx, 0); in bnxt_re_ib_reg()
1125 set_bit(BNXT_RE_FLAG_RCFW_CHANNEL_EN, &rdev->flags); in bnxt_re_ib_reg()
1128 rc = bnxt_re_alloc_res(rdev); in bnxt_re_ib_reg()
1133 rc = bnxt_re_init_res(rdev); in bnxt_re_ib_reg()
1139 rc = bnxt_re_setup_qos(rdev); in bnxt_re_ib_reg()
1143 INIT_DELAYED_WORK(&rdev->worker, bnxt_re_worker); in bnxt_re_ib_reg()
1144 set_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags); in bnxt_re_ib_reg()
1145 schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000)); in bnxt_re_ib_reg()
1148 rc = bnxt_re_register_ib(rdev); in bnxt_re_ib_reg()
1153 dev_info(rdev_to_dev(rdev), "Device registered successfully"); in bnxt_re_ib_reg()
1155 rc = device_create_file(&rdev->ibdev.dev, in bnxt_re_ib_reg()
1158 dev_err(rdev_to_dev(rdev), in bnxt_re_ib_reg()
1162 device_remove_file(&rdev->ibdev.dev, in bnxt_re_ib_reg()
1164 bnxt_re_unregister_ib(rdev); in bnxt_re_ib_reg()
1168 set_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags); in bnxt_re_ib_reg()
1169 ib_get_eth_speed(&rdev->ibdev, 1, &rdev->active_speed, in bnxt_re_ib_reg()
1170 &rdev->active_width); in bnxt_re_ib_reg()
1171 bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1, IB_EVENT_PORT_ACTIVE); in bnxt_re_ib_reg()
1172 bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1, IB_EVENT_GID_CHANGE); in bnxt_re_ib_reg()
1176 bnxt_re_net_stats_ctx_free(rdev, rdev->qplib_ctx.stats.fw_id, true); in bnxt_re_ib_reg()
1178 bnxt_qplib_free_ctx(rdev->en_dev->pdev, &rdev->qplib_ctx); in bnxt_re_ib_reg()
1180 bnxt_qplib_disable_rcfw_channel(&rdev->rcfw); in bnxt_re_ib_reg()
1182 bnxt_re_net_ring_free(rdev, rdev->rcfw.creq_ring_id, true); in bnxt_re_ib_reg()
1184 bnxt_qplib_free_rcfw_channel(&rdev->rcfw); in bnxt_re_ib_reg()
1186 bnxt_re_ib_unreg(rdev, true); in bnxt_re_ib_reg()
1190 static void bnxt_re_dev_unreg(struct bnxt_re_dev *rdev) in bnxt_re_dev_unreg() argument
1192 struct bnxt_en_dev *en_dev = rdev->en_dev; in bnxt_re_dev_unreg()
1193 struct net_device *netdev = rdev->netdev; in bnxt_re_dev_unreg()
1195 bnxt_re_dev_remove(rdev); in bnxt_re_dev_unreg()
1201 static int bnxt_re_dev_reg(struct bnxt_re_dev **rdev, struct net_device *netdev) in bnxt_re_dev_reg() argument
1216 *rdev = bnxt_re_dev_add(netdev, en_dev); in bnxt_re_dev_reg()
1217 if (!*rdev) { in bnxt_re_dev_reg()
1226 static void bnxt_re_remove_one(struct bnxt_re_dev *rdev) in bnxt_re_remove_one() argument
1228 pci_dev_put(rdev->en_dev->pdev); in bnxt_re_remove_one()
1235 struct bnxt_re_dev *rdev; in bnxt_re_task() local
1239 rdev = re_work->rdev; in bnxt_re_task()
1242 !test_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags)) in bnxt_re_task()
1247 rc = bnxt_re_ib_reg(rdev); in bnxt_re_task()
1249 dev_err(rdev_to_dev(rdev), in bnxt_re_task()
1251 bnxt_re_remove_one(rdev); in bnxt_re_task()
1252 bnxt_re_dev_unreg(rdev); in bnxt_re_task()
1256 bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1, in bnxt_re_task()
1260 bnxt_re_dev_stop(rdev); in bnxt_re_task()
1263 if (!netif_carrier_ok(rdev->netdev)) in bnxt_re_task()
1264 bnxt_re_dev_stop(rdev); in bnxt_re_task()
1265 else if (netif_carrier_ok(rdev->netdev)) in bnxt_re_task()
1266 bnxt_re_dispatch_event(&rdev->ibdev, NULL, 1, in bnxt_re_task()
1268 ib_get_eth_speed(&rdev->ibdev, 1, &rdev->active_speed, in bnxt_re_task()
1269 &rdev->active_width); in bnxt_re_task()
1275 clear_bit(BNXT_RE_FLAG_TASK_IN_PROG, &rdev->flags); in bnxt_re_task()
1279 static void bnxt_re_init_one(struct bnxt_re_dev *rdev) in bnxt_re_init_one() argument
1281 pci_dev_get(rdev->en_dev->pdev); in bnxt_re_init_one()
1303 struct bnxt_re_dev *rdev; in bnxt_re_netdev_event() local
1311 rdev = bnxt_re_from_netdev(real_dev); in bnxt_re_netdev_event()
1312 if (!rdev && event != NETDEV_REGISTER) in bnxt_re_netdev_event()
1319 if (rdev) in bnxt_re_netdev_event()
1321 rc = bnxt_re_dev_reg(&rdev, real_dev); in bnxt_re_netdev_event()
1329 bnxt_re_init_one(rdev); in bnxt_re_netdev_event()
1337 if (test_bit(BNXT_RE_FLAG_TASK_IN_PROG, &rdev->flags)) in bnxt_re_netdev_event()
1339 bnxt_re_ib_unreg(rdev, false); in bnxt_re_netdev_event()
1340 bnxt_re_remove_one(rdev); in bnxt_re_netdev_event()
1341 bnxt_re_dev_unreg(rdev); in bnxt_re_netdev_event()
1352 re_work->rdev = rdev; in bnxt_re_netdev_event()
1357 set_bit(BNXT_RE_FLAG_TASK_IN_PROG, &rdev->flags); in bnxt_re_netdev_event()
1398 struct bnxt_re_dev *rdev; in bnxt_re_mod_exit() local
1407 list_for_each_entry(rdev, &to_be_deleted, list) { in bnxt_re_mod_exit()
1408 dev_info(rdev_to_dev(rdev), "Unregistering Device"); in bnxt_re_mod_exit()
1414 bnxt_re_dev_stop(rdev); in bnxt_re_mod_exit()
1415 bnxt_re_ib_unreg(rdev, true); in bnxt_re_mod_exit()
1416 bnxt_re_remove_one(rdev); in bnxt_re_mod_exit()
1417 bnxt_re_dev_unreg(rdev); in bnxt_re_mod_exit()