1*7836SJohn.Forte@Sun.COM /* 2*7836SJohn.Forte@Sun.COM * CDDL HEADER START 3*7836SJohn.Forte@Sun.COM * 4*7836SJohn.Forte@Sun.COM * The contents of this file are subject to the terms of the 5*7836SJohn.Forte@Sun.COM * Common Development and Distribution License (the "License"). 6*7836SJohn.Forte@Sun.COM * You may not use this file except in compliance with the License. 7*7836SJohn.Forte@Sun.COM * 8*7836SJohn.Forte@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*7836SJohn.Forte@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*7836SJohn.Forte@Sun.COM * See the License for the specific language governing permissions 11*7836SJohn.Forte@Sun.COM * and limitations under the License. 12*7836SJohn.Forte@Sun.COM * 13*7836SJohn.Forte@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*7836SJohn.Forte@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*7836SJohn.Forte@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*7836SJohn.Forte@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*7836SJohn.Forte@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*7836SJohn.Forte@Sun.COM * 19*7836SJohn.Forte@Sun.COM * CDDL HEADER END 20*7836SJohn.Forte@Sun.COM */ 21*7836SJohn.Forte@Sun.COM /* 22*7836SJohn.Forte@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 23*7836SJohn.Forte@Sun.COM * Use is subject to license terms. 24*7836SJohn.Forte@Sun.COM */ 25*7836SJohn.Forte@Sun.COM 26*7836SJohn.Forte@Sun.COM #ifndef _SYS_FIBRE_CHANNEL_ULP_FCIP_H 27*7836SJohn.Forte@Sun.COM #define _SYS_FIBRE_CHANNEL_ULP_FCIP_H 28*7836SJohn.Forte@Sun.COM 29*7836SJohn.Forte@Sun.COM 30*7836SJohn.Forte@Sun.COM 31*7836SJohn.Forte@Sun.COM /* 32*7836SJohn.Forte@Sun.COM * Header file for FCIP: IP/ARP ULP over FibreChannel 33*7836SJohn.Forte@Sun.COM */ 34*7836SJohn.Forte@Sun.COM 35*7836SJohn.Forte@Sun.COM #include <sys/kstat.h> 36*7836SJohn.Forte@Sun.COM #include <sys/socket.h> 37*7836SJohn.Forte@Sun.COM #include <netinet/arp.h> 38*7836SJohn.Forte@Sun.COM 39*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 40*7836SJohn.Forte@Sun.COM extern "C" { 41*7836SJohn.Forte@Sun.COM #endif 42*7836SJohn.Forte@Sun.COM 43*7836SJohn.Forte@Sun.COM /* 44*7836SJohn.Forte@Sun.COM * Definitions for module_info. 45*7836SJohn.Forte@Sun.COM */ 46*7836SJohn.Forte@Sun.COM #define FCIPIDNUM (77) /* module ID number */ 47*7836SJohn.Forte@Sun.COM #define FCIPNAME "fcip" /* module name */ 48*7836SJohn.Forte@Sun.COM #define FCIPMINPSZ (0) /* min packet size */ 49*7836SJohn.Forte@Sun.COM #define FCIPMAXPSZ 1514 /* max packet size */ 50*7836SJohn.Forte@Sun.COM #define FCIPHIWAT (32 * 1024) /* hi-water mark */ 51*7836SJohn.Forte@Sun.COM #define FCIPLOWAT (1) /* lo-water mark */ 52*7836SJohn.Forte@Sun.COM #define FCIPMTU 65280 /* Max permissible MTU */ 53*7836SJohn.Forte@Sun.COM #define FCIPMIN (ETHERMIN + sizeof (llc_snap_hdr_t) + \ 54*7836SJohn.Forte@Sun.COM sizeof (fcph_network_hdr_t)) 55*7836SJohn.Forte@Sun.COM 56*7836SJohn.Forte@Sun.COM /* 57*7836SJohn.Forte@Sun.COM * Per-Stream instance state information. 58*7836SJohn.Forte@Sun.COM * 59*7836SJohn.Forte@Sun.COM * Each instance is dynamically allocated at open() and free'd 60*7836SJohn.Forte@Sun.COM * at close(). Each per-Stream instance points to at most one 61*7836SJohn.Forte@Sun.COM * per-device structure using the sl_fcip field. All instances 62*7836SJohn.Forte@Sun.COM * are threaded together into one list of active instances 63*7836SJohn.Forte@Sun.COM * ordered on minor device number. 64*7836SJohn.Forte@Sun.COM */ 65*7836SJohn.Forte@Sun.COM 66*7836SJohn.Forte@Sun.COM #define NMCHASH 64 /* no. of multicast hash buckets */ 67*7836SJohn.Forte@Sun.COM #define INIT_BUCKET_SIZE 16 /* Initial hash bucket size */ 68*7836SJohn.Forte@Sun.COM 69*7836SJohn.Forte@Sun.COM struct fcipstr { 70*7836SJohn.Forte@Sun.COM struct fcipstr *sl_nextp; /* next in list */ 71*7836SJohn.Forte@Sun.COM queue_t *sl_rq; /* pointer to our rq */ 72*7836SJohn.Forte@Sun.COM struct fcip *sl_fcip; /* attached device */ 73*7836SJohn.Forte@Sun.COM t_uscalar_t sl_state; /* current DL state */ 74*7836SJohn.Forte@Sun.COM t_uscalar_t sl_sap; /* bound sap */ 75*7836SJohn.Forte@Sun.COM uint32_t sl_flags; /* misc. flags */ 76*7836SJohn.Forte@Sun.COM uint32_t sl_minor; /* minor device number */ 77*7836SJohn.Forte@Sun.COM la_wwn_t *sl_mctab[NMCHASH]; /* multicast addr table */ 78*7836SJohn.Forte@Sun.COM uint_t sl_mccount[NMCHASH]; /* # valid addr in mctab[i] */ 79*7836SJohn.Forte@Sun.COM uint_t sl_mcsize[NMCHASH]; /* size of mctab[i] */ 80*7836SJohn.Forte@Sun.COM ushort_t sl_ladrf[4]; /* Multicast filter bits */ 81*7836SJohn.Forte@Sun.COM ushort_t sl_ladrf_refcnt[64]; /* ref. count for filter bits */ 82*7836SJohn.Forte@Sun.COM kmutex_t sl_lock; /* protect this structure */ 83*7836SJohn.Forte@Sun.COM }; 84*7836SJohn.Forte@Sun.COM 85*7836SJohn.Forte@Sun.COM /* per-stream flags */ 86*7836SJohn.Forte@Sun.COM #define FCIP_SLFAST 0x01 /* "M_DATA fastpath" mode */ 87*7836SJohn.Forte@Sun.COM #define FCIP_SLRAW 0x02 /* M_DATA plain raw mode */ 88*7836SJohn.Forte@Sun.COM #define FCIP_SLALLPHYS 0x04 /* "promiscuous mode" */ 89*7836SJohn.Forte@Sun.COM #define FCIP_SLALLMULTI 0x08 /* enable all multicast addresses */ 90*7836SJohn.Forte@Sun.COM #define FCIP_SLALLSAP 0x10 /* enable all ether type values */ 91*7836SJohn.Forte@Sun.COM 92*7836SJohn.Forte@Sun.COM /* 93*7836SJohn.Forte@Sun.COM * Maximum # of multicast addresses per Stream. 94*7836SJohn.Forte@Sun.COM */ 95*7836SJohn.Forte@Sun.COM #define FCIPMAXMC 64 96*7836SJohn.Forte@Sun.COM #define FCIPMCALLOC (FCIPMAXMC * sizeof (la_wwn_t)) 97*7836SJohn.Forte@Sun.COM 98*7836SJohn.Forte@Sun.COM /* 99*7836SJohn.Forte@Sun.COM * Full DLSAP address length (in struct dladdr format). 100*7836SJohn.Forte@Sun.COM */ 101*7836SJohn.Forte@Sun.COM #define FCIPADDRL (sizeof (ushort_t) + sizeof (struct ether_addr)) 102*7836SJohn.Forte@Sun.COM 103*7836SJohn.Forte@Sun.COM 104*7836SJohn.Forte@Sun.COM typedef struct fcip_port_info { 105*7836SJohn.Forte@Sun.COM struct fcip_port_info *fcipp_next; /* next port in list */ 106*7836SJohn.Forte@Sun.COM opaque_t *fcipp_handle; 107*7836SJohn.Forte@Sun.COM struct modlinkage fcipp_linkage; 108*7836SJohn.Forte@Sun.COM dev_info_t *fcipp_dip; 109*7836SJohn.Forte@Sun.COM uint32_t fcipp_topology; 110*7836SJohn.Forte@Sun.COM uint32_t fcipp_pstate; 111*7836SJohn.Forte@Sun.COM la_wwn_t fcipp_pwwn; 112*7836SJohn.Forte@Sun.COM la_wwn_t fcipp_nwwn; 113*7836SJohn.Forte@Sun.COM uchar_t fcipp_naa; /* This port's NAA */ 114*7836SJohn.Forte@Sun.COM int fcipp_fca_pkt_size; 115*7836SJohn.Forte@Sun.COM ddi_dma_attr_t fcipp_cmd_dma_attr; 116*7836SJohn.Forte@Sun.COM ddi_dma_attr_t fcipp_resp_dma_attr; 117*7836SJohn.Forte@Sun.COM ddi_device_acc_attr_t fcipp_fca_acc_attr; 118*7836SJohn.Forte@Sun.COM fc_portid_t fcipp_sid; /* this port's S_ID */ 119*7836SJohn.Forte@Sun.COM struct fcip *fcipp_fcip; /* this port's fcip struct */ 120*7836SJohn.Forte@Sun.COM } fcip_port_info_t; 121*7836SJohn.Forte@Sun.COM 122*7836SJohn.Forte@Sun.COM #define FCIP_SUCCESS (0) 123*7836SJohn.Forte@Sun.COM #define FCIP_FAILURE (1) 124*7836SJohn.Forte@Sun.COM #define FCIP_FARP_TIMEOUT 10 /* seconds */ 125*7836SJohn.Forte@Sun.COM #define FCIP_WAIT_CMDS 5 /* 5 retries at 1 sec between retries */ 126*7836SJohn.Forte@Sun.COM 127*7836SJohn.Forte@Sun.COM /* 128*7836SJohn.Forte@Sun.COM * Num ports supported for soft_state_init 129*7836SJohn.Forte@Sun.COM */ 130*7836SJohn.Forte@Sun.COM #define FCIP_NUM_INSTANCES 5 131*7836SJohn.Forte@Sun.COM 132*7836SJohn.Forte@Sun.COM #define FCIP_UB_NBUFS 60 133*7836SJohn.Forte@Sun.COM #define FCIP_UB_SIZE 65535 134*7836SJohn.Forte@Sun.COM #define FCIP_UB_DECREMENT 4 135*7836SJohn.Forte@Sun.COM #define FCIP_UB_MINBUFS 8 136*7836SJohn.Forte@Sun.COM #define FCIP_INIT_DELAY 10000000 /* 10 seconds */ 137*7836SJohn.Forte@Sun.COM #define FCIP_PKT_TTL 120 /* 120 secs */ 138*7836SJohn.Forte@Sun.COM #define FCIP_TIMEOUT_INTERVAL 10 /* 10 seconds */ 139*7836SJohn.Forte@Sun.COM #define FCIP_OFFLINE_TIMEOUT 60 /* 60 seconds */ 140*7836SJohn.Forte@Sun.COM #define FCIP_MAX_PORTS 127 /* for private loop/pt_pt */ 141*7836SJohn.Forte@Sun.COM #define FCIP_RTE_TIMEOUT 60 /* 60 seconds */ 142*7836SJohn.Forte@Sun.COM 143*7836SJohn.Forte@Sun.COM #define ETHERSTRL ((2 * ETHERADDRL) + 1) 144*7836SJohn.Forte@Sun.COM /* 145*7836SJohn.Forte@Sun.COM * Hash lists 146*7836SJohn.Forte@Sun.COM */ 147*7836SJohn.Forte@Sun.COM #define FCIP_RT_HASH_ELEMS 32 148*7836SJohn.Forte@Sun.COM #define FCIP_DEST_HASH_ELEMS 16 149*7836SJohn.Forte@Sun.COM 150*7836SJohn.Forte@Sun.COM 151*7836SJohn.Forte@Sun.COM #define FCIP_RT_HASH(x) ((x[2] + x[3] + x[4] + x[5] + x[6] + x[7]) \ 152*7836SJohn.Forte@Sun.COM & (FCIP_RT_HASH_ELEMS - 1)) 153*7836SJohn.Forte@Sun.COM 154*7836SJohn.Forte@Sun.COM #define FCIP_DEST_HASH(x) ((x[2] + x[3] + x[4] + x[5] + x[6] + x[7]) \ 155*7836SJohn.Forte@Sun.COM & (FCIP_DEST_HASH_ELEMS - 1)) 156*7836SJohn.Forte@Sun.COM 157*7836SJohn.Forte@Sun.COM #define FCIP_HDR_SIZE 8 158*7836SJohn.Forte@Sun.COM #define FCIP_RT_INVALID (-1) 159*7836SJohn.Forte@Sun.COM #define FCIP_RT_RETIRED (-2) 160*7836SJohn.Forte@Sun.COM #define FCIP_RT_SUSPENDED (-3) 161*7836SJohn.Forte@Sun.COM #define FCIP_RT_LOGIN_PROGRESS (-4) 162*7836SJohn.Forte@Sun.COM 163*7836SJohn.Forte@Sun.COM #define FCIP_RTE_UNAVAIL(state) (((state) == FCIP_RT_INVALID) || \ 164*7836SJohn.Forte@Sun.COM ((state) == FCIP_RT_RETIRED) || \ 165*7836SJohn.Forte@Sun.COM ((state) == FCIP_RT_SUSPENDED)) ? 1 : 0 166*7836SJohn.Forte@Sun.COM 167*7836SJohn.Forte@Sun.COM /* 168*7836SJohn.Forte@Sun.COM * Taskq related 169*7836SJohn.Forte@Sun.COM */ 170*7836SJohn.Forte@Sun.COM #define FCIP_NUM_THREADS 4 171*7836SJohn.Forte@Sun.COM #define FCIP_MIN_TASKS 12 172*7836SJohn.Forte@Sun.COM #define FCIP_MAX_TASKS 32 173*7836SJohn.Forte@Sun.COM 174*7836SJohn.Forte@Sun.COM 175*7836SJohn.Forte@Sun.COM /* 176*7836SJohn.Forte@Sun.COM * Per-Device instance state information. 177*7836SJohn.Forte@Sun.COM * 178*7836SJohn.Forte@Sun.COM * Each instance is dynamically allocated on first attach. 179*7836SJohn.Forte@Sun.COM */ 180*7836SJohn.Forte@Sun.COM struct fcip { 181*7836SJohn.Forte@Sun.COM dev_info_t *fcip_dip; /* parent's dev_info */ 182*7836SJohn.Forte@Sun.COM int fcip_instance; /* parent's instance */ 183*7836SJohn.Forte@Sun.COM struct fcip *fcip_sibling; /* The other FCA port */ 184*7836SJohn.Forte@Sun.COM uint32_t fcip_flags; /* misc. flags */ 185*7836SJohn.Forte@Sun.COM uint32_t fcip_port_state; /* Link State */ 186*7836SJohn.Forte@Sun.COM fcip_port_info_t *fcip_port_info; /* info about port */ 187*7836SJohn.Forte@Sun.COM struct fcip *fcip_next; 188*7836SJohn.Forte@Sun.COM 189*7836SJohn.Forte@Sun.COM kcondvar_t fcip_farp_cv; /* For perport serialization */ 190*7836SJohn.Forte@Sun.COM int fcip_farp_rsp_flag; /* FARP response flag */ 191*7836SJohn.Forte@Sun.COM kmutex_t fcip_mutex; /* protect this structure */ 192*7836SJohn.Forte@Sun.COM kmutex_t fcip_ub_mutex; /* protect the unsol bufs */ 193*7836SJohn.Forte@Sun.COM 194*7836SJohn.Forte@Sun.COM uint32_t fcip_ub_nbufs; /* no. of Unsol. Buffers */ 195*7836SJohn.Forte@Sun.COM uint32_t fcip_ub_upstream; /* no ubufs in use */ 196*7836SJohn.Forte@Sun.COM kcondvar_t fcip_ub_cv; 197*7836SJohn.Forte@Sun.COM timeout_id_t fcip_timeout_id; /* for timeout routine */ 198*7836SJohn.Forte@Sun.COM uint32_t fcip_timeout_ticks; 199*7836SJohn.Forte@Sun.COM uint32_t fcip_mark_offline; 200*7836SJohn.Forte@Sun.COM 201*7836SJohn.Forte@Sun.COM uint64_t *fcip_ub_tokens; /* unsol buf tokens */ 202*7836SJohn.Forte@Sun.COM kmutex_t fcip_dest_mutex; /* dest table lock */ 203*7836SJohn.Forte@Sun.COM struct fcip_dest *fcip_dest[FCIP_DEST_HASH_ELEMS]; 204*7836SJohn.Forte@Sun.COM /* hash table of remote dest. ports */ 205*7836SJohn.Forte@Sun.COM kmutex_t fcip_rt_mutex; /* routing table lock */ 206*7836SJohn.Forte@Sun.COM struct fcip_routing_table *fcip_rtable[FCIP_RT_HASH_ELEMS]; 207*7836SJohn.Forte@Sun.COM /* hash table of WWN to D_ID maps */ 208*7836SJohn.Forte@Sun.COM 209*7836SJohn.Forte@Sun.COM int fcip_intr_flag; /* init. flag for fcipintr() */ 210*7836SJohn.Forte@Sun.COM uint32_t fcip_addrflags; /* type of MAC address */ 211*7836SJohn.Forte@Sun.COM struct ether_addr fcip_factmacaddr; /* local mac address */ 212*7836SJohn.Forte@Sun.COM struct ether_addr fcip_macaddr; /* MAC addr */ 213*7836SJohn.Forte@Sun.COM la_wwn_t fcip_ouraddr; /* individual address */ 214*7836SJohn.Forte@Sun.COM uchar_t fcip_ouripaddr[16]; /* Our IP address */ 215*7836SJohn.Forte@Sun.COM struct kmem_cache *fcip_xmit_cache; /* cache of xmit pkts */ 216*7836SJohn.Forte@Sun.COM uint32_t fcip_wantw; /* out of xmit resources */ 217*7836SJohn.Forte@Sun.COM queue_t *fcip_ipq; /* ip read queue */ 218*7836SJohn.Forte@Sun.COM taskq_t *fcip_tq; /* Taskq pointer */ 219*7836SJohn.Forte@Sun.COM int fcip_sendup_thr_initted; /* sendup tq thread */ 220*7836SJohn.Forte@Sun.COM kmutex_t fcip_sendup_mutex; /* for upstream data */ 221*7836SJohn.Forte@Sun.COM kcondvar_t fcip_sendup_cv; /* for upstream unsol data */ 222*7836SJohn.Forte@Sun.COM struct fcip_sendup_elem *fcip_sendup_head; /* head of mblk elems */ 223*7836SJohn.Forte@Sun.COM struct fcip_sendup_elem *fcip_sendup_tail; /* tail of elem list */ 224*7836SJohn.Forte@Sun.COM struct kmem_cache *fcip_sendup_cache; /* for sendup elems */ 225*7836SJohn.Forte@Sun.COM uint32_t fcip_sendup_cnt; /* Num msgs queued */ 226*7836SJohn.Forte@Sun.COM uint32_t fcip_broadcast_did; /* broadcast D_ID */ 227*7836SJohn.Forte@Sun.COM 228*7836SJohn.Forte@Sun.COM kstat_t *fcip_intrstats; /* interrupt statistics */ 229*7836SJohn.Forte@Sun.COM kstat_t *fcip_kstatp; /* kstat pointer */ 230*7836SJohn.Forte@Sun.COM 231*7836SJohn.Forte@Sun.COM callb_cpr_t fcip_cpr_info; /* for the sendup thread */ 232*7836SJohn.Forte@Sun.COM 233*7836SJohn.Forte@Sun.COM ulong_t fcip_ipackets; /* # packets received */ 234*7836SJohn.Forte@Sun.COM ulong_t fcip_ierrors; /* # total input errors */ 235*7836SJohn.Forte@Sun.COM ulong_t fcip_opackets; /* # packets sent */ 236*7836SJohn.Forte@Sun.COM ulong_t fcip_oerrors; /* # total output errors */ 237*7836SJohn.Forte@Sun.COM ulong_t fcip_collisions; /* # collisions */ 238*7836SJohn.Forte@Sun.COM ulong_t fcip_defer; /* # defers */ 239*7836SJohn.Forte@Sun.COM ulong_t fcip_fram; /* # receive framing errors */ 240*7836SJohn.Forte@Sun.COM ulong_t fcip_crc; /* # receive crc errors */ 241*7836SJohn.Forte@Sun.COM ulong_t fcip_oflo; /* # receiver overflows */ 242*7836SJohn.Forte@Sun.COM ulong_t fcip_uflo; /* # transmit underflows */ 243*7836SJohn.Forte@Sun.COM ulong_t fcip_missed; /* # receive missed */ 244*7836SJohn.Forte@Sun.COM ulong_t fcip_tlcol; /* # xmit late collisions */ 245*7836SJohn.Forte@Sun.COM ulong_t fcip_trtry; /* # transmit retry failures */ 246*7836SJohn.Forte@Sun.COM ulong_t fcip_tnocar; /* # loss of carrier errors */ 247*7836SJohn.Forte@Sun.COM ulong_t fcip_inits; /* # driver inits */ 248*7836SJohn.Forte@Sun.COM ulong_t fcip_notbufs; /* # out of pkts for xmit */ 249*7836SJohn.Forte@Sun.COM ulong_t fcip_norbufs; /* # out of buffers for rcv */ 250*7836SJohn.Forte@Sun.COM ulong_t fcip_nocanput; /* # input canputret.false */ 251*7836SJohn.Forte@Sun.COM ulong_t fcip_allocbfail; /* # allocb failed */ 252*7836SJohn.Forte@Sun.COM int fcip_tx_lbolt; /* time of last tx interrupt */ 253*7836SJohn.Forte@Sun.COM int fcip_rx_lbolt; /* time of last rx interrupt */ 254*7836SJohn.Forte@Sun.COM 255*7836SJohn.Forte@Sun.COM /* 256*7836SJohn.Forte@Sun.COM * MIB II variables 257*7836SJohn.Forte@Sun.COM */ 258*7836SJohn.Forte@Sun.COM ulong_t fcip_rcvbytes; /* # bytes received */ 259*7836SJohn.Forte@Sun.COM ulong_t fcip_xmtbytes; /* # bytes transmitted */ 260*7836SJohn.Forte@Sun.COM ulong_t fcip_multircv; /* # multicast pkts received */ 261*7836SJohn.Forte@Sun.COM ulong_t fcip_multixmt; /* # multicast pkts for xmit */ 262*7836SJohn.Forte@Sun.COM ulong_t fcip_brdcstrcv; /* # broadcast pkts received */ 263*7836SJohn.Forte@Sun.COM ulong_t fcip_brdcstxmt; /* # broadcast pkts for xmit */ 264*7836SJohn.Forte@Sun.COM ulong_t fcip_norcvbuf; /* # rcv pkts discarded */ 265*7836SJohn.Forte@Sun.COM ulong_t fcip_noxmtbuf; /* # xmit pkts discarded */ 266*7836SJohn.Forte@Sun.COM 267*7836SJohn.Forte@Sun.COM ulong_t fcip_num_ipkts_pending; 268*7836SJohn.Forte@Sun.COM /* #ipkts pending call back */ 269*7836SJohn.Forte@Sun.COM }; 270*7836SJohn.Forte@Sun.COM 271*7836SJohn.Forte@Sun.COM #define FCIP_FACTADDR_PRESENT 0x01 272*7836SJohn.Forte@Sun.COM #define FCIP_FACTADDR_USE 0x02 273*7836SJohn.Forte@Sun.COM 274*7836SJohn.Forte@Sun.COM /* flags */ 275*7836SJohn.Forte@Sun.COM #define FCIP_RUNNING 0x01 276*7836SJohn.Forte@Sun.COM #define FCIP_INITED 0x02 277*7836SJohn.Forte@Sun.COM #define FCIP_PROMISC 0x04 278*7836SJohn.Forte@Sun.COM #define FCIP_SUSPENDED 0x08 279*7836SJohn.Forte@Sun.COM #define FCIP_NOTIMEOUTS 0x10 280*7836SJohn.Forte@Sun.COM #define FCIP_DETACHING 0x20 281*7836SJohn.Forte@Sun.COM #define FCIP_DETACHED 0x40 282*7836SJohn.Forte@Sun.COM #define FCIP_ATTACHING 0x80 283*7836SJohn.Forte@Sun.COM #define FCIP_LINK_DOWN 0x100 284*7836SJohn.Forte@Sun.COM #define FCIP_IN_SC_CB 0x200 285*7836SJohn.Forte@Sun.COM #define FCIP_IN_DATA_CB 0x400 286*7836SJohn.Forte@Sun.COM #define FCIP_IN_ELS_CB 0x800 287*7836SJohn.Forte@Sun.COM #define FCIP_IN_TIMEOUT 0x1000 288*7836SJohn.Forte@Sun.COM #define FCIP_POWER_DOWN 0x2000 289*7836SJohn.Forte@Sun.COM #define FCIP_RTE_REMOVING 0x4000 290*7836SJohn.Forte@Sun.COM #define FCIP_REG_INPROGRESS 0x8000 291*7836SJohn.Forte@Sun.COM /* macro for checking any callback */ 292*7836SJohn.Forte@Sun.COM #define FCIP_IN_CALLBACK (FCIP_IN_SC_CB | FCIP_IN_DATA_CB | \ 293*7836SJohn.Forte@Sun.COM FCIP_IN_ELS_CB) 294*7836SJohn.Forte@Sun.COM /* macro for checking if a port is busy */ 295*7836SJohn.Forte@Sun.COM #define FCIP_PORT_BUSY (FCIP_ATTACHING | \ 296*7836SJohn.Forte@Sun.COM FCIP_REG_INPROGRESS | FCIP_DETACHING) 297*7836SJohn.Forte@Sun.COM 298*7836SJohn.Forte@Sun.COM 299*7836SJohn.Forte@Sun.COM /* 300*7836SJohn.Forte@Sun.COM * FCIP routing table maintains the FC Layer and the ARP layer 301*7836SJohn.Forte@Sun.COM * mapping for a destination port. 302*7836SJohn.Forte@Sun.COM */ 303*7836SJohn.Forte@Sun.COM struct fcip_routing_table { 304*7836SJohn.Forte@Sun.COM struct fcip_routing_table *fcipr_next; /* next elem */ 305*7836SJohn.Forte@Sun.COM la_wwn_t fcipr_pwwn; /* Destination Port's Port WWN */ 306*7836SJohn.Forte@Sun.COM la_wwn_t fcipr_nwwn; /* Destination Port's Node WWN */ 307*7836SJohn.Forte@Sun.COM fc_portid_t fcipr_d_id; /* Destination Port's D_ID */ 308*7836SJohn.Forte@Sun.COM void *fcipr_pd; /* pointer to port device struct */ 309*7836SJohn.Forte@Sun.COM uchar_t fcipr_ipaddr[16]; /* Port's IP address */ 310*7836SJohn.Forte@Sun.COM int fcipr_state; /* login state etc */ 311*7836SJohn.Forte@Sun.COM clock_t fcipr_invalid_timeout; /* wait after marked inval */ 312*7836SJohn.Forte@Sun.COM opaque_t fcipr_fca_dev; /* FCA device pointer */ 313*7836SJohn.Forte@Sun.COM }; 314*7836SJohn.Forte@Sun.COM 315*7836SJohn.Forte@Sun.COM #define FCIP_COMPARE_NWWN 0x001 316*7836SJohn.Forte@Sun.COM #define FCIP_COMPARE_PWWN 0x010 317*7836SJohn.Forte@Sun.COM #define FCIP_COMPARE_BROADCAST 0x100 318*7836SJohn.Forte@Sun.COM 319*7836SJohn.Forte@Sun.COM #define IS_BROADCAST_ADDR(wwn) (((wwn)->raw_wwn[2] == 0xff) && \ 320*7836SJohn.Forte@Sun.COM ((wwn)->raw_wwn[3] == 0xff) && \ 321*7836SJohn.Forte@Sun.COM ((wwn)->w.wwn_lo == 0xffffffff)) 322*7836SJohn.Forte@Sun.COM 323*7836SJohn.Forte@Sun.COM /* 324*7836SJohn.Forte@Sun.COM * Define a fcip_pkt structure. We can stuff information about 325*7836SJohn.Forte@Sun.COM * the message block and queue for which the packet was built. We can 326*7836SJohn.Forte@Sun.COM * then free up the message once the transport layer has confirmed 327*7836SJohn.Forte@Sun.COM * that the packet has been successfully transported. 328*7836SJohn.Forte@Sun.COM */ 329*7836SJohn.Forte@Sun.COM typedef struct fcip_pkt { 330*7836SJohn.Forte@Sun.COM mblk_t *fcip_pkt_mp; /* message blk pointer */ 331*7836SJohn.Forte@Sun.COM queue_t *fcip_pkt_wq; /* queue pointer if needed */ 332*7836SJohn.Forte@Sun.COM uint32_t fcip_pkt_ttl; /* time to live */ 333*7836SJohn.Forte@Sun.COM uint32_t fcip_pkt_retries; /* retries if needed */ 334*7836SJohn.Forte@Sun.COM fc_packet_t *fcip_pkt_fcpktp; /* the actual fc packet */ 335*7836SJohn.Forte@Sun.COM struct fcip_dest *fcip_pkt_dest; /* destination of pkt */ 336*7836SJohn.Forte@Sun.COM struct fcip *fcip_pkt_fptr; /* fcip structure */ 337*7836SJohn.Forte@Sun.COM struct fcip_pkt *fcip_pkt_next; /* next pkt */ 338*7836SJohn.Forte@Sun.COM struct fcip_pkt *fcip_pkt_prev; /* prev pkt */ 339*7836SJohn.Forte@Sun.COM uint32_t fcip_pkt_state; /* pkt state */ 340*7836SJohn.Forte@Sun.COM uint32_t fcip_pkt_reason; /* pkt reason */ 341*7836SJohn.Forte@Sun.COM uint32_t fcip_pkt_flags; /* pkt flags */ 342*7836SJohn.Forte@Sun.COM uint32_t fcip_pkt_dma_flags; /* DMA flags */ 343*7836SJohn.Forte@Sun.COM fc_packet_t fcip_pkt_fcpkt; /* the actual fc packet */ 344*7836SJohn.Forte@Sun.COM struct fcip_routing_table *fcip_pkt_frp; /* routing table */ 345*7836SJohn.Forte@Sun.COM } fcip_pkt_t; 346*7836SJohn.Forte@Sun.COM 347*7836SJohn.Forte@Sun.COM /* fcipp_dma_flags */ 348*7836SJohn.Forte@Sun.COM #define FCIP_CMD_DMA_MEM 0x01 349*7836SJohn.Forte@Sun.COM #define FCIP_CMD_DMA_BOUND 0x02 350*7836SJohn.Forte@Sun.COM #define FCIP_RESP_DMA_MEM 0x04 351*7836SJohn.Forte@Sun.COM #define FCIP_RESP_DMA_BOUND 0x08 352*7836SJohn.Forte@Sun.COM 353*7836SJohn.Forte@Sun.COM /* fcipp_flags */ 354*7836SJohn.Forte@Sun.COM #define FCIP_PKT_INTERNAL 0x01 355*7836SJohn.Forte@Sun.COM #define FCIP_PKT_IN_TIMEOUT 0x02 356*7836SJohn.Forte@Sun.COM #define FCIP_PKT_RETURNED 0x04 357*7836SJohn.Forte@Sun.COM #define FCIP_PKT_IN_LIST 0x08 358*7836SJohn.Forte@Sun.COM #define FCIP_PKT_IN_ABORT 0x10 359*7836SJohn.Forte@Sun.COM 360*7836SJohn.Forte@Sun.COM #define FCIP_PKT_TO_FC_PKT(fcip_pkt) &(fcip_pkt)->fcip_pkt_fcpkt 361*7836SJohn.Forte@Sun.COM /* 362*7836SJohn.Forte@Sun.COM * For each remote port we have a active session with (logged in and 363*7836SJohn.Forte@Sun.COM * having active exchanges) setup a Destination Port structure. Maintain 364*7836SJohn.Forte@Sun.COM * a Hash list of destination structures in the fcip structure. Before 365*7836SJohn.Forte@Sun.COM * starting a new session with the destination port, lookup the hash 366*7836SJohn.Forte@Sun.COM * table to see if we are already having active exchanges with a remote 367*7836SJohn.Forte@Sun.COM * port and if yes bump the reference count and continue use the same 368*7836SJohn.Forte@Sun.COM * destination port. Hash on Port WWNs. 369*7836SJohn.Forte@Sun.COM */ 370*7836SJohn.Forte@Sun.COM struct fcip_dest { 371*7836SJohn.Forte@Sun.COM struct fcip_dest *fcipd_next; /* next element of hashtable */ 372*7836SJohn.Forte@Sun.COM fcip_pkt_t *fcipd_head; /* packet head for this port */ 373*7836SJohn.Forte@Sun.COM kmutex_t fcipd_mutex; /* packet list mutex */ 374*7836SJohn.Forte@Sun.COM uint32_t fcipd_refcnt; /* no.of active sessions */ 375*7836SJohn.Forte@Sun.COM struct fcip_routing_table *fcipd_rtable; 376*7836SJohn.Forte@Sun.COM 377*7836SJohn.Forte@Sun.COM #define fcipd_nwwn fcipd_rtable->fcipr_nwwn 378*7836SJohn.Forte@Sun.COM #define fcipd_pwwn fcipd_rtable->fcipr_pwwn 379*7836SJohn.Forte@Sun.COM #define fcipd_did fcipd_rtable->fcipr_d_id 380*7836SJohn.Forte@Sun.COM #define fcipd_pd fcipd_rtable->fcipr_pd 381*7836SJohn.Forte@Sun.COM #define fcipd_state fcipd_rtable->fcipr_state 382*7836SJohn.Forte@Sun.COM #define fcipd_fca_dev fcipd_rtable->fcipr_fca_dev; 383*7836SJohn.Forte@Sun.COM 384*7836SJohn.Forte@Sun.COM uint32_t fcipd_retries; /* retries if needed ?? */ 385*7836SJohn.Forte@Sun.COM uint32_t fcipd_flags; /* flags ?? */ 386*7836SJohn.Forte@Sun.COM ulong_t fcipd_ncmds; /* no. of transport cmds */ 387*7836SJohn.Forte@Sun.COM }; 388*7836SJohn.Forte@Sun.COM 389*7836SJohn.Forte@Sun.COM 390*7836SJohn.Forte@Sun.COM #define FCIP_PORT_OFFLINE 0 391*7836SJohn.Forte@Sun.COM #define FCIP_PORT_ONLINE 1 392*7836SJohn.Forte@Sun.COM #define FCIP_PORT_NOTLOGGED 2 393*7836SJohn.Forte@Sun.COM 394*7836SJohn.Forte@Sun.COM #define FCIP_INVALID_WWN -1 395*7836SJohn.Forte@Sun.COM 396*7836SJohn.Forte@Sun.COM #define SLFAST 0x01 /* MDATA fastpath mode */ 397*7836SJohn.Forte@Sun.COM #define SLRAW 0x02 /* M_DATA plain raw mode */ 398*7836SJohn.Forte@Sun.COM #define SLALLPHYS 0x04 /* promiscuous mode */ 399*7836SJohn.Forte@Sun.COM #define SLALLMULTI 0x05 /* enable all multicast addr */ 400*7836SJohn.Forte@Sun.COM #define SLALLSAP 0x10 /* enable all ethertype values */ 401*7836SJohn.Forte@Sun.COM 402*7836SJohn.Forte@Sun.COM 403*7836SJohn.Forte@Sun.COM 404*7836SJohn.Forte@Sun.COM /* 405*7836SJohn.Forte@Sun.COM * Private DLPI full dlsap address format. 406*7836SJohn.Forte@Sun.COM */ 407*7836SJohn.Forte@Sun.COM struct fcipdladdr { 408*7836SJohn.Forte@Sun.COM struct ether_addr dl_phys; 409*7836SJohn.Forte@Sun.COM uint16_t dl_sap; 410*7836SJohn.Forte@Sun.COM }; 411*7836SJohn.Forte@Sun.COM 412*7836SJohn.Forte@Sun.COM 413*7836SJohn.Forte@Sun.COM typedef struct llc_snap_hdr { 414*7836SJohn.Forte@Sun.COM uchar_t dsap; 415*7836SJohn.Forte@Sun.COM uchar_t ssap; 416*7836SJohn.Forte@Sun.COM uchar_t ctrl; 417*7836SJohn.Forte@Sun.COM uchar_t oui[3]; 418*7836SJohn.Forte@Sun.COM ushort_t pid; 419*7836SJohn.Forte@Sun.COM } llc_snap_hdr_t; 420*7836SJohn.Forte@Sun.COM 421*7836SJohn.Forte@Sun.COM /* 422*7836SJohn.Forte@Sun.COM * "Export" a few of the error counters via the kstats mechanism. 423*7836SJohn.Forte@Sun.COM */ 424*7836SJohn.Forte@Sun.COM struct fcipstat { 425*7836SJohn.Forte@Sun.COM struct kstat_named fcips_ipackets; 426*7836SJohn.Forte@Sun.COM struct kstat_named fcips_ierrors; 427*7836SJohn.Forte@Sun.COM struct kstat_named fcips_opackets; 428*7836SJohn.Forte@Sun.COM struct kstat_named fcips_oerrors; 429*7836SJohn.Forte@Sun.COM struct kstat_named fcips_collisions; 430*7836SJohn.Forte@Sun.COM struct kstat_named fcips_defer; 431*7836SJohn.Forte@Sun.COM struct kstat_named fcips_fram; 432*7836SJohn.Forte@Sun.COM struct kstat_named fcips_crc; 433*7836SJohn.Forte@Sun.COM struct kstat_named fcips_oflo; 434*7836SJohn.Forte@Sun.COM struct kstat_named fcips_uflo; 435*7836SJohn.Forte@Sun.COM struct kstat_named fcips_missed; 436*7836SJohn.Forte@Sun.COM struct kstat_named fcips_tlcol; 437*7836SJohn.Forte@Sun.COM struct kstat_named fcips_trtry; 438*7836SJohn.Forte@Sun.COM struct kstat_named fcips_tnocar; 439*7836SJohn.Forte@Sun.COM struct kstat_named fcips_inits; 440*7836SJohn.Forte@Sun.COM struct kstat_named fcips_notmds; 441*7836SJohn.Forte@Sun.COM struct kstat_named fcips_notbufs; 442*7836SJohn.Forte@Sun.COM struct kstat_named fcips_norbufs; 443*7836SJohn.Forte@Sun.COM struct kstat_named fcips_nocanput; 444*7836SJohn.Forte@Sun.COM struct kstat_named fcips_allocbfail; 445*7836SJohn.Forte@Sun.COM 446*7836SJohn.Forte@Sun.COM /* 447*7836SJohn.Forte@Sun.COM * required by kstat for MIB II objects(RFC 1213) 448*7836SJohn.Forte@Sun.COM */ 449*7836SJohn.Forte@Sun.COM struct kstat_named fcips_rcvbytes; /* # octets received */ 450*7836SJohn.Forte@Sun.COM /* MIB - ifInOctets */ 451*7836SJohn.Forte@Sun.COM struct kstat_named fcips_xmtbytes; /* # octets xmitted */ 452*7836SJohn.Forte@Sun.COM /* MIB - ifOutOctets */ 453*7836SJohn.Forte@Sun.COM struct kstat_named fcips_multircv; /* # multicast packets */ 454*7836SJohn.Forte@Sun.COM /* delivered to upper layer */ 455*7836SJohn.Forte@Sun.COM /* MIB - ifInNUcastPkts */ 456*7836SJohn.Forte@Sun.COM struct kstat_named fcips_multixmt; /* # multicast packets */ 457*7836SJohn.Forte@Sun.COM /* requested to be sent */ 458*7836SJohn.Forte@Sun.COM /* MIB - ifOutNUcastPkts */ 459*7836SJohn.Forte@Sun.COM struct kstat_named fcips_brdcstrcv; /* # broadcast packets */ 460*7836SJohn.Forte@Sun.COM /* delivered to upper layer */ 461*7836SJohn.Forte@Sun.COM /* MIB - ifInNUcastPkts */ 462*7836SJohn.Forte@Sun.COM struct kstat_named fcips_brdcstxmt; /* # broadcast packets */ 463*7836SJohn.Forte@Sun.COM /* requested to be sent */ 464*7836SJohn.Forte@Sun.COM /* MIB - ifOutNUcastPkts */ 465*7836SJohn.Forte@Sun.COM struct kstat_named fcips_norcvbuf; /* # rcv packets discarded */ 466*7836SJohn.Forte@Sun.COM /* MIB - ifInDiscards */ 467*7836SJohn.Forte@Sun.COM struct kstat_named fcips_noxmtbuf; /* # xmt packets discarded */ 468*7836SJohn.Forte@Sun.COM /* MIB - ifOutDiscards */ 469*7836SJohn.Forte@Sun.COM }; 470*7836SJohn.Forte@Sun.COM 471*7836SJohn.Forte@Sun.COM 472*7836SJohn.Forte@Sun.COM #define FC_OFF 0x00 473*7836SJohn.Forte@Sun.COM #define DA_OFF 0x01 474*7836SJohn.Forte@Sun.COM #define SA_OFF 0x07 475*7836SJohn.Forte@Sun.COM #define DLSAP_OFF 0x0D 476*7836SJohn.Forte@Sun.COM #define SLSAP_OFF 0x0E 477*7836SJohn.Forte@Sun.COM #define ORG_OFF 0x0F 478*7836SJohn.Forte@Sun.COM #define TYPE_OFF 0x13 479*7836SJohn.Forte@Sun.COM 480*7836SJohn.Forte@Sun.COM #define FCIP_IPV4_LEN 0x04; 481*7836SJohn.Forte@Sun.COM 482*7836SJohn.Forte@Sun.COM #define FCIP_CP_IN(s, d, handle, len) (ddi_rep_get8((handle), \ 483*7836SJohn.Forte@Sun.COM (uint8_t *)(d), (uint8_t *)(s), \ 484*7836SJohn.Forte@Sun.COM (len), DDI_DEV_AUTOINCR)) 485*7836SJohn.Forte@Sun.COM 486*7836SJohn.Forte@Sun.COM #define FCIP_CP_OUT(s, d, handle, len) (ddi_rep_put8((handle), \ 487*7836SJohn.Forte@Sun.COM (uint8_t *)(s), (uint8_t *)(d), \ 488*7836SJohn.Forte@Sun.COM (len), DDI_DEV_AUTOINCR)) 489*7836SJohn.Forte@Sun.COM 490*7836SJohn.Forte@Sun.COM #define LA_ELS_FARP_REQ 0x54 491*7836SJohn.Forte@Sun.COM #define LA_ELS_FARP_REPLY 0x55 492*7836SJohn.Forte@Sun.COM 493*7836SJohn.Forte@Sun.COM /* Match address code points */ 494*7836SJohn.Forte@Sun.COM #define FARP_MATCH_RSVD 0x00 495*7836SJohn.Forte@Sun.COM #define FARP_MATCH_WW_PN 0x01 496*7836SJohn.Forte@Sun.COM #define FARP_MATCH_WW_NN 0x02 497*7836SJohn.Forte@Sun.COM #define FARP_MATCH_WW_PN_NN 0x03 498*7836SJohn.Forte@Sun.COM #define FARP_MATCH_IPv4 0x04 499*7836SJohn.Forte@Sun.COM #define FARP_MATCH_WW_PN_IPv4 0x05 500*7836SJohn.Forte@Sun.COM #define FARP_MATCH_WW_NN_IPv4 0x06 501*7836SJohn.Forte@Sun.COM #define FARP_MATCH_WW_PN_NN_IPv4 0x07 502*7836SJohn.Forte@Sun.COM 503*7836SJohn.Forte@Sun.COM /* Responder flags */ 504*7836SJohn.Forte@Sun.COM #define FARP_INIT_P_LOGI 0x0 505*7836SJohn.Forte@Sun.COM #define FARP_INIT_REPLY 0x1 506*7836SJohn.Forte@Sun.COM 507*7836SJohn.Forte@Sun.COM 508*7836SJohn.Forte@Sun.COM /* 509*7836SJohn.Forte@Sun.COM * Structure for FARP ELS request and Response 510*7836SJohn.Forte@Sun.COM */ 511*7836SJohn.Forte@Sun.COM typedef struct la_els_farp { 512*7836SJohn.Forte@Sun.COM ls_code_t ls_code; /* FARP ELS code - 0x54/0x55 */ 513*7836SJohn.Forte@Sun.COM uchar_t match_addr; /* match addr. code points */ 514*7836SJohn.Forte@Sun.COM fc_portid_t req_id; /* Requester Port_ID */ 515*7836SJohn.Forte@Sun.COM uchar_t resp_flags; /* Responder flags */ 516*7836SJohn.Forte@Sun.COM fc_portid_t dest_id; /* Responder Port_ID */ 517*7836SJohn.Forte@Sun.COM la_wwn_t req_pwwn; /* Port WWN of Requester */ 518*7836SJohn.Forte@Sun.COM la_wwn_t req_nwwn; /* Node WWN of Requester */ 519*7836SJohn.Forte@Sun.COM la_wwn_t resp_pwwn; /* Port WWN of Responder */ 520*7836SJohn.Forte@Sun.COM la_wwn_t resp_nwwn; /* Node WWN of Responder */ 521*7836SJohn.Forte@Sun.COM uchar_t req_ip[16]; /* IP address or Requester */ 522*7836SJohn.Forte@Sun.COM uchar_t resp_ip[16]; /* IP address or Responder */ 523*7836SJohn.Forte@Sun.COM } la_els_farp_t; 524*7836SJohn.Forte@Sun.COM 525*7836SJohn.Forte@Sun.COM /* 526*7836SJohn.Forte@Sun.COM * Linked list of farp responses 527*7836SJohn.Forte@Sun.COM */ 528*7836SJohn.Forte@Sun.COM struct farp_resp_list { 529*7836SJohn.Forte@Sun.COM struct farp_resp_list *farpl_next; 530*7836SJohn.Forte@Sun.COM struct farp_resp_list *farpl_prev; 531*7836SJohn.Forte@Sun.COM la_els_farp_t *farpl_resp; 532*7836SJohn.Forte@Sun.COM }; 533*7836SJohn.Forte@Sun.COM 534*7836SJohn.Forte@Sun.COM /* 535*7836SJohn.Forte@Sun.COM * FCPH Optional network Header 536*7836SJohn.Forte@Sun.COM */ 537*7836SJohn.Forte@Sun.COM typedef struct network_header { 538*7836SJohn.Forte@Sun.COM la_wwn_t net_dest_addr; 539*7836SJohn.Forte@Sun.COM la_wwn_t net_src_addr; 540*7836SJohn.Forte@Sun.COM } fcph_network_hdr_t; 541*7836SJohn.Forte@Sun.COM 542*7836SJohn.Forte@Sun.COM /* 543*7836SJohn.Forte@Sun.COM * InArp request structure 544*7836SJohn.Forte@Sun.COM */ 545*7836SJohn.Forte@Sun.COM typedef struct fcip_inarp { 546*7836SJohn.Forte@Sun.COM fcph_network_hdr_t fcip_inarp_nh; 547*7836SJohn.Forte@Sun.COM llc_snap_hdr_t fcip_inarp_snap; 548*7836SJohn.Forte@Sun.COM struct ether_arp fcip_inarp_data; 549*7836SJohn.Forte@Sun.COM } fcip_inarp_t; 550*7836SJohn.Forte@Sun.COM 551*7836SJohn.Forte@Sun.COM /* 552*7836SJohn.Forte@Sun.COM * InArp Response list 553*7836SJohn.Forte@Sun.COM */ 554*7836SJohn.Forte@Sun.COM struct inarp_resp_list { 555*7836SJohn.Forte@Sun.COM struct inarp_resp_list *inarpl_next; 556*7836SJohn.Forte@Sun.COM struct inarp_resp_list *inarpl_prev; 557*7836SJohn.Forte@Sun.COM fcip_inarp_t *inarpl_resp; 558*7836SJohn.Forte@Sun.COM }; 559*7836SJohn.Forte@Sun.COM 560*7836SJohn.Forte@Sun.COM /* 561*7836SJohn.Forte@Sun.COM * Structure to define args for esballoc frtn function 562*7836SJohn.Forte@Sun.COM */ 563*7836SJohn.Forte@Sun.COM struct fcip_esballoc_arg { 564*7836SJohn.Forte@Sun.COM fc_unsol_buf_t *buf; 565*7836SJohn.Forte@Sun.COM opaque_t phandle; 566*7836SJohn.Forte@Sun.COM frtn_t *frtnp; 567*7836SJohn.Forte@Sun.COM }; 568*7836SJohn.Forte@Sun.COM 569*7836SJohn.Forte@Sun.COM struct fcip_sendup_elem { 570*7836SJohn.Forte@Sun.COM struct fcip_sendup_elem *fcipsu_next; 571*7836SJohn.Forte@Sun.COM mblk_t *fcipsu_mp; 572*7836SJohn.Forte@Sun.COM struct fcipstr *(*fcipsu_func)(); 573*7836SJohn.Forte@Sun.COM }; 574*7836SJohn.Forte@Sun.COM 575*7836SJohn.Forte@Sun.COM 576*7836SJohn.Forte@Sun.COM /* 577*7836SJohn.Forte@Sun.COM * Having TNF probe points can be lethal during reconfiguration boot. Enable 578*7836SJohn.Forte@Sun.COM * TNF using a compile time define. 579*7836SJohn.Forte@Sun.COM */ 580*7836SJohn.Forte@Sun.COM 581*7836SJohn.Forte@Sun.COM #ifdef __lint 582*7836SJohn.Forte@Sun.COM #define FCIP_TNF_ENABLED 583*7836SJohn.Forte@Sun.COM #else 584*7836SJohn.Forte@Sun.COM #undef FCIP_TNF_ENABLED 585*7836SJohn.Forte@Sun.COM #endif 586*7836SJohn.Forte@Sun.COM 587*7836SJohn.Forte@Sun.COM #ifdef FCIP_TNF_ENABLED 588*7836SJohn.Forte@Sun.COM 589*7836SJohn.Forte@Sun.COM extern int tnf_mod_load(void); 590*7836SJohn.Forte@Sun.COM extern int tnf_mod_unload(struct modlinkage *e); 591*7836SJohn.Forte@Sun.COM 592*7836SJohn.Forte@Sun.COM #define FCIP_TNF_LOAD() (void) tnf_mod_load() 593*7836SJohn.Forte@Sun.COM #define FCIP_TNF_UNLOAD(x) (void) tnf_mod_unload(x) 594*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_0(x) TNF_PROBE_0 x 595*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_1(x) TNF_PROBE_1 x 596*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_2(x) TNF_PROBE_2 x 597*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_3(x) TNF_PROBE_3 x 598*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_4(x) TNF_PROBE_4 x 599*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_5(x) TNF_PROBE_5 x 600*7836SJohn.Forte@Sun.COM 601*7836SJohn.Forte@Sun.COM #else 602*7836SJohn.Forte@Sun.COM 603*7836SJohn.Forte@Sun.COM #define FCIP_TNF_LOAD() 604*7836SJohn.Forte@Sun.COM #define FCIP_TNF_UNLOAD(x) 605*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_0(x) 606*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_1(x) 607*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_2(x) 608*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_3(x) 609*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_4(x) 610*7836SJohn.Forte@Sun.COM #define FCIP_TNF_PROBE_5(x) 611*7836SJohn.Forte@Sun.COM 612*7836SJohn.Forte@Sun.COM #endif /* FCIP_TNF_ENABLED */ 613*7836SJohn.Forte@Sun.COM 614*7836SJohn.Forte@Sun.COM /* 615*7836SJohn.Forte@Sun.COM * Macros to help with complex TNF output 616*7836SJohn.Forte@Sun.COM */ 617*7836SJohn.Forte@Sun.COM 618*7836SJohn.Forte@Sun.COM #ifdef FCIP_TNF_ENABLED 619*7836SJohn.Forte@Sun.COM 620*7836SJohn.Forte@Sun.COM #define FCIP_TNF_BYTE_ARRAY(name, keys, detail, mesg, barray_name, \ 621*7836SJohn.Forte@Sun.COM barray, len) \ 622*7836SJohn.Forte@Sun.COM { \ 623*7836SJohn.Forte@Sun.COM TNF_PROBE_1(name, keys, detail, tnf_string, msg, mesg); \ 624*7836SJohn.Forte@Sun.COM { \ 625*7836SJohn.Forte@Sun.COM int i = 0; \ 626*7836SJohn.Forte@Sun.COM char str[65] = ""; \ 627*7836SJohn.Forte@Sun.COM char *strp = str; \ 628*7836SJohn.Forte@Sun.COM while (i < 32 && i < len) { \ 629*7836SJohn.Forte@Sun.COM (void) sprintf(strp, "%02x", \ 630*7836SJohn.Forte@Sun.COM ((char *)(barray))[i++] & 0xff); \ 631*7836SJohn.Forte@Sun.COM strp += 2; \ 632*7836SJohn.Forte@Sun.COM } \ 633*7836SJohn.Forte@Sun.COM TNF_PROBE_1(name, keys, "", \ 634*7836SJohn.Forte@Sun.COM tnf_string, barray_name, str); \ 635*7836SJohn.Forte@Sun.COM } \ 636*7836SJohn.Forte@Sun.COM } 637*7836SJohn.Forte@Sun.COM 638*7836SJohn.Forte@Sun.COM #else 639*7836SJohn.Forte@Sun.COM 640*7836SJohn.Forte@Sun.COM #define FCIP_TNF_BYTE_ARRAY(name, keys, detail, mesg, barray_name, barray, len) 641*7836SJohn.Forte@Sun.COM 642*7836SJohn.Forte@Sun.COM #endif /* FCIP_TNF_ENABLED */ 643*7836SJohn.Forte@Sun.COM 644*7836SJohn.Forte@Sun.COM /* 645*7836SJohn.Forte@Sun.COM * FC4 type setttings for Name Server registration. 646*7836SJohn.Forte@Sun.COM */ 647*7836SJohn.Forte@Sun.COM #define FC4_TYPE_WORD_POS(x) ((uchar_t)(x) >> 5) 648*7836SJohn.Forte@Sun.COM #define FC4_TYPE_BIT_POS(x) ((uchar_t)(x) & 0x1F) 649*7836SJohn.Forte@Sun.COM 650*7836SJohn.Forte@Sun.COM #ifdef __cplusplus 651*7836SJohn.Forte@Sun.COM } 652*7836SJohn.Forte@Sun.COM #endif 653*7836SJohn.Forte@Sun.COM 654*7836SJohn.Forte@Sun.COM #endif /* !_SYS_FIBRE_CHANNEL_ULP_FCIP_H */ 655