1 /*-
2 * Copyright (c) 2017 Broadcom. All rights reserved.
3 * The term "Broadcom" refers to Broadcom Limited and/or its subsidiaries.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $FreeBSD$
32 */
33
34 /**
35 * @file
36 * Node state machine functions for remote device node sm
37 */
38
39 #if !defined(__OCS_DEVICE_H__)
40 #define __OCS_DEVICE_H__
41
42 /***************************************************************************
43 * Receive queue configuration
44 */
45
46 #ifndef OCS_FC_RQ_SIZE_DEFAULT
47 #define OCS_FC_RQ_SIZE_DEFAULT 1024
48 #endif
49
50 /***************************************************************************
51 * IO Configuration
52 */
53
54 /**
55 * @brief Defines the number of SGLs allocated on each IO object
56 */
57 #ifndef OCS_FC_MAX_SGL
58 #define OCS_FC_MAX_SGL 128
59 #endif
60
61 /***************************************************************************
62 * DIF Configuration
63 */
64
65 /**
66 * @brief Defines the DIF seed value used for the CRC calculation.
67 */
68 #ifndef OCS_FC_DIF_SEED
69 #define OCS_FC_DIF_SEED 0
70 #endif
71
72 /***************************************************************************
73 * Timeouts
74 */
75 #ifndef OCS_FC_ELS_SEND_DEFAULT_TIMEOUT
76 #define OCS_FC_ELS_SEND_DEFAULT_TIMEOUT 0
77 #endif
78
79 #ifndef OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT
80 #define OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT 5
81 #endif
82
83 #ifndef OCS_FC_ELS_DEFAULT_RETRIES
84 #define OCS_FC_ELS_DEFAULT_RETRIES 3
85 #endif
86
87 #ifndef OCS_FC_FLOGI_TIMEOUT_SEC
88 #define OCS_FC_FLOGI_TIMEOUT_SEC 5 /* shorter than default */
89 #endif
90
91 #ifndef OCS_FC_DOMAIN_SHUTDOWN_TIMEOUT_USEC
92 #define OCS_FC_DOMAIN_SHUTDOWN_TIMEOUT_USEC 30000000 /* 30 seconds */
93 #endif
94
95 /***************************************************************************
96 * Watermark
97 */
98 #ifndef OCS_WATERMARK_HIGH_PCT
99 #define OCS_WATERMARK_HIGH_PCT 90
100 #endif
101 #ifndef OCS_WATERMARK_LOW_PCT
102 #define OCS_WATERMARK_LOW_PCT 80
103 #endif
104 #ifndef OCS_IO_WATERMARK_PER_INITIATOR
105 #define OCS_IO_WATERMARK_PER_INITIATOR 8
106 #endif
107
108 extern void ocs_node_init_device(ocs_node_t *node, int send_plogi);
109 extern void ocs_process_prli_payload(ocs_node_t *node, fc_prli_payload_t *prli);
110 extern void ocs_d_send_prli_rsp(ocs_io_t *io, uint16_t ox_id);
111 extern void ocs_send_ls_acc_after_attach(ocs_io_t *io, fc_header_t *hdr, ocs_node_send_ls_acc_e ls);
112
113 extern void*__ocs_d_wait_loop(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
114 extern void*__ocs_d_wait_plogi_acc_cmpl(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
115 extern void*__ocs_d_init(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
116 extern void*__ocs_d_wait_plogi_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
117 extern void*__ocs_d_wait_plogi_rsp_recvd_prli(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
118 extern void*__ocs_d_wait_domain_attach(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
119 extern void*__ocs_d_wait_topology_notify(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
120 extern void*__ocs_d_wait_node_attach(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
121 extern void*__ocs_d_wait_attach_evt_shutdown(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
122 extern void*__ocs_d_initiate_shutdown(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
123 extern void*__ocs_d_port_logged_in(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
124 extern void*__ocs_d_wait_logo_acc_cmpl(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
125 extern void*__ocs_d_device_ready(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
126 extern void*__ocs_d_device_gone(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
127 extern void*__ocs_d_wait_adisc_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
128 extern void*__ocs_d_wait_logo_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
129 extern void*__ocs_d_wait_prlo_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg);
130
131 #endif /* __OCS_DEVICE_H__ */
Cache object: 99d782826317a1e0e78a04d5669c5da4
|