Lines Matching refs:mc
115 struct ucma_multicast *mc; member
213 struct ucma_multicast *mc; in ucma_alloc_multicast() local
215 mc = kzalloc(sizeof(*mc), GFP_KERNEL); in ucma_alloc_multicast()
216 if (!mc) in ucma_alloc_multicast()
220 mc->id = idr_alloc(&multicast_idr, mc, 0, 0, GFP_KERNEL); in ucma_alloc_multicast()
222 if (mc->id < 0) in ucma_alloc_multicast()
225 mc->ctx = ctx; in ucma_alloc_multicast()
226 list_add_tail(&mc->list, &ctx->mc_list); in ucma_alloc_multicast()
227 return mc; in ucma_alloc_multicast()
230 kfree(mc); in ucma_alloc_multicast()
270 uevent->mc = (struct ucma_multicast *) in ucma_set_event_context()
272 uevent->resp.uid = uevent->mc->uid; in ucma_set_event_context()
273 uevent->resp.id = uevent->mc->id; in ucma_set_event_context()
424 if (uevent->mc) in ucma_get_event()
425 uevent->mc->events_reported++; in ucma_get_event()
503 struct ucma_multicast *mc, *tmp; in ucma_cleanup_multicast() local
506 list_for_each_entry_safe(mc, tmp, &ctx->mc_list, list) { in ucma_cleanup_multicast()
507 list_del(&mc->list); in ucma_cleanup_multicast()
508 idr_remove(&multicast_idr, mc->id); in ucma_cleanup_multicast()
509 kfree(mc); in ucma_cleanup_multicast()
514 static void ucma_cleanup_mc_events(struct ucma_multicast *mc) in ucma_cleanup_mc_events() argument
518 list_for_each_entry_safe(uevent, tmp, &mc->ctx->file->event_list, list) { in ucma_cleanup_mc_events()
519 if (uevent->mc != mc) in ucma_cleanup_mc_events()
1317 struct ucma_multicast *mc; in ucma_process_join() local
1333 mc = ucma_alloc_multicast(ctx); in ucma_process_join()
1334 if (!mc) { in ucma_process_join()
1339 mc->uid = cmd->uid; in ucma_process_join()
1340 memcpy(&mc->addr, addr, cmd->addr_size); in ucma_process_join()
1341 ret = rdma_join_multicast(ctx->cm_id, (struct sockaddr *) &mc->addr, mc); in ucma_process_join()
1345 resp.id = mc->id; in ucma_process_join()
1357 rdma_leave_multicast(ctx->cm_id, (struct sockaddr *) &mc->addr); in ucma_process_join()
1358 ucma_cleanup_mc_events(mc); in ucma_process_join()
1361 idr_remove(&multicast_idr, mc->id); in ucma_process_join()
1363 list_del(&mc->list); in ucma_process_join()
1364 kfree(mc); in ucma_process_join()
1409 struct ucma_multicast *mc; in ucma_leave_multicast() local
1419 mc = idr_find(&multicast_idr, cmd.id); in ucma_leave_multicast()
1420 if (!mc) in ucma_leave_multicast()
1421 mc = ERR_PTR(-ENOENT); in ucma_leave_multicast()
1422 else if (mc->ctx->file != file) in ucma_leave_multicast()
1423 mc = ERR_PTR(-EINVAL); in ucma_leave_multicast()
1424 else if (!atomic_inc_not_zero(&mc->ctx->ref)) in ucma_leave_multicast()
1425 mc = ERR_PTR(-ENXIO); in ucma_leave_multicast()
1427 idr_remove(&multicast_idr, mc->id); in ucma_leave_multicast()
1430 if (IS_ERR(mc)) { in ucma_leave_multicast()
1431 ret = PTR_ERR(mc); in ucma_leave_multicast()
1435 rdma_leave_multicast(mc->ctx->cm_id, (struct sockaddr *) &mc->addr); in ucma_leave_multicast()
1436 mutex_lock(&mc->ctx->file->mut); in ucma_leave_multicast()
1437 ucma_cleanup_mc_events(mc); in ucma_leave_multicast()
1438 list_del(&mc->list); in ucma_leave_multicast()
1439 mutex_unlock(&mc->ctx->file->mut); in ucma_leave_multicast()
1441 ucma_put_ctx(mc->ctx); in ucma_leave_multicast()
1442 resp.events_reported = mc->events_reported; in ucma_leave_multicast()
1443 kfree(mc); in ucma_leave_multicast()