ibcm_arp.c revision 03494a9880d80f834bec10a1e8f0a2f8f7c97bf4
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <net/if_types.h>
#include <sys/pathname.h>
extern char cmlog[];
/*
* ibcm_arp_get_ibaddr_cb
*/
static int
{
/* lock is held by the caller. */
return (0);
}
/*
* Process messages based on queue type.
*/
static int
{
}
}
return (0);
}
/*
* Lower write service procedure.
* Used when lower streams are flow controlled.
*/
static int
{
if (canputnext(q)) {
} else {
qenable(q);
break;
}
}
return (0);
}
/*
*/
static int
{
case M_FLUSH:
/*
* Turn around
*/
return (0);
}
break;
case M_IOCACK:
case M_IOCNAK:
case M_DATA:
/*
* This could be in interrupt context.
* Some of the ibt calls cannot be called in
* interrupt context, so
* put it in the queue and the message will be
* processed by service proccedure
*/
qenable(q);
break;
default:
ASSERT(0);
break;
}
return (0);
}
/*
* Streams write queue module info
*/
static struct module_info ibcm_arp_winfo = {
0, /* module ID number */
"ibcm", /* module name */
0, /* min packet size */
49152, /* STREAM queue high water mark -- 49152 */
12 /* STREAM queue low water mark -- 12 */
};
/*
*/
static struct qinit ibcm_arp_lwinit = {
NULL, /* qi_putp */
ibcm_arp_lwsrv, /* qi_srvp */
NULL, /* qi_qopen */
NULL, /* qi_qclose */
NULL, /* qi_qadmin */
&ibcm_arp_winfo, /* module info */
NULL, /* module statistics struct */
NULL,
NULL,
STRUIOT_NONE /* stream uio type is standard uiomove() */
};
/*
*/
static struct qinit ibcm_arp_lrinit = {
ibcm_arp_lrput, /* qi_putp */
ibcm_arp_lrsrv, /* qi_srvp */
NULL, /* qi_qopen */
NULL, /* qi_qclose */
NULL, /* qi_qadmin */
&ibcm_arp_winfo, /* module info */
NULL, /* module statistics struct */
NULL,
NULL,
STRUIOT_NONE /* stream uio type is standard uiomove() */
};
static int
{
int error;
/* open the driver from inside the kernel */
0, NULL);
if (error) {
"vn_open('%s') failed\n", path);
return (error);
}
return (0);
}
/*
* Unlink ip, ibcm, icmp6 drivers
*/
/* ARGSUSED */
static int
{
int rc;
"failed %d\n", rc);
}
return (0);
}
static int
{
}
return (0);
}
/*
* Link ip, ibtl drivers below ibtl
*/
static int
{
int rc;
"ibcm_arp_link_driver failed: %d\n", rc);
return (rc);
}
return (0);
}
{
int ret = 0;
KM_SLEEP);
if (ret != 0) {
"ibcm_arp_link_drivers failed %d", ret);
goto arp_ibaddr_error;
}
"returned: %d", ret);
if (ret == 0) {
}
(void) ibcm_arp_unlink_drivers(ib_s);
if (ret == 0) {
if (sgid)
if (dgid)
" DGID: %llX:%llX",
}
if (ret)
return (IBT_FAILURE);
else
return (IBT_SUCCESS);
}
/*
* IP-ADDR info for that attribute only.
*/
static ibcm_arp_ip_t *
{
int i;
i++, ipp++) {
if (pkey) {
return (ipp);
else
continue;
}
return (ipp);
}
}
return (NULL);
}
static ibt_status_t
{
int i;
i++, ipp++) {
== 0) {
return (IBT_SUCCESS);
}
}
"NOT Found");
return (IBT_SRC_IP_NOT_FOUND);
}
static int
{
if (i_ddi_devi_attached(dip) &&
}
"hca-guid", 0)) == 0) ||
"port-number", 0)) == 0) ||
NULL) != IBT_SUCCESS) ||
"port-pkey", IB_PKEY_INVALID_LIMITED)) <=
return (DDI_WALK_CONTINUE);
}
ibds->ibcm_arp_ibd_cnt++;
}
return (DDI_WALK_CONTINUE);
}
static void
{
}
/*
* Issue an ioctl down to IP. There are several similar versions of this
* function (e.g., rpcib_do_ip_ioctl()); clearly a utility routine is needed.
*/
static int
{
int err = 0;
return (EPROTO);
return (EPROTO);
}
return (err);
}
/*
* Issue an SIOCGLIFCONF down to IP and return the result in `lifcp'.
* lifcp->lifc_buf is dynamically allocated to be *bufsizep bytes.
*/
static int
{
int err;
if (err != 0)
return (err);
/*
* Pad the interface count to account for additional interfaces that
* may have been configured between the SIOCGLIFNUM and SIOCGLIFCONF.
*/
if (err != 0) {
return (err);
}
return (0);
}
/*
* Fill in `ibds' with IP addresses tied to IFT_IB IP interfaces. Returns
* B_TRUE if at least one address was filled in.
*/
static boolean_t
{
return (B_FALSE);
continue;
case AF_INET:
sizeof (struct sockaddr_in));
naddr++;
break;
case AF_INET6:
sizeof (struct sockaddr_in6));
naddr++;
break;
}
}
return (naddr > 0);
}
{
if (ibdp->ibcm_arp_ibd_cnt == 0)
return (IBT_SRC_IP_NOT_FOUND);
/* Get the IP addresses of active ports. */
if (!ibcm_arp_get_ibd_ipaddr(ibdp)) {
"ibd instance: IBT_SRC_IP_NOT_FOUND");
return (IBT_SRC_IP_NOT_FOUND);
}
return (IBT_SUCCESS);
}
{
ibds.ibcm_arp_ibd_cnt = 0;
if (ret != IBT_SUCCESS) {
"ibcm_arp_get_ibds failed : 0x%x", ret);
goto srcip_plist_end;
}
if (ret != IBT_SUCCESS) {
"SGID for the specified SRCIP Not found %X", ret);
goto srcip_plist_end;
}
}
if (ret == IBT_SUCCESS) {
int i;
uint8_t no_srcip_cnt = 0;
plistp = port_list_p[0];
no_srcip_cnt++;
"ibcm_arp_get_srcip_plist: SrcIP NOT "
"Configured for GID %llX:%llX",
} else {
"ibcm_arp_get_srcip_plist: GID %llX:%llX",
sizeof (in_addr_t));
"ibcm_arp_get_srcip_plist: SrcIP: "
sizeof (in6_addr_t));
}
}
}
if (no_srcip_configured == B_TRUE) {
/*
* Looks like some of the SRC GID we found have no
* IP ADDR configured, so remove these entries from
* our list.
*/
plistp = port_list_p[0];
"Only %d SGID (%d/%d) have SrcIP Configured",
if (new_cnt) {
/* Allocate Memory to hold Src Point info. */
sizeof (ibtl_cm_port_list_t), KM_SLEEP);
continue;
sizeof (ibtl_cm_port_list_t));
n_plistp++;
}
plistp = port_list_p[0];
} else {
/*
* All entries we have, do not have IP-Addr
* configured so return empty hand.
*/
"ibcm_arp_get_srcip_plist: None of SGID "
"found have SrcIP Configured");
*port_list_p = NULL;
}
}
}
if (ibds.ibcm_arp_ip)
sizeof (ibcm_arp_ip_t));
return (ret);
}
/* Routines for warlock */
/* ARGSUSED */
static int
{
return (0);
}