fcip.h revision fcf3ce441efd61da9bb2884968af01cb7c1452cc
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FIBRE_CHANNEL_ULP_FCIP_H
#define _SYS_FIBRE_CHANNEL_ULP_FCIP_H
/*
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Definitions for module_info.
*/
#define FCIPMINPSZ (0) /* min packet size */
sizeof (fcph_network_hdr_t))
/*
* Per-Stream instance state information.
*
* Each instance is dynamically allocated at open() and free'd
* at close(). Each per-Stream instance points to at most one
* per-device structure using the sl_fcip field. All instances
* are threaded together into one list of active instances
* ordered on minor device number.
*/
struct fcipstr {
};
/* per-stream flags */
/*
* Maximum # of multicast addresses per Stream.
*/
#define FCIPMAXMC 64
/*
* Full DLSAP address length (in struct dladdr format).
*/
typedef struct fcip_port_info {
struct modlinkage fcipp_linkage;
int fcipp_fca_pkt_size;
#define FCIP_SUCCESS (0)
#define FCIP_FAILURE (1)
/*
* Num ports supported for soft_state_init
*/
#define FCIP_NUM_INSTANCES 5
#define FCIP_UB_NBUFS 60
#define FCIP_UB_SIZE 65535
#define FCIP_UB_DECREMENT 4
#define FCIP_UB_MINBUFS 8
/*
* Hash lists
*/
#define FCIP_RT_HASH_ELEMS 32
#define FCIP_DEST_HASH_ELEMS 16
& (FCIP_RT_HASH_ELEMS - 1))
& (FCIP_DEST_HASH_ELEMS - 1))
#define FCIP_HDR_SIZE 8
#define FCIP_RT_INVALID (-1)
#define FCIP_RT_RETIRED (-2)
#define FCIP_RT_SUSPENDED (-3)
#define FCIP_RT_LOGIN_PROGRESS (-4)
((state) == FCIP_RT_RETIRED) || \
/*
* Taskq related
*/
#define FCIP_NUM_THREADS 4
#define FCIP_MIN_TASKS 12
#define FCIP_MAX_TASKS 32
/*
* Per-Device instance state information.
*
* Each instance is dynamically allocated on first attach.
*/
struct fcip {
int fcip_instance; /* parent's instance */
int fcip_farp_rsp_flag; /* FARP response flag */
/* hash table of remote dest. ports */
/* hash table of WWN to D_ID maps */
int fcip_intr_flag; /* init. flag for fcipintr() */
int fcip_sendup_thr_initted; /* sendup tq thread */
int fcip_tx_lbolt; /* time of last tx interrupt */
int fcip_rx_lbolt; /* time of last rx interrupt */
/*
* MIB II variables
*/
/* #ipkts pending call back */
};
#define FCIP_FACTADDR_PRESENT 0x01
#define FCIP_FACTADDR_USE 0x02
/* flags */
#define FCIP_RUNNING 0x01
#define FCIP_INITED 0x02
#define FCIP_PROMISC 0x04
#define FCIP_SUSPENDED 0x08
#define FCIP_NOTIMEOUTS 0x10
#define FCIP_DETACHING 0x20
#define FCIP_DETACHED 0x40
#define FCIP_ATTACHING 0x80
#define FCIP_LINK_DOWN 0x100
#define FCIP_IN_SC_CB 0x200
#define FCIP_IN_DATA_CB 0x400
#define FCIP_IN_ELS_CB 0x800
#define FCIP_IN_TIMEOUT 0x1000
#define FCIP_POWER_DOWN 0x2000
#define FCIP_RTE_REMOVING 0x4000
#define FCIP_REG_INPROGRESS 0x8000
/* macro for checking any callback */
/* macro for checking if a port is busy */
#define FCIP_PORT_BUSY (FCIP_ATTACHING | \
/*
* FCIP routing table maintains the FC Layer and the ARP layer
* mapping for a destination port.
*/
struct fcip_routing_table {
void *fcipr_pd; /* pointer to port device struct */
int fcipr_state; /* login state etc */
};
#define FCIP_COMPARE_NWWN 0x001
#define FCIP_COMPARE_PWWN 0x010
#define FCIP_COMPARE_BROADCAST 0x100
/*
* Define a fcip_pkt structure. We can stuff information about
* the message block and queue for which the packet was built. We can
* then free up the message once the transport layer has confirmed
* that the packet has been successfully transported.
*/
typedef struct fcip_pkt {
} fcip_pkt_t;
/* fcipp_dma_flags */
#define FCIP_CMD_DMA_MEM 0x01
#define FCIP_CMD_DMA_BOUND 0x02
#define FCIP_RESP_DMA_MEM 0x04
#define FCIP_RESP_DMA_BOUND 0x08
/* fcipp_flags */
#define FCIP_PKT_INTERNAL 0x01
#define FCIP_PKT_IN_TIMEOUT 0x02
#define FCIP_PKT_RETURNED 0x04
#define FCIP_PKT_IN_LIST 0x08
#define FCIP_PKT_IN_ABORT 0x10
/*
* For each remote port we have a active session with (logged in and
* having active exchanges) setup a Destination Port structure. Maintain
* a Hash list of destination structures in the fcip structure. Before
* starting a new session with the destination port, lookup the hash
* table to see if we are already having active exchanges with a remote
* port and if yes bump the reference count and continue use the same
* destination port. Hash on Port WWNs.
*/
struct fcip_dest {
struct fcip_routing_table *fcipd_rtable;
};
#define FCIP_PORT_OFFLINE 0
#define FCIP_PORT_ONLINE 1
#define FCIP_PORT_NOTLOGGED 2
#define FCIP_INVALID_WWN -1
/*
* Private DLPI full dlsap address format.
*/
struct fcipdladdr {
struct ether_addr dl_phys;
};
typedef struct llc_snap_hdr {
/*
* "Export" a few of the error counters via the kstats mechanism.
*/
struct fcipstat {
struct kstat_named fcips_ipackets;
struct kstat_named fcips_ierrors;
struct kstat_named fcips_opackets;
struct kstat_named fcips_oerrors;
struct kstat_named fcips_collisions;
struct kstat_named fcips_defer;
struct kstat_named fcips_fram;
struct kstat_named fcips_crc;
struct kstat_named fcips_oflo;
struct kstat_named fcips_uflo;
struct kstat_named fcips_missed;
struct kstat_named fcips_tlcol;
struct kstat_named fcips_trtry;
struct kstat_named fcips_tnocar;
struct kstat_named fcips_inits;
struct kstat_named fcips_notmds;
struct kstat_named fcips_notbufs;
struct kstat_named fcips_norbufs;
struct kstat_named fcips_nocanput;
struct kstat_named fcips_allocbfail;
/*
* required by kstat for MIB II objects(RFC 1213)
*/
/* MIB - ifInOctets */
/* MIB - ifOutOctets */
/* delivered to upper layer */
/* MIB - ifInNUcastPkts */
/* requested to be sent */
/* MIB - ifOutNUcastPkts */
/* delivered to upper layer */
/* MIB - ifInNUcastPkts */
/* requested to be sent */
/* MIB - ifOutNUcastPkts */
/* MIB - ifInDiscards */
/* MIB - ifOutDiscards */
};
#define FC_OFF 0x00
#define DA_OFF 0x01
#define SA_OFF 0x07
#define DLSAP_OFF 0x0D
#define SLSAP_OFF 0x0E
#define ORG_OFF 0x0F
#define TYPE_OFF 0x13
#define FCIP_IPV4_LEN 0x04;
(len), DDI_DEV_AUTOINCR))
(len), DDI_DEV_AUTOINCR))
#define LA_ELS_FARP_REQ 0x54
#define LA_ELS_FARP_REPLY 0x55
/* Match address code points */
#define FARP_MATCH_RSVD 0x00
#define FARP_MATCH_WW_PN 0x01
#define FARP_MATCH_WW_NN 0x02
#define FARP_MATCH_WW_PN_NN 0x03
#define FARP_MATCH_IPv4 0x04
#define FARP_MATCH_WW_PN_IPv4 0x05
#define FARP_MATCH_WW_NN_IPv4 0x06
#define FARP_MATCH_WW_PN_NN_IPv4 0x07
/* Responder flags */
#define FARP_INIT_P_LOGI 0x0
#define FARP_INIT_REPLY 0x1
/*
* Structure for FARP ELS request and Response
*/
typedef struct la_els_farp {
/*
* Linked list of farp responses
*/
struct farp_resp_list {
struct farp_resp_list *farpl_next;
struct farp_resp_list *farpl_prev;
};
/*
* FCPH Optional network Header
*/
typedef struct network_header {
/*
* InArp request structure
*/
typedef struct fcip_inarp {
struct ether_arp fcip_inarp_data;
} fcip_inarp_t;
/*
* InArp Response list
*/
struct inarp_resp_list {
struct inarp_resp_list *inarpl_next;
struct inarp_resp_list *inarpl_prev;
};
/*
* Structure to define args for esballoc frtn function
*/
struct fcip_esballoc_arg {
};
struct fcip_sendup_elem {
struct fcip_sendup_elem *fcipsu_next;
struct fcipstr *(*fcipsu_func)();
};
/*
* Having TNF probe points can be lethal during reconfiguration boot. Enable
* TNF using a compile time define.
*/
#ifdef __lint
#define FCIP_TNF_ENABLED
#else
#endif
#ifdef FCIP_TNF_ENABLED
extern int tnf_mod_load(void);
extern int tnf_mod_unload(struct modlinkage *e);
#define FCIP_TNF_LOAD() (void) tnf_mod_load()
#define FCIP_TNF_UNLOAD(x) (void) tnf_mod_unload(x)
#define FCIP_TNF_PROBE_0(x) TNF_PROBE_0 x
#define FCIP_TNF_PROBE_1(x) TNF_PROBE_1 x
#define FCIP_TNF_PROBE_2(x) TNF_PROBE_2 x
#define FCIP_TNF_PROBE_3(x) TNF_PROBE_3 x
#define FCIP_TNF_PROBE_4(x) TNF_PROBE_4 x
#define FCIP_TNF_PROBE_5(x) TNF_PROBE_5 x
#else
#define FCIP_TNF_LOAD()
#define FCIP_TNF_UNLOAD(x)
#define FCIP_TNF_PROBE_0(x)
#define FCIP_TNF_PROBE_1(x)
#define FCIP_TNF_PROBE_2(x)
#define FCIP_TNF_PROBE_3(x)
#define FCIP_TNF_PROBE_4(x)
#define FCIP_TNF_PROBE_5(x)
#endif /* FCIP_TNF_ENABLED */
/*
* Macros to help with complex TNF output
*/
#ifdef FCIP_TNF_ENABLED
{ \
{ \
int i = 0; \
while (i < 32 && i < len) { \
((char *)(barray))[i++] & 0xff); \
strp += 2; \
} \
} \
}
#else
#endif /* FCIP_TNF_ENABLED */
/*
* FC4 type setttings for Name Server registration.
*/
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FIBRE_CHANNEL_ULP_FCIP_H */