xref: /illumos-gate/usr/src/uts/common/io/ib/ibtl/ibtl_mcg.c (revision 012e6ce759c490003aed29439cc47d3d73a99ad3)
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 /*
28  * ibtl_mcg.c
29  *
30  * This file contains Transport API functions that implement the
31  * verbs related to Multicast Groups.  These are only applicable
32  * for UD channels.
33  */
34 
35 #include <sys/ib/ibtl/impl/ibtl.h>
36 
37 static char ibtl_mcg[] = "ibtl_mcg";
38 
39 /*
40  * Function:
41  *	ibt_attach_mcg
42  * Input:
43  *	ud_chan		A channel handle returned from ibt_alloc_ud_channel().
44  *			This is the UD channel handle, that is to be used to
45  *			receive data sent to the multicast group.
46  *
47  *	mcg_info	A pointer to an ibt_mcg_info_t struct returned from an
48  *			ibt_join_mcg() or ibt_query_mcg() call, that identifies
49  *			the multicast group to attach this channel to.
50  * Output:
51  *	none.
52  * Returns:
53  *	IBT_CHAN_SRV_TYPE_INVALID
54  *	Return value as of ibc_attach_mcg() call.
55  * Description:
56  *	Attaches a UD channel to the specified multicast group.
57  */
58 ibt_status_t
59 ibt_attach_mcg(ibt_channel_hdl_t ud_chan, ibt_mcg_info_t *mcg_info)
60 {
61 	IBTF_DPRINTF_L3(ibtl_mcg, "ibt_attach_mcg(%p, %p)", ud_chan, mcg_info);
62 
63 	/* re-direct the call to CI's call */
64 	return (IBTL_CHAN2CIHCAOPS_P(ud_chan)->ibc_attach_mcg(
65 	    IBTL_CHAN2CIHCA(ud_chan), ud_chan->ch_qp.qp_ibc_qp_hdl,
66 	    mcg_info->mc_adds_vect.av_dgid, mcg_info->mc_adds_vect.av_dlid));
67 }
68 
69 
70 /*
71  * Function:
72  *	ibt_detach_mcg
73  * Input:
74  *	ud_chan		A channel handle returned from ibt_alloc_ud_channel().
75  *			This is the UD channel handle, that is to be used to
76  *			receive data sent to the multicast group.
77  *
78  *	mcg_info	A pointer to an ibt_mcg_info_t struct returned from an
79  *			ibt_join_mcg() or ibt_query_mcg() call, that identifies
80  *			the multicast group to detach this channel from.
81  * Output:
82  *	none.
83  * Returns:
84  *	IBT_CHAN_SRV_TYPE_INVALID
85  *	Return value as of ibc_detach_mcg() call.
86  * Description:
87  *	Detach the specified UD channel from the specified multicast group.
88  */
89 ibt_status_t
90 ibt_detach_mcg(ibt_channel_hdl_t ud_chan, ibt_mcg_info_t *mcg_info)
91 {
92 	IBTF_DPRINTF_L3(ibtl_mcg, "ibt_detach_mcg(%p, %p", ud_chan, mcg_info);
93 
94 	/* re-direct the call to CI's call */
95 	return (IBTL_CHAN2CIHCAOPS_P(ud_chan)->ibc_detach_mcg(
96 	    IBTL_CHAN2CIHCA(ud_chan), ud_chan->ch_qp.qp_ibc_qp_hdl,
97 	    mcg_info->mc_adds_vect.av_dgid, mcg_info->mc_adds_vect.av_dlid));
98 }
99