74e20cfe817b82802b16fac8690dadcda76f54f5nh * CDDL HEADER START
74e20cfe817b82802b16fac8690dadcda76f54f5nh * The contents of this file are subject to the terms of the
74e20cfe817b82802b16fac8690dadcda76f54f5nh * Common Development and Distribution License (the "License").
74e20cfe817b82802b16fac8690dadcda76f54f5nh * You may not use this file except in compliance with the License.
74e20cfe817b82802b16fac8690dadcda76f54f5nh * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
74e20cfe817b82802b16fac8690dadcda76f54f5nh * See the License for the specific language governing permissions
74e20cfe817b82802b16fac8690dadcda76f54f5nh * and limitations under the License.
74e20cfe817b82802b16fac8690dadcda76f54f5nh * When distributing Covered Code, include this CDDL HEADER in each
74e20cfe817b82802b16fac8690dadcda76f54f5nh * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
74e20cfe817b82802b16fac8690dadcda76f54f5nh * If applicable, add the following below this CDDL HEADER, with the
74e20cfe817b82802b16fac8690dadcda76f54f5nh * fields enclosed by brackets "[]" replaced with your own identifying
74e20cfe817b82802b16fac8690dadcda76f54f5nh * information: Portions Copyright [yyyy] [name of copyright owner]
74e20cfe817b82802b16fac8690dadcda76f54f5nh * CDDL HEADER END
d2b5b2d357ee3172eacb6860be1891259902203dAnders Persson * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
74e20cfe817b82802b16fac8690dadcda76f54f5nh * This is a pseudo driver which creates an entry for /dev/sdp in the device
d2b5b2d357ee3172eacb6860be1891259902203dAnders Persson * tree. A regular installation will end up adding a file to sock2path.d
d2b5b2d357ee3172eacb6860be1891259902203dAnders Persson * announcing support for sdp using AF_INET/SOCK_STREAM/PROTO_SDP parameters in
d2b5b2d357ee3172eacb6860be1891259902203dAnders Persson * socket call. On a non IB hardware, following are the constraints within
d2b5b2d357ee3172eacb6860be1891259902203dAnders Persson * which the sdp project operates. The sdpib driver which is the real driver
74e20cfe817b82802b16fac8690dadcda76f54f5nh * (in terms of moving data) should not be loaded since it has dependency on
74e20cfe817b82802b16fac8690dadcda76f54f5nh * ibcm and ibtl modules which will be loaded in the memory. This will consume
74e20cfe817b82802b16fac8690dadcda76f54f5nh * precious memory and needs to be avoided. As a result the sdpib driver
74e20cfe817b82802b16fac8690dadcda76f54f5nh * should fail its init() call to disallow loading on other modules. Due to
74e20cfe817b82802b16fac8690dadcda76f54f5nh * this we do not get a chance to create a /dev/sdp entry in the device tree
74e20cfe817b82802b16fac8690dadcda76f54f5nh * in the regular sdpib driver. During the boottime, this will cause a warning
74e20cfe817b82802b16fac8690dadcda76f54f5nh * message when soconfig processes the entry for sdp in sock2path file . In
74e20cfe817b82802b16fac8690dadcda76f54f5nh * order to avoid this a pseudo driver is introduced which creates an entry
74e20cfe817b82802b16fac8690dadcda76f54f5nh * for /dev/sdp regardless of the hardware. When a socket call is made on the
74e20cfe817b82802b16fac8690dadcda76f54f5nh * sdp subsystem, the call will end up in this driver, which then forwards
74e20cfe817b82802b16fac8690dadcda76f54f5nh * this call to the real sdp driver. On a non-ib hardware system the call
74e20cfe817b82802b16fac8690dadcda76f54f5nh * will fail
74e20cfe817b82802b16fac8690dadcda76f54f5nh/* open routine. */
74e20cfe817b82802b16fac8690dadcda76f54f5nh/*ARGSUSED*/
74e20cfe817b82802b16fac8690dadcda76f54f5nhsdp_gen_open(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
74e20cfe817b82802b16fac8690dadcda76f54f5nh return (0);
74e20cfe817b82802b16fac8690dadcda76f54f5nh/* open routine. */
74e20cfe817b82802b16fac8690dadcda76f54f5nh/*ARGSUSED*/
74e20cfe817b82802b16fac8690dadcda76f54f5nhsdp_gen_close(queue_t *q, dev_t *devp, int flag, int sflag, cred_t *credp)
74e20cfe817b82802b16fac8690dadcda76f54f5nh return (0);
74e20cfe817b82802b16fac8690dadcda76f54f5nh * Someone beat us to it.
74e20cfe817b82802b16fac8690dadcda76f54f5nh if (ibt_hw_is_present() == 0) {
74e20cfe817b82802b16fac8690dadcda76f54f5nh if (ret != 0) {
74e20cfe817b82802b16fac8690dadcda76f54f5nhstatic void
74e20cfe817b82802b16fac8690dadcda76f54f5nh /* LINTED */
74e20cfe817b82802b16fac8690dadcda76f54f5nh * Check for root privs.
74e20cfe817b82802b16fac8690dadcda76f54f5nh * if not net config privs - return state of system SDP
74e20cfe817b82802b16fac8690dadcda76f54f5nh * The sdpib driver is loaded if root enables sdp the
74e20cfe817b82802b16fac8690dadcda76f54f5nh * first time (sdp_transport_handle is NULL). It is
74e20cfe817b82802b16fac8690dadcda76f54f5nh * unloaded during the following first disable. At all
74e20cfe817b82802b16fac8690dadcda76f54f5nh * other times for root as well as non-root users, the
74e20cfe817b82802b16fac8690dadcda76f54f5nh * action of enabling/disabling sdp is simply acked.
74e20cfe817b82802b16fac8690dadcda76f54f5nh /* Initialize sdpib transport driver */
74e20cfe817b82802b16fac8690dadcda76f54f5nh if (ret != 0) {
74e20cfe817b82802b16fac8690dadcda76f54f5nh /* Transport failed to load */
74e20cfe817b82802b16fac8690dadcda76f54f5nh /* ACK the ioctl */
74e20cfe817b82802b16fac8690dadcda76f54f5nh * Received a put from sockfs. We only support ndd get/set
74e20cfe817b82802b16fac8690dadcda76f54f5nhstatic void
74e20cfe817b82802b16fac8690dadcda76f54f5nh NULL, (pfi_t)NULL, (pfi_t)sdp_gen_open, (pfi_t)sdp_gen_close, NULL,
74e20cfe817b82802b16fac8690dadcda76f54f5nh (pfi_t)sdp_gen_wput, NULL, (pfi_t)sdp_gen_open, (pfi_t)sdp_gen_close,
09cb82ca24006b806e9f17e2135eef96364facfenhDDI_DEFINE_STREAM_OPS(sdp_devops, nulldev, nulldev, sdp_gen_attach,
193974072f41a843678abf5f61979c748687e66bSherry Moore sdp_gen_detach, nodev, NULL, D_MP, &sdpinfo, ddi_quiesce_not_needed);
74e20cfe817b82802b16fac8690dadcda76f54f5nh * Module linkage information for the kernel.
74e20cfe817b82802b16fac8690dadcda76f54f5nh if (ret != 0) {
74e20cfe817b82802b16fac8690dadcda76f54f5nh return (0);