Lines Matching refs:rds_ibdev

83 static void rds_ib_dev_shutdown(struct rds_ib_device *rds_ibdev)  in rds_ib_dev_shutdown()  argument
88 spin_lock_irqsave(&rds_ibdev->spinlock, flags); in rds_ib_dev_shutdown()
89 list_for_each_entry(ic, &rds_ibdev->conn_list, ib_node) in rds_ib_dev_shutdown()
91 spin_unlock_irqrestore(&rds_ibdev->spinlock, flags); in rds_ib_dev_shutdown()
101 struct rds_ib_device *rds_ibdev = container_of(work, in rds_ib_dev_free() local
104 if (rds_ibdev->mr_8k_pool) in rds_ib_dev_free()
105 rds_ib_destroy_mr_pool(rds_ibdev->mr_8k_pool); in rds_ib_dev_free()
106 if (rds_ibdev->mr_1m_pool) in rds_ib_dev_free()
107 rds_ib_destroy_mr_pool(rds_ibdev->mr_1m_pool); in rds_ib_dev_free()
108 if (rds_ibdev->pd) in rds_ib_dev_free()
109 ib_dealloc_pd(rds_ibdev->pd); in rds_ib_dev_free()
111 list_for_each_entry_safe(i_ipaddr, i_next, &rds_ibdev->ipaddr_list, list) { in rds_ib_dev_free()
116 kfree(rds_ibdev->vector_load); in rds_ib_dev_free()
118 kfree(rds_ibdev); in rds_ib_dev_free()
121 void rds_ib_dev_put(struct rds_ib_device *rds_ibdev) in rds_ib_dev_put() argument
123 BUG_ON(refcount_read(&rds_ibdev->refcount) == 0); in rds_ib_dev_put()
124 if (refcount_dec_and_test(&rds_ibdev->refcount)) in rds_ib_dev_put()
125 queue_work(rds_wq, &rds_ibdev->free_work); in rds_ib_dev_put()
130 struct rds_ib_device *rds_ibdev; in rds_ib_add_one() local
137 rds_ibdev = kzalloc_node(sizeof(struct rds_ib_device), GFP_KERNEL, in rds_ib_add_one()
139 if (!rds_ibdev) in rds_ib_add_one()
142 spin_lock_init(&rds_ibdev->spinlock); in rds_ib_add_one()
143 refcount_set(&rds_ibdev->refcount, 1); in rds_ib_add_one()
144 INIT_WORK(&rds_ibdev->free_work, rds_ib_dev_free); in rds_ib_add_one()
146 rds_ibdev->max_wrs = device->attrs.max_qp_wr; in rds_ib_add_one()
147 rds_ibdev->max_sge = min(device->attrs.max_send_sge, RDS_IB_MAX_SGE); in rds_ib_add_one()
153 rds_ibdev->use_fastreg = (has_fr && !has_fmr); in rds_ib_add_one()
155 rds_ibdev->fmr_max_remaps = device->attrs.max_map_per_fmr?: 32; in rds_ib_add_one()
156 rds_ibdev->max_1m_mrs = device->attrs.max_mr ? in rds_ib_add_one()
160 rds_ibdev->max_8k_mrs = device->attrs.max_mr ? in rds_ib_add_one()
164 rds_ibdev->max_initiator_depth = device->attrs.max_qp_init_rd_atom; in rds_ib_add_one()
165 rds_ibdev->max_responder_resources = device->attrs.max_qp_rd_atom; in rds_ib_add_one()
167 rds_ibdev->vector_load = kcalloc(device->num_comp_vectors, in rds_ib_add_one()
170 if (!rds_ibdev->vector_load) { in rds_ib_add_one()
176 rds_ibdev->dev = device; in rds_ib_add_one()
177 rds_ibdev->pd = ib_alloc_pd(device, 0); in rds_ib_add_one()
178 if (IS_ERR(rds_ibdev->pd)) { in rds_ib_add_one()
179 rds_ibdev->pd = NULL; in rds_ib_add_one()
183 rds_ibdev->mr_1m_pool = in rds_ib_add_one()
184 rds_ib_create_mr_pool(rds_ibdev, RDS_IB_MR_1M_POOL); in rds_ib_add_one()
185 if (IS_ERR(rds_ibdev->mr_1m_pool)) { in rds_ib_add_one()
186 rds_ibdev->mr_1m_pool = NULL; in rds_ib_add_one()
190 rds_ibdev->mr_8k_pool = in rds_ib_add_one()
191 rds_ib_create_mr_pool(rds_ibdev, RDS_IB_MR_8K_POOL); in rds_ib_add_one()
192 if (IS_ERR(rds_ibdev->mr_8k_pool)) { in rds_ib_add_one()
193 rds_ibdev->mr_8k_pool = NULL; in rds_ib_add_one()
198 device->attrs.max_fmr, rds_ibdev->max_wrs, rds_ibdev->max_sge, in rds_ib_add_one()
199 rds_ibdev->fmr_max_remaps, rds_ibdev->max_1m_mrs, in rds_ib_add_one()
200 rds_ibdev->max_8k_mrs); in rds_ib_add_one()
204 rds_ibdev->use_fastreg ? "FRMR" : "FMR"); in rds_ib_add_one()
206 INIT_LIST_HEAD(&rds_ibdev->ipaddr_list); in rds_ib_add_one()
207 INIT_LIST_HEAD(&rds_ibdev->conn_list); in rds_ib_add_one()
210 list_add_tail_rcu(&rds_ibdev->list, &rds_ib_devices); in rds_ib_add_one()
212 refcount_inc(&rds_ibdev->refcount); in rds_ib_add_one()
214 ib_set_client_data(device, &rds_ib_client, rds_ibdev); in rds_ib_add_one()
215 refcount_inc(&rds_ibdev->refcount); in rds_ib_add_one()
220 rds_ib_dev_put(rds_ibdev); in rds_ib_add_one()
241 struct rds_ib_device *rds_ibdev; in rds_ib_get_client_data() local
244 rds_ibdev = ib_get_client_data(device, &rds_ib_client); in rds_ib_get_client_data()
245 if (rds_ibdev) in rds_ib_get_client_data()
246 refcount_inc(&rds_ibdev->refcount); in rds_ib_get_client_data()
248 return rds_ibdev; in rds_ib_get_client_data()
260 struct rds_ib_device *rds_ibdev = client_data; in rds_ib_remove_one() local
262 if (!rds_ibdev) in rds_ib_remove_one()
265 rds_ib_dev_shutdown(rds_ibdev); in rds_ib_remove_one()
271 list_del_rcu(&rds_ibdev->list); in rds_ib_remove_one()
280 rds_ib_dev_put(rds_ibdev); in rds_ib_remove_one()
281 rds_ib_dev_put(rds_ibdev); in rds_ib_remove_one()
308 struct rds_ib_device *rds_ibdev; in rds_ib_conn_info_visitor() local
315 rds_ibdev = ic->rds_ibdev; in rds_ib_conn_info_visitor()
318 iinfo->max_send_sge = rds_ibdev->max_sge; in rds_ib_conn_info_visitor()
319 rds_ib_get_mr_info(rds_ibdev, iinfo); in rds_ib_conn_info_visitor()
343 struct rds_ib_device *rds_ibdev; in rds6_ib_conn_info_visitor() local
348 rds_ibdev = ic->rds_ibdev; in rds6_ib_conn_info_visitor()
351 iinfo6->max_send_sge = rds_ibdev->max_sge; in rds6_ib_conn_info_visitor()
352 rds6_ib_get_mr_info(rds_ibdev, iinfo6); in rds6_ib_conn_info_visitor()