xref: /illumos-gate/usr/src/uts/common/io/ib/ibtl/ibtl_mcg.c (revision 71269a2275bf5a143dad6461eee2710a344e7261)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30  * ibtl_mcg.c
31  *
32  * This file contains Transport API functions that implement the
33  * verbs related to Multicast Groups.  These are only applicable
34  * for UD channels.
35  */
36 
37 #include <sys/ib/ibtl/impl/ibtl.h>
38 
39 static char ibtl_mcg[] = "ibtl_mcg";
40 
41 /*
42  * Function:
43  *	ibt_attach_mcg
44  * Input:
45  *	ud_chan		A channel handle returned from ibt_alloc_ud_channel().
46  *			This is the UD channel handle, that is to be used to
47  *			receive data sent to the multicast group.
48  *
49  *	mcg_info	A pointer to an ibt_mcg_info_t struct returned from an
50  *			ibt_join_mcg() or ibt_query_mcg() call, that identifies
51  *			the multicast group to attach this channel to.
52  * Output:
53  *	none.
54  * Returns:
55  *	IBT_CHAN_SRV_TYPE_INVALID
56  *	Return value as of ibc_attach_mcg() call.
57  * Description:
58  *	Attaches a UD channel to the specified multicast group.
59  */
60 ibt_status_t
61 ibt_attach_mcg(ibt_channel_hdl_t ud_chan, ibt_mcg_info_t *mcg_info)
62 {
63 	IBTF_DPRINTF_L3(ibtl_mcg, "ibt_attach_mcg(%p, %p)", ud_chan, mcg_info);
64 
65 	/* re-direct the call to CI's call */
66 	return (IBTL_CHAN2CIHCAOPS_P(ud_chan)->ibc_attach_mcg(
67 	    IBTL_CHAN2CIHCA(ud_chan), ud_chan->ch_qp.qp_ibc_qp_hdl,
68 	    mcg_info->mc_adds_vect.av_dgid, mcg_info->mc_adds_vect.av_dlid));
69 }
70 
71 
72 /*
73  * Function:
74  *	ibt_detach_mcg
75  * Input:
76  *	ud_chan		A channel handle returned from ibt_alloc_ud_channel().
77  *			This is the UD channel handle, that is to be used to
78  *			receive data sent to the multicast group.
79  *
80  *	mcg_info	A pointer to an ibt_mcg_info_t struct returned from an
81  *			ibt_join_mcg() or ibt_query_mcg() call, that identifies
82  *			the multicast group to detach this channel from.
83  * Output:
84  *	none.
85  * Returns:
86  *	IBT_CHAN_SRV_TYPE_INVALID
87  *	Return value as of ibc_detach_mcg() call.
88  * Description:
89  *	Detach the specified UD channel from the specified multicast group.
90  */
91 ibt_status_t
92 ibt_detach_mcg(ibt_channel_hdl_t ud_chan, ibt_mcg_info_t *mcg_info)
93 {
94 	IBTF_DPRINTF_L3(ibtl_mcg, "ibt_detach_mcg(%p, %p", ud_chan, mcg_info);
95 
96 	/* re-direct the call to CI's call */
97 	return (IBTL_CHAN2CIHCAOPS_P(ud_chan)->ibc_detach_mcg(
98 	    IBTL_CHAN2CIHCA(ud_chan), ud_chan->ch_qp.qp_ibc_qp_hdl,
99 	    mcg_info->mc_adds_vect.av_dgid, mcg_info->mc_adds_vect.av_dlid));
100 }
101