1bd670b35SErik Nordmark /* 2bd670b35SErik Nordmark * CDDL HEADER START 3bd670b35SErik Nordmark * 4bd670b35SErik Nordmark * The contents of this file are subject to the terms of the 5bd670b35SErik Nordmark * Common Development and Distribution License (the "License"). 6bd670b35SErik Nordmark * You may not use this file except in compliance with the License. 7bd670b35SErik Nordmark * 8bd670b35SErik Nordmark * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9bd670b35SErik Nordmark * or http://www.opensolaris.org/os/licensing. 10bd670b35SErik Nordmark * See the License for the specific language governing permissions 11bd670b35SErik Nordmark * and limitations under the License. 12bd670b35SErik Nordmark * 13bd670b35SErik Nordmark * When distributing Covered Code, include this CDDL HEADER in each 14bd670b35SErik Nordmark * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15bd670b35SErik Nordmark * If applicable, add the following below this CDDL HEADER, with the 16bd670b35SErik Nordmark * fields enclosed by brackets "[]" replaced with your own identifying 17bd670b35SErik Nordmark * information: Portions Copyright [yyyy] [name of copyright owner] 18bd670b35SErik Nordmark * 19bd670b35SErik Nordmark * CDDL HEADER END 20bd670b35SErik Nordmark */ 21bd670b35SErik Nordmark 22bd670b35SErik Nordmark /* 23*a6911619SDarren Reed * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 24bd670b35SErik Nordmark */ 25bd670b35SErik Nordmark 26bd670b35SErik Nordmark #ifndef _IP_ARP_H 27bd670b35SErik Nordmark #define _IP_ARP_H 28bd670b35SErik Nordmark 29bd670b35SErik Nordmark /* 30bd670b35SErik Nordmark * Data-structures and functions related to the IP STREAMS queue that handles 31bd670b35SErik Nordmark * packets with the SAP set to 0x806 (ETHERTYPE_ARP). 32bd670b35SErik Nordmark */ 33bd670b35SErik Nordmark 34bd670b35SErik Nordmark #ifdef __cplusplus 35bd670b35SErik Nordmark extern "C" { 36bd670b35SErik Nordmark #endif 37bd670b35SErik Nordmark 38bd670b35SErik Nordmark #include <sys/types.h> 39bd670b35SErik Nordmark #include <inet/ip.h> 40bd670b35SErik Nordmark #include <inet/ip_ndp.h> 41bd670b35SErik Nordmark #include <sys/stream.h> 42bd670b35SErik Nordmark 43bd670b35SErik Nordmark #ifdef _KERNEL 44bd670b35SErik Nordmark extern struct streamtab dummymodinfo; 45bd670b35SErik Nordmark 46bd670b35SErik Nordmark struct arl_ill_common_s; 47bd670b35SErik Nordmark /* 48bd670b35SErik Nordmark * The arl_s structure tracks the state of the associated ARP stream. 49bd670b35SErik Nordmark */ 50bd670b35SErik Nordmark typedef struct arl_s { 51bd670b35SErik Nordmark queue_t *arl_rq; 52bd670b35SErik Nordmark queue_t *arl_wq; 53bd670b35SErik Nordmark ip_stack_t *arl_ipst; 54bd670b35SErik Nordmark zoneid_t arl_zoneid; 55bd670b35SErik Nordmark cred_t *arl_credp; 56bd670b35SErik Nordmark ip_m_t arl_media; 57bd670b35SErik Nordmark struct arl_ill_common_s *arl_common; 58bd670b35SErik Nordmark int arl_muxid; 59bd670b35SErik Nordmark uint_t arl_ppa; 60bd670b35SErik Nordmark t_uscalar_t arl_sap; 61bd670b35SErik Nordmark t_uscalar_t arl_sap_length; 62bd670b35SErik Nordmark uint_t arl_phys_addr_length; 63bd670b35SErik Nordmark char *arl_name; 64bd670b35SErik Nordmark int arl_name_length; 65bd670b35SErik Nordmark t_uscalar_t arl_mactype; 66bd670b35SErik Nordmark #define arl_first_mp_to_free arl_dlpi_deferred 67bd670b35SErik Nordmark mblk_t *arl_dlpi_deferred; 68bd670b35SErik Nordmark mblk_t *arl_unbind_mp; 69bd670b35SErik Nordmark mblk_t *arl_detach_mp; 70bd670b35SErik Nordmark #define arl_last_mp_to_free arl_detach_mp 71bd670b35SErik Nordmark uint_t arl_state_flags; 72bd670b35SErik Nordmark uint_t 73bd670b35SErik Nordmark arl_needs_attach:1, 74bd670b35SErik Nordmark arl_dlpi_style_set:1, 75bd670b35SErik Nordmark arl_pad_to_bit_31:30; 76bd670b35SErik Nordmark uint_t arl_refcnt; 77bd670b35SErik Nordmark kcondvar_t arl_cv; 78bd670b35SErik Nordmark t_uscalar_t arl_dlpi_pending; 79bd670b35SErik Nordmark kmutex_t arl_lock; 80bd670b35SErik Nordmark int arl_error; 81bd670b35SErik Nordmark } arl_t; 82bd670b35SErik Nordmark 83bd670b35SErik Nordmark /* 84bd670b35SErik Nordmark * The arl_ill_common_t structure is a super-structure that contains pointers 85bd670b35SErik Nordmark * to a pair of matching ill_t, arl_t structures. Given an arl_t (or 86bd670b35SErik Nordmark * ill_t) the corresponding ill_t (or arl_t) must be obtained by 87bd670b35SErik Nordmark * synchronizing on the ai_lock, and ensuring that the desired ill/arl 88bd670b35SErik Nordmark * pointer is non-null, not condemned. The arl_ill_common_t is allocated in 89bd670b35SErik Nordmark * arl_init() and freed only when both the ill_t and the arl_t structures 90bd670b35SErik Nordmark * become NULL. 91bd670b35SErik Nordmark * Lock hierarchy: the ai_lock must be take before the ill_lock or arl_lock. 92bd670b35SErik Nordmark */ 93bd670b35SErik Nordmark 94bd670b35SErik Nordmark typedef struct arl_ill_common_s { 95bd670b35SErik Nordmark kmutex_t ai_lock; 96bd670b35SErik Nordmark ill_t *ai_ill; 97bd670b35SErik Nordmark arl_t *ai_arl; 98bd670b35SErik Nordmark kcondvar_t ai_ill_unplumb_done; /* sent from ip_modclose() */ 99bd670b35SErik Nordmark } arl_ill_common_t; 100bd670b35SErik Nordmark 101bd670b35SErik Nordmark extern boolean_t arp_no_defense; 102bd670b35SErik Nordmark 103bd670b35SErik Nordmark extern struct module_info arp_mod_info; 104bd670b35SErik Nordmark extern int arp_ll_up(ill_t *); 105bd670b35SErik Nordmark extern int arp_ll_down(ill_t *); 106bd670b35SErik Nordmark extern boolean_t arp_announce(ncec_t *); 107bd670b35SErik Nordmark extern boolean_t arp_probe(ncec_t *); 108bd670b35SErik Nordmark extern int arp_request(ncec_t *, in_addr_t, ill_t *); 109bd670b35SErik Nordmark extern void arp_failure(mblk_t *, ip_recv_attr_t *); 110bd670b35SErik Nordmark extern int arl_wait_for_info_ack(arl_t *); 111bd670b35SErik Nordmark extern int arl_init(queue_t *, arl_t *); 112bd670b35SErik Nordmark extern void arl_set_muxid(ill_t *, int); 113bd670b35SErik Nordmark extern int arl_get_muxid(ill_t *); 114bd670b35SErik Nordmark extern void arp_send_replumb_conf(ill_t *); 115bd670b35SErik Nordmark extern void arp_unbind_complete(ill_t *); 116bd670b35SErik Nordmark extern ill_t *arl_to_ill(arl_t *); 117*a6911619SDarren Reed extern uint32_t arp_hw_type(t_uscalar_t); 118bd670b35SErik Nordmark #endif 119bd670b35SErik Nordmark 120bd670b35SErik Nordmark #define ARP_RETRANS_TIMER 500 /* time in milliseconds */ 121bd670b35SErik Nordmark 122bd670b35SErik Nordmark /* The following are arl_state_flags */ 123bd670b35SErik Nordmark #define ARL_LL_SUBNET_PENDING 0x01 /* Waiting for DL_INFO_ACK from drv */ 124bd670b35SErik Nordmark #define ARL_CONDEMNED 0x02 /* No more new ref's to the ILL */ 125bd670b35SErik Nordmark #define ARL_DL_UNBIND_IN_PROGRESS 0x04 /* UNBIND_REQ is sent */ 126bd670b35SErik Nordmark #define ARL_LL_BIND_PENDING 0x0020 /* BIND sent */ 127bd670b35SErik Nordmark #define ARL_LL_UP 0x0040 /* BIND acked */ 128bd670b35SErik Nordmark #define ARL_LL_DOWN 0x0080 129bd670b35SErik Nordmark #define ARL_LL_UNBOUND 0x0100 /* UNBIND acked */ 130bd670b35SErik Nordmark #define ARL_LL_REPLUMBING 0x0200 /* replumb in progress */ 131bd670b35SErik Nordmark 132bd670b35SErik Nordmark #ifdef __cplusplus 133bd670b35SErik Nordmark } 134bd670b35SErik Nordmark #endif 135bd670b35SErik Nordmark 136bd670b35SErik Nordmark #endif /* _IP_ARP_H */ 137