14703Shiremath /* 24703Shiremath * CDDL HEADER START 34703Shiremath * 44703Shiremath * The contents of this file are subject to the terms of the 54703Shiremath * Common Development and Distribution License (the "License"). 64703Shiremath * You may not use this file except in compliance with the License. 74703Shiremath * 84703Shiremath * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 94703Shiremath * or http://www.opensolaris.org/os/licensing. 104703Shiremath * See the License for the specific language governing permissions 114703Shiremath * and limitations under the License. 124703Shiremath * 134703Shiremath * When distributing Covered Code, include this CDDL HEADER in each 144703Shiremath * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 154703Shiremath * If applicable, add the following below this CDDL HEADER, with the 164703Shiremath * fields enclosed by brackets "[]" replaced with your own identifying 174703Shiremath * information: Portions Copyright [yyyy] [name of copyright owner] 184703Shiremath * 194703Shiremath * CDDL HEADER END 204703Shiremath */ 214703Shiremath /* 2212163SRamaswamy.Tummala@Sun.COM * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 234703Shiremath */ 244703Shiremath 254703Shiremath #ifndef _SYS_IB_MGT_IBCM_IBCM_ARP_H 264703Shiremath #define _SYS_IB_MGT_IBCM_IBCM_ARP_H 274703Shiremath 284703Shiremath #ifdef __cplusplus 294703Shiremath extern "C" { 304703Shiremath #endif 314703Shiremath 324703Shiremath #include <sys/ib/mgt/ibcm/ibcm_impl.h> 334703Shiremath #include <sys/ib/clients/ibd/ibd.h> 349349SShantkumar.Hiremath@Sun.COM #include <inet/ip2mac.h> 359349SShantkumar.Hiremath@Sun.COM #include <inet/ip6.h> 364703Shiremath 374703Shiremath #define IBCM_ARP_MAX_IFNAME_LEN 24 384703Shiremath 399349SShantkumar.Hiremath@Sun.COM #define IBCM_H2N_GID(gid) \ 409349SShantkumar.Hiremath@Sun.COM { \ 419349SShantkumar.Hiremath@Sun.COM uint32_t *ptr; \ 429349SShantkumar.Hiremath@Sun.COM ptr = (uint32_t *)&gid.gid_prefix; \ 439349SShantkumar.Hiremath@Sun.COM gid.gid_prefix = (uint64_t)(((uint64_t)ntohl(ptr[0]) << 32) | \ 449349SShantkumar.Hiremath@Sun.COM (ntohl(ptr[1]))); \ 459349SShantkumar.Hiremath@Sun.COM ptr = (uint32_t *)&gid.gid_guid; \ 469349SShantkumar.Hiremath@Sun.COM gid.gid_guid = (uint64_t)(((uint64_t)ntohl(ptr[0]) << 32) | \ 479349SShantkumar.Hiremath@Sun.COM (ntohl(ptr[1]))); \ 489349SShantkumar.Hiremath@Sun.COM } 499349SShantkumar.Hiremath@Sun.COM 509349SShantkumar.Hiremath@Sun.COM #define IBCM_ARP_PR_RT_PENDING 0x01 519349SShantkumar.Hiremath@Sun.COM #define IBCM_ARP_PR_RESOLVE_PENDING 0x02 524703Shiremath 534703Shiremath /* 544703Shiremath * Path record wait queue node definition 554703Shiremath */ 564703Shiremath typedef struct ibcm_arp_prwqn { 5711042SErik.Nordmark@Sun.COM struct ibcm_arp_streams_s *ib_str; 584703Shiremath uint8_t flags; 594703Shiremath ibt_ip_addr_t usrc_addr; /* user supplied src address */ 604703Shiremath ibt_ip_addr_t dst_addr; /* user supplied dest address */ 614703Shiremath ibt_ip_addr_t src_addr; /* rts's view of src address */ 629349SShantkumar.Hiremath@Sun.COM ibt_ip_addr_t gateway; /* rts returned gateway addr */ 639349SShantkumar.Hiremath@Sun.COM ibt_ip_addr_t netmask; /* rts returned netmask */ 644703Shiremath char ifname[IBCM_ARP_MAX_IFNAME_LEN]; 654703Shiremath uint16_t ifproto; 664703Shiremath ipoib_mac_t src_mac; 674703Shiremath ipoib_mac_t dst_mac; 684703Shiremath ib_gid_t sgid; 694703Shiremath ib_gid_t dgid; 709349SShantkumar.Hiremath@Sun.COM ip2mac_id_t ip2mac_id; 714703Shiremath } ibcm_arp_prwqn_t; 724703Shiremath 734703Shiremath typedef struct ibcm_arp_streams_s { 744703Shiremath kmutex_t lock; 754703Shiremath kcondvar_t cv; 764703Shiremath int status; 775752Shiremath boolean_t done; 784703Shiremath ibcm_arp_prwqn_t *wqnp; 794703Shiremath } ibcm_arp_streams_t; 804703Shiremath 814703Shiremath typedef struct ibcm_arp_ip_s { 8212163SRamaswamy.Tummala@Sun.COM datalink_id_t ip_linkid; 834703Shiremath ib_pkey_t ip_pkey; 844703Shiremath ib_guid_t ip_hca_guid; 854703Shiremath ib_gid_t ip_port_gid; 864703Shiremath sa_family_t ip_inet_family; 874703Shiremath union { 884703Shiremath struct sockaddr_in ip_sockaddr; 894703Shiremath struct sockaddr_in6 ip_sockaddr6; 904703Shiremath } ip_sin; 914703Shiremath #define ip_cm_sin ip_sin.ip_sockaddr 924703Shiremath #define ip_cm_sin6 ip_sin.ip_sockaddr6 93*12965SWilliam.Taylor@Oracle.COM zoneid_t ip_zoneid; 944703Shiremath } ibcm_arp_ip_t; 954703Shiremath 964703Shiremath typedef struct ibcm_arp_ibd_insts_s { 974703Shiremath uint8_t ibcm_arp_ibd_alloc; 984703Shiremath uint8_t ibcm_arp_ibd_cnt; 994703Shiremath ibcm_arp_ip_t *ibcm_arp_ip; 1004703Shiremath } ibcm_arp_ibd_insts_t; 1014703Shiremath 10211951SShantkumar.Hiremath@Sun.COM ibt_status_t ibcm_arp_get_ibaddr(zoneid_t zoneid, ibt_ip_addr_t srcip, 10311951SShantkumar.Hiremath@Sun.COM ibt_ip_addr_t destip, ib_gid_t *sgid, ib_gid_t *dgid, 10411951SShantkumar.Hiremath@Sun.COM ibt_ip_addr_t *saddr_p); 1059349SShantkumar.Hiremath@Sun.COM ibt_status_t ibcm_arp_get_ibds(ibcm_arp_ibd_insts_t *ibdp, sa_family_t fam); 10612163SRamaswamy.Tummala@Sun.COM void ibcm_arp_free_ibds(ibcm_arp_ibd_insts_t *ibds); 1074703Shiremath 1084703Shiremath #ifdef __cplusplus 1094703Shiremath } 1104703Shiremath #endif 1114703Shiremath 1124703Shiremath #endif /* _SYS_IB_MGT_IBCM_IBCM_ARP_H */ 113