ibcm_arp.c revision bbd6719318c24a8a2364080d8a139444e9944311
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * CDDL HEADER START
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * The contents of this file are subject to the terms of the
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Common Development and Distribution License (the "License").
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * You may not use this file except in compliance with the License.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * or http://www.opensolaris.org/os/licensing.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * See the License for the specific language governing permissions
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * and limitations under the License.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * When distributing Covered Code, include this CDDL HEADER in each
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * If applicable, add the following below this CDDL HEADER, with the
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * fields enclosed by brackets "[]" replaced with your own identifying
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * information: Portions Copyright [yyyy] [name of copyright owner]
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * CDDL HEADER END
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Use is subject to license terms.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#pragma ident "%Z%%M% %I% %E% SMI"
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/types.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/ddi.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/sunddi.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/stropts.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/stream.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/strsun.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/strsubr.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/socket.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/stat.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <net/if_arp.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/file.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/sockio.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/pathname.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <inet/arp.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/modctl.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/ib/mgt/ibcm/ibcm_arp.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/kstr.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/tiuser.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/t_kuser.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathextern char cmlog[];
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathextern int ibcm_arp_pr_lookup(ibcm_arp_streams_t *ib_s, ibt_ip_addr_t *dst_addr,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibt_ip_addr_t *src_addr, uint8_t localroute, uint32_t bound_dev_if,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_pr_comp_func_t func);
015f8fff605f2fbd5fd0072e555576297804d57bhiremathextern void ibcm_arp_pr_arp_ack(mblk_t *mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremathextern void ibcm_arp_prwqn_delete(ibcm_arp_prwqn_t *wqnp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", datab))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", ibt_ip_addr_s))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", ibcm_arp_ip_t))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", ibcm_arp_ibd_insts_t))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", ibcm_arp_prwqn_t))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", iocblk))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", msgb))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", queue))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", sockaddr_in))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", sockaddr_in6))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * ibcm_arp_get_ibaddr_cb
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_get_ibaddr_cb(void *arg, int status)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_prwqn_t *wqnp = (ibcm_arp_prwqn_t *)arg;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_streams_t *ib_s = (ibcm_arp_streams_t *)wqnp->arg;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_get_ibaddr_cb(ib_s: %p wqnp: %p)",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_s, wqnp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mutex_enter(&ib_s->lock);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_s->status = status;
bbd6719318c24a8a2364080d8a139444e9944311hiremath ib_s->done = B_TRUE;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L3(cmlog, "ibcm_arp_get_ibaddr_cb: SGID %llX:%llX "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "DGID: %llX:%llX", wqnp->sgid.gid_prefix, wqnp->sgid.gid_guid,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath wqnp->dgid.gid_prefix, wqnp->dgid.gid_guid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath /* lock is held by the caller. */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath cv_signal(&ib_s->cv);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mutex_exit(&ib_s->lock);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Lower read service procedure (messages coming back from arp/ip).
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Process messages based on queue type.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_lrsrv(queue_t *q)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mblk_t *mp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_streams_t *ib_s = q->q_ptr;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_lrsrv(%p, ibd_s: 0x%p)", q, ib_s);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (WR(q) == ib_s->arpqueue) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath while (mp = getq(q)) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_pr_arp_ack(mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath } else {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath freemsg(mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Lower write service procedure.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Used when lower streams are flow controlled.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_lwsrv(queue_t *q)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mblk_t *mp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_lwsrv(%p)", q);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath while (mp = getq(q)) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (canputnext(q)) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath putnext(q, mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath } else {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) putbq(q, mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath qenable(q);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath break;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Lower read put procedure. Arp/ip messages come here.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_lrput(queue_t *q, mblk_t *mp)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_lrput(0x%p, db_type: %d)",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath q, DB_TYPE(mp));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath switch (DB_TYPE(mp)) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath case M_FLUSH:
015f8fff605f2fbd5fd0072e555576297804d57bhiremath /*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Turn around
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (*mp->b_rptr & FLUSHW) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *mp->b_rptr &= ~FLUSHR;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath qreply(q, mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath freemsg(mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath break;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath case M_IOCACK:
015f8fff605f2fbd5fd0072e555576297804d57bhiremath case M_IOCNAK:
015f8fff605f2fbd5fd0072e555576297804d57bhiremath case M_DATA:
015f8fff605f2fbd5fd0072e555576297804d57bhiremath /*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * This could be in interrupt context.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Some of the ibt calls cannot be called in
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * interrupt context, so
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * put it in the queue and the message will be
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * processed by service proccedure
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) putq(q, mp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath qenable(q);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath break;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath default:
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L2(cmlog, "ibcm_arp_lrput: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "got unknown msg <0x%x>\n", mp->b_datap->db_type);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ASSERT(0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath break;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Streams write queue module info
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic struct module_info ibcm_arp_winfo = {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath 0, /* module ID number */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "ibcm", /* module name */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath 0, /* min packet size */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath INFPSZ,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath 49152, /* STREAM queue high water mark -- 49152 */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath 12 /* STREAM queue low water mark -- 12 */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath};
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Streams lower write queue, for ibcm/ip requests.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic struct qinit ibcm_arp_lwinit = {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* qi_putp */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_lwsrv, /* qi_srvp */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* qi_qopen */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* qi_qclose */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* qi_qadmin */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath &ibcm_arp_winfo, /* module info */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* module statistics struct */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath STRUIOT_NONE /* stream uio type is standard uiomove() */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath};
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Streams lower read queue: read reply messages from ibcm/ip.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic struct qinit ibcm_arp_lrinit = {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_lrput, /* qi_putp */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_lrsrv, /* qi_srvp */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* qi_qopen */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* qi_qclose */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* qi_qadmin */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath &ibcm_arp_winfo, /* module info */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL, /* module statistics struct */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath STRUIOT_NONE /* stream uio type is standard uiomove() */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath};
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_link_driver(ibcm_arp_streams_t *ib_s, char *path, queue_t **q,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath vnode_t **dev_vp)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath struct stdata *dev_stp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath vnode_t *vp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int error;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath queue_t *rq;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_link_driver: Enter: %s", path);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath /* open the driver from inside the kernel */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath error = vn_open(path, UIO_SYSSPACE, FREAD|FWRITE, 0, &vp,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath 0, NULL);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (error) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L2(cmlog, "ibcm_arp_link_driver: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "vn_open('%s') failed\n", path);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (error);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *dev_vp = vp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath dev_stp = vp->v_stream;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *q = dev_stp->sd_wrq;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath VN_HOLD(vp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath rq = RD(dev_stp->sd_wrq);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath RD(rq)->q_ptr = WR(rq)->q_ptr = ib_s;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath setq(rq, &ibcm_arp_lrinit, &ibcm_arp_lwinit, NULL, QMTSAFE,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath SQ_CI|SQ_CO, B_FALSE);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathextern struct qinit strdata;
015f8fff605f2fbd5fd0072e555576297804d57bhiremathextern struct qinit stwdata;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Unlink ip, ibcm, icmp6 drivers
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/* ARGSUSED */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_unlink_driver(queue_t **q, vnode_t **dev_vp)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath vnode_t *vp = *dev_vp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath struct stdata *dev_stp = vp->v_stream;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath queue_t *wrq, *rq;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int rc;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_unlink_driver: Enter: 0x%p", q);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath wrq = dev_stp->sd_wrq;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath rq = RD(wrq);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath disable_svc(rq);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath wait_svc(rq);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath flushq(rq, FLUSHALL);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath flushq(WR(rq), FLUSHALL);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath rq->q_ptr = wrq->q_ptr = dev_stp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath setq(rq, &strdata, &stwdata, NULL, QMTSAFE, SQ_CI|SQ_CO, B_TRUE);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if ((rc = VOP_CLOSE(vp, FREAD, 1, (offset_t)0, CRED(), NULL)) != 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L2(cmlog, "ibcm_arp_unlink_driver: VOP_CLOSE "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "failed %d\n", rc);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath vn_rele(vp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_unlink_drivers(ibcm_arp_streams_t *ib_s)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_unlink_drivers(%p)", ib_s);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ib_s->arpqueue) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) ibcm_arp_unlink_driver(&ib_s->arpqueue, &ib_s->arp_vp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Link ip, ibtl drivers below ibtl
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_link_drivers(ibcm_arp_streams_t *ib_s)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int rc;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_link_drivers(%p)", ib_s);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if ((rc = ibcm_arp_link_driver(ib_s, "/dev/arp", &ib_s->arpqueue,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath &ib_s->arp_vp)) != 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L2(cmlog, "ibcm_arp_link_drivers: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "ibcm_arp_link_driver failed: %d\n", rc);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (rc);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibt_status_t
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_get_ibaddr(ipaddr_t srcip, ipaddr_t destip, ib_gid_t *sgid,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_gid_t *dgid)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_streams_t *ib_s;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibt_ip_addr_t srcaddr, destaddr;
bbd6719318c24a8a2364080d8a139444e9944311hiremath int ret = 0;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_get_ibaddr(%lX, %lX, %p, %p)",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath htonl(srcip), htonl(destip), sgid, dgid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_s = (ibcm_arp_streams_t *)kmem_zalloc(sizeof (ibcm_arp_streams_t),
015f8fff605f2fbd5fd0072e555576297804d57bhiremath KM_SLEEP);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mutex_init(&ib_s->lock, NULL, MUTEX_DEFAULT, NULL);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath cv_init(&ib_s->cv, NULL, CV_DRIVER, NULL);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ret = ibcm_arp_link_drivers(ib_s);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ret != 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L3(cmlog, "ibcm_arp_get_ibaddr: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "ibcm_arp_link_drivers failed %d", ret);
bbd6719318c24a8a2364080d8a139444e9944311hiremath goto arp_ibaddr_error;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bzero(&destaddr, sizeof (ibt_ip_addr_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bzero(&srcaddr, sizeof (ibt_ip_addr_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
bbd6719318c24a8a2364080d8a139444e9944311hiremath mutex_enter(&ib_s->lock);
bbd6719318c24a8a2364080d8a139444e9944311hiremath ib_s->done = B_FALSE;
bbd6719318c24a8a2364080d8a139444e9944311hiremath mutex_exit(&ib_s->lock);
bbd6719318c24a8a2364080d8a139444e9944311hiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath destaddr.family = AF_INET_OFFLOAD;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath destaddr.un.ip4addr = htonl(destip);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath srcaddr.family = AF_INET_OFFLOAD;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath srcaddr.un.ip4addr = htonl(srcip);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L3(cmlog, "ibcm_arp_get_ibaddr: SrcIP %lX, DstIP %lX",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath srcaddr.un.ip4addr, destaddr.un.ip4addr);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ret = ibcm_arp_pr_lookup(ib_s, &destaddr, &srcaddr, 0, NULL,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_get_ibaddr_cb);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L3(cmlog, "ibcm_arp_get_ibaddr: ibcm_arp_pr_lookup "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "returned: %d", ret);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ret == 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mutex_enter(&ib_s->lock);
bbd6719318c24a8a2364080d8a139444e9944311hiremath while (ib_s->done != B_TRUE)
bbd6719318c24a8a2364080d8a139444e9944311hiremath cv_wait(&ib_s->cv, &ib_s->lock);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mutex_exit(&ib_s->lock);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) ibcm_arp_unlink_drivers(ib_s);
bbd6719318c24a8a2364080d8a139444e9944311hiremath mutex_enter(&ib_s->lock);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ret = ib_s->status;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ret == 0) {
bbd6719318c24a8a2364080d8a139444e9944311hiremath ibcm_arp_prwqn_t *wqnp = ib_s->wqnp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (sgid)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *sgid = ib_s->wqnp->sgid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (dgid)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *dgid = ib_s->wqnp->dgid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_get_ibaddr: SGID: %llX:%llX"
015f8fff605f2fbd5fd0072e555576297804d57bhiremath " DGID: %llX:%llX",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_s->wqnp->sgid.gid_prefix, ib_s->wqnp->sgid.gid_guid,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_s->wqnp->dgid.gid_prefix, ib_s->wqnp->dgid.gid_guid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
bbd6719318c24a8a2364080d8a139444e9944311hiremath mutex_exit(&ib_s->lock);
bbd6719318c24a8a2364080d8a139444e9944311hiremath ibcm_arp_prwqn_delete(wqnp);
bbd6719318c24a8a2364080d8a139444e9944311hiremath mutex_enter(&ib_s->lock);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
bbd6719318c24a8a2364080d8a139444e9944311hiremath mutex_exit(&ib_s->lock);
bbd6719318c24a8a2364080d8a139444e9944311hiremath
bbd6719318c24a8a2364080d8a139444e9944311hirematharp_ibaddr_error:
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath mutex_destroy(&ib_s->lock);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath cv_destroy(&ib_s->cv);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath kmem_free(ib_s, sizeof (ibcm_arp_streams_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ret)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (IBT_FAILURE);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath else
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (IBT_SUCCESS);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Routine to get list of "local" IP-ADDR to GID/P_KEY mapping information.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Optionally, if "gid" and/or "p_key" info are specified, then retrieve the
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * IP-ADDR info for that attribute only.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic ibcm_arp_ip_t *
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_ibd_gid2mac(ib_gid_t *gid, ib_pkey_t pkey, ibcm_arp_ibd_insts_t *ibdp)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ip_t *ipp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int i;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath for (i = 0, ipp = ibdp->ibcm_arp_ip; i < ibdp->ibcm_arp_ibd_cnt;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath i++, ipp++) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if ((ipp->ip_port_gid.gid_prefix == gid->gid_prefix) &&
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (ipp->ip_port_gid.gid_guid == gid->gid_guid)) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (pkey) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ipp->ip_pkey == pkey)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (ipp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath else
015f8fff605f2fbd5fd0072e555576297804d57bhiremath continue;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (ipp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (NULL);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic ibt_status_t
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_ibd_mac2gid(ibcm_arp_ibd_insts_t *ibdp, ipaddr_t srcip,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_gid_t *sgid)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ip_t *ipp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int i;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath for (i = 0, ipp = ibdp->ibcm_arp_ip; i < ibdp->ibcm_arp_ibd_cnt;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath i++, ipp++) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_ibd_mac2gid: Is %lX == %lX "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "GID %llX:%llX", srcip, ipp->ip_cm_sin.sin_addr,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp->ip_port_gid.gid_prefix, ipp->ip_port_gid.gid_guid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (bcmp(&srcip, &ipp->ip_cm_sin.sin_addr, sizeof (in_addr_t))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath == 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath *sgid = ipp->ip_port_gid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_ibd_mac2gid: Found "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "GID %llX:%llX", sgid->gid_prefix, sgid->gid_guid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (IBT_SUCCESS);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L3(cmlog, "ibcm_arp_ibd_mac2gid: Matching SRC info "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "NOT Found");
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (IBT_SRC_IP_NOT_FOUND);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_get_ibd_insts_cb(dev_info_t *dip, void *arg)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ibd_insts_t *ibds = (ibcm_arp_ibd_insts_t *)arg;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ip_t *ipp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_pkey_t pkey;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath uint8_t port;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_guid_t hca_guid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_gid_t port_gid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (i_ddi_devi_attached(dip) &&
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (strcmp(ddi_node_name(dip), "ibport") == 0) &&
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (strstr(ddi_get_name_addr(dip), "ipib") != NULL)) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ibds->ibcm_arp_ibd_cnt >= ibds->ibcm_arp_ibd_alloc) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ip_t *tmp = NULL;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int new_count = 0;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath new_count = ibds->ibcm_arp_ibd_alloc +
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBCM_ARP_IBD_INSTANCES;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath tmp = (ibcm_arp_ip_t *)kmem_zalloc(
015f8fff605f2fbd5fd0072e555576297804d57bhiremath new_count * sizeof (ibcm_arp_ip_t), KM_SLEEP);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bcopy(ibds->ibcm_arp_ip, tmp,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds->ibcm_arp_ibd_alloc * sizeof (ibcm_arp_ip_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath kmem_free(ibds->ibcm_arp_ip,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds->ibcm_arp_ibd_alloc * sizeof (ibcm_arp_ip_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds->ibcm_arp_ibd_alloc = new_count;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds->ibcm_arp_ip = tmp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (((hca_guid = ddi_prop_get_int64(DDI_DEV_T_ANY, dip, 0,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "hca-guid", 0)) == 0) ||
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ((port = ddi_prop_get_int(DDI_DEV_T_ANY, dip, 0,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "port-number", 0)) == 0) ||
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (ibt_get_port_state_byguid(hca_guid, port, &port_gid,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath NULL) != IBT_SUCCESS) ||
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ((pkey = ddi_prop_get_int(DDI_DEV_T_ANY, dip, 0,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "port-pkey", IB_PKEY_INVALID_LIMITED)) <=
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IB_PKEY_INVALID_FULL)) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (DDI_WALK_CONTINUE);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp = &ibds->ibcm_arp_ip[ibds->ibcm_arp_ibd_cnt];
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp->ip_inst = ddi_get_instance(dip);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp->ip_pkey = pkey;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp->ip_hca_guid = hca_guid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp->ip_port_gid = port_gid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds->ibcm_arp_ibd_cnt++;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (DDI_WALK_CONTINUE);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic void
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_get_ibd_insts(ibcm_arp_ibd_insts_t *ibds)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ddi_walk_devs(ddi_root_node(), ibcm_arp_get_ibd_insts_cb, ibds);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Return ibd interfaces and ibd instances.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_get_ibd_ipaddr(ibcm_arp_ibd_insts_t *ibds)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath TIUSER *tiptr;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath vnode_t *kvp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath vnode_t *vp = NULL;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath struct strioctl iocb;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath struct lifreq lif_req;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int k, ip_cnt;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ip_t *ipp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (lookupname("/dev/udp", UIO_SYSSPACE, FOLLOW, NULLVPP, &kvp) == 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (t_kopen((file_t *)NULL, kvp->v_rdev, FREAD|FWRITE,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath &tiptr, CRED()) == 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath vp = tiptr->fp->f_vnode;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath } else {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath VN_RELE(kvp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (vp == NULL)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (-1);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath /* Get ibd ip's */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ip_cnt = 0;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath for (k = 0, ipp = ibds->ibcm_arp_ip; k < ibds->ibcm_arp_ibd_cnt;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath k++, ipp++) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) bzero((void *)&lif_req, sizeof (struct lifreq));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) snprintf(lif_req.lifr_name, sizeof (lif_req.lifr_name),
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "%s%d", IBCM_ARP_IBD_NAME, ipp->ip_inst);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) bzero((void *)&iocb, sizeof (struct strioctl));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath iocb.ic_cmd = SIOCGLIFADDR;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath iocb.ic_timout = 0;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath iocb.ic_len = sizeof (struct lifreq);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath iocb.ic_dp = (caddr_t)&lif_req;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (kstr_ioctl(vp, I_STR, (intptr_t)&iocb) == 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp->ip_inet_family = AF_INET;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bcopy(&lif_req.lifr_addr, &ipp->ip_cm_sin,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath sizeof (struct sockaddr_in));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ip_cnt++;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath continue;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath (void) t_kclose(tiptr, 0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath VN_RELE(kvp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ip_cnt == 0)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (-1);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath else
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibt_status_t
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_get_ibds(ibcm_arp_ibd_insts_t *ibdp)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_get_ibds(%p)", ibdp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_get_ibd_insts(ibdp);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L3(cmlog, "ibcm_arp_get_ibds: Found %d ibd instances",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibdp->ibcm_arp_ibd_cnt);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ibdp->ibcm_arp_ibd_cnt == 0)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (IBT_SRC_IP_NOT_FOUND);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath /* Get the IP addresses of active ports. */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ibcm_arp_get_ibd_ipaddr(ibdp) != 0) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L2(cmlog, "ibcm_arp_get_ibds: failed to get "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "ibd instance: IBT_SRC_IP_NOT_FOUND");
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (IBT_SRC_IP_NOT_FOUND);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (IBT_SUCCESS);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath_NOTE(SCHEME_PROTECTS_DATA("Unshared data", ibtl_cm_port_list_t))
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibt_status_t
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_get_srcip_plist(ibt_ip_path_attr_t *ipattr, ibt_path_flags_t flags,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibtl_cm_port_list_t **port_list_p)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibt_path_attr_t attr;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibt_status_t ret;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ibd_insts_t ibds;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ip_t *ipp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibtl_cm_port_list_t *plistp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_gid_t sgid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_get_srcip_plist(%p, %llX)",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipattr, flags);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath sgid.gid_prefix = sgid.gid_guid = 0;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bzero(&ibds, sizeof (ibcm_arp_ibd_insts_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds.ibcm_arp_ibd_alloc = IBCM_ARP_IBD_INSTANCES;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds.ibcm_arp_ibd_cnt = 0;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds.ibcm_arp_ip = (ibcm_arp_ip_t *)kmem_zalloc(
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibds.ibcm_arp_ibd_alloc * sizeof (ibcm_arp_ip_t), KM_SLEEP);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ret = ibcm_arp_get_ibds(&ibds);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ret != IBT_SUCCESS) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L2(cmlog, "ibcm_arp_get_srcip_plist: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "ibcm_arp_get_ibds failed : 0x%x", ret);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath goto srcip_plist_end;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ipattr->ipa_src_ip.family != AF_UNSPEC) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ret = ibcm_arp_ibd_mac2gid(&ibds,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath htonl(ipattr->ipa_src_ip.un.ip4addr), &sgid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ret != IBT_SUCCESS) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L2(cmlog, "ibcm_arp_get_srcip_plist: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "SGID for the specified SRCIP Not found %X", ret);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath goto srcip_plist_end;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog, "ibcm_arp_get_srcip_plist: SGID "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "%llX:%llX", sgid.gid_prefix, sgid.gid_guid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bzero(&attr, sizeof (ibt_path_attr_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath attr.pa_hca_guid = ipattr->ipa_hca_guid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath attr.pa_hca_port_num = ipattr->ipa_hca_port_num;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath attr.pa_sgid = sgid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bcopy(&ipattr->ipa_mtu, &attr.pa_mtu, sizeof (ibt_mtu_req_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bcopy(&ipattr->ipa_srate, &attr.pa_srate, sizeof (ibt_srate_req_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bcopy(&ipattr->ipa_pkt_lt, &attr.pa_pkt_lt, sizeof (ibt_pkt_lt_req_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ret = ibtl_cm_get_active_plist(&attr, flags, port_list_p);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ret == IBT_SUCCESS) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int i;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath plistp = port_list_p[0];
015f8fff605f2fbd5fd0072e555576297804d57bhiremath for (i = 0; i < plistp->p_count; i++, plistp++) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipp = ibcm_arp_ibd_gid2mac(&plistp->p_sgid, 0, &ibds);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ipp == NULL)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath plistp->p_src_ip.family = AF_UNSPEC;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath else {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "ibcm_arp_get_srcip_plist: GID %llX:%llX",
015f8fff605f2fbd5fd0072e555576297804d57bhiremath plistp->p_sgid.gid_prefix,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath plistp->p_sgid.gid_guid);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ipp->ip_inet_family == AF_INET) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath plistp->p_src_ip.family = AF_INET;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bcopy(&ipp->ip_cm_sin.sin_addr,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath &plistp->p_src_ip.un.ip4addr,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath sizeof (in_addr_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L4(cmlog,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "ibcm_arp_get_srcip_plist: SrcIP: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "%lX", plistp->p_src_ip.un.ip4addr);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath } else if (ipp->ip_inet_family == AF_INET6) {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath plistp->p_src_ip.family = AF_INET6;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath bcopy(&ipp->ip_cm_sin6.sin6_addr,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath &plistp->p_src_ip.un.ip6addr,
015f8fff605f2fbd5fd0072e555576297804d57bhiremath sizeof (in6_addr_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath }
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathsrcip_plist_end:
015f8fff605f2fbd5fd0072e555576297804d57bhiremath if (ibds.ibcm_arp_ip)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath kmem_free(ibds.ibcm_arp_ip, ibds.ibcm_arp_ibd_alloc *
015f8fff605f2fbd5fd0072e555576297804d57bhiremath sizeof (ibcm_arp_ip_t));
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (ret);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/* Routines for warlock */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/* ARGSUSED */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathstatic int
015f8fff605f2fbd5fd0072e555576297804d57bhiremathibcm_arp_dummy_ibaddr_hdl(void *arg, int status)
015f8fff605f2fbd5fd0072e555576297804d57bhiremath{
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_prwqn_t dummy_wqn1;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_prwqn_t dummy_wqn2;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath dummy_wqn1.func = ibcm_arp_get_ibaddr_cb;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath dummy_wqn2.func = ibcm_arp_dummy_ibaddr_hdl;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath IBTF_DPRINTF_L5(cmlog, "ibcm_arp_dummy_ibaddr_hdl: "
015f8fff605f2fbd5fd0072e555576297804d57bhiremath "dummy_wqn1.func %p %p", dummy_wqn1.func, dummy_wqn2.func);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath return (0);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}