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/*
1cfa752f4e24c34133009b0f6c139127a5c461deRamaswamy Tummala * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#ifndef _SYS_IB_MGT_IBCM_IBCM_ARP_H
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#define _SYS_IB_MGT_IBCM_IBCM_ARP_H
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#ifdef __cplusplus
015f8fff605f2fbd5fd0072e555576297804d57bhiremathextern "C" {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#endif
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/ib/mgt/ibcm/ibcm_impl.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#include <sys/ib/clients/ibd/ibd.h>
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath#include <inet/ip2mac.h>
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath#include <inet/ip6.h>
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#define IBCM_ARP_MAX_IFNAME_LEN 24
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath#define IBCM_H2N_GID(gid) \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath{ \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath uint32_t *ptr; \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath ptr = (uint32_t *)&gid.gid_prefix; \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath gid.gid_prefix = (uint64_t)(((uint64_t)ntohl(ptr[0]) << 32) | \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath (ntohl(ptr[1]))); \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath ptr = (uint32_t *)&gid.gid_guid; \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath gid.gid_guid = (uint64_t)(((uint64_t)ntohl(ptr[0]) << 32) | \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath (ntohl(ptr[1]))); \
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath}
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath#define IBCM_ARP_PR_RT_PENDING 0x01
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath#define IBCM_ARP_PR_RESOLVE_PENDING 0x02
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath/*
015f8fff605f2fbd5fd0072e555576297804d57bhiremath * Path record wait queue node definition
015f8fff605f2fbd5fd0072e555576297804d57bhiremath */
015f8fff605f2fbd5fd0072e555576297804d57bhiremathtypedef struct ibcm_arp_prwqn {
bd670b35a010421b6e1a5536c34453a827007c81Erik Nordmark struct ibcm_arp_streams_s *ib_str;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath uint8_t flags;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibt_ip_addr_t usrc_addr; /* user supplied src address */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibt_ip_addr_t dst_addr; /* user supplied dest address */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibt_ip_addr_t src_addr; /* rts's view of src address */
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath ibt_ip_addr_t gateway; /* rts returned gateway addr */
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath ibt_ip_addr_t netmask; /* rts returned netmask */
015f8fff605f2fbd5fd0072e555576297804d57bhiremath char ifname[IBCM_ARP_MAX_IFNAME_LEN];
015f8fff605f2fbd5fd0072e555576297804d57bhiremath uint16_t ifproto;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipoib_mac_t src_mac;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ipoib_mac_t dst_mac;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_gid_t sgid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_gid_t dgid;
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremath ip2mac_id_t ip2mac_id;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath} ibcm_arp_prwqn_t;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathtypedef struct ibcm_arp_streams_s {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath kmutex_t lock;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath kcondvar_t cv;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath int status;
bbd6719318c24a8a2364080d8a139444e9944311hiremath boolean_t done;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_prwqn_t *wqnp;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath} ibcm_arp_streams_t;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathtypedef struct ibcm_arp_ip_s {
1cfa752f4e24c34133009b0f6c139127a5c461deRamaswamy Tummala datalink_id_t ip_linkid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_pkey_t ip_pkey;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_guid_t ip_hca_guid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ib_gid_t ip_port_gid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath sa_family_t ip_inet_family;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath union {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath struct sockaddr_in ip_sockaddr;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath struct sockaddr_in6 ip_sockaddr6;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath } ip_sin;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#define ip_cm_sin ip_sin.ip_sockaddr
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#define ip_cm_sin6 ip_sin.ip_sockaddr6
17a2b317610f531d565bf4e940433aab2d9e6985Bill Taylor zoneid_t ip_zoneid;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath} ibcm_arp_ip_t;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremathtypedef struct ibcm_arp_ibd_insts_s {
015f8fff605f2fbd5fd0072e555576297804d57bhiremath uint8_t ibcm_arp_ibd_alloc;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath uint8_t ibcm_arp_ibd_cnt;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath ibcm_arp_ip_t *ibcm_arp_ip;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath} ibcm_arp_ibd_insts_t;
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
261906274d77b4a1c6d61c75d170ab5a8e85a6a7Shantkumar Hiremathibt_status_t ibcm_arp_get_ibaddr(zoneid_t zoneid, ibt_ip_addr_t srcip,
261906274d77b4a1c6d61c75d170ab5a8e85a6a7Shantkumar Hiremath ibt_ip_addr_t destip, ib_gid_t *sgid, ib_gid_t *dgid,
261906274d77b4a1c6d61c75d170ab5a8e85a6a7Shantkumar Hiremath ibt_ip_addr_t *saddr_p);
d3a82192edbbe93c6027629b50fd93fed5d0e1abShantkumar Hiremathibt_status_t ibcm_arp_get_ibds(ibcm_arp_ibd_insts_t *ibdp, sa_family_t fam);
1cfa752f4e24c34133009b0f6c139127a5c461deRamaswamy Tummalavoid ibcm_arp_free_ibds(ibcm_arp_ibd_insts_t *ibds);
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#ifdef __cplusplus
015f8fff605f2fbd5fd0072e555576297804d57bhiremath}
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#endif
015f8fff605f2fbd5fd0072e555576297804d57bhiremath
015f8fff605f2fbd5fd0072e555576297804d57bhiremath#endif /* _SYS_IB_MGT_IBCM_IBCM_ARP_H */