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 32 /** 33 * @file 34 * Node state machine functions for remote device node sm 35 */ 36 37 #if !defined(__OCS_DEVICE_H__) 38 #define __OCS_DEVICE_H__ 39 40 /*************************************************************************** 41 * Receive queue configuration 42 */ 43 44 #ifndef OCS_FC_RQ_SIZE_DEFAULT 45 #define OCS_FC_RQ_SIZE_DEFAULT 1024 46 #endif 47 48 /*************************************************************************** 49 * IO Configuration 50 */ 51 52 /** 53 * @brief Defines the number of SGLs allocated on each IO object 54 */ 55 #ifndef OCS_FC_MAX_SGL 56 #define OCS_FC_MAX_SGL 256 57 #endif 58 59 /*************************************************************************** 60 * DIF Configuration 61 */ 62 63 /** 64 * @brief Defines the DIF seed value used for the CRC calculation. 65 */ 66 #ifndef OCS_FC_DIF_SEED 67 #define OCS_FC_DIF_SEED 0 68 #endif 69 70 /*************************************************************************** 71 * Timeouts 72 */ 73 #ifndef OCS_FC_ELS_SEND_DEFAULT_TIMEOUT 74 #define OCS_FC_ELS_SEND_DEFAULT_TIMEOUT 0 75 #endif 76 77 #ifndef OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT 78 #define OCS_FC_ELS_CT_SEND_DEFAULT_TIMEOUT 5 79 #endif 80 81 #ifndef OCS_FC_ELS_DEFAULT_RETRIES 82 #define OCS_FC_ELS_DEFAULT_RETRIES 3 83 #endif 84 85 #ifndef OCS_FC_FLOGI_TIMEOUT_SEC 86 #define OCS_FC_FLOGI_TIMEOUT_SEC 5 /* shorter than default */ 87 #endif 88 89 #ifndef OCS_FC_DOMAIN_SHUTDOWN_TIMEOUT_USEC 90 #define OCS_FC_DOMAIN_SHUTDOWN_TIMEOUT_USEC 30000000 /* 30 seconds */ 91 #endif 92 93 /*************************************************************************** 94 * Watermark 95 */ 96 #ifndef OCS_WATERMARK_HIGH_PCT 97 #define OCS_WATERMARK_HIGH_PCT 90 98 #endif 99 #ifndef OCS_WATERMARK_LOW_PCT 100 #define OCS_WATERMARK_LOW_PCT 80 101 #endif 102 #ifndef OCS_IO_WATERMARK_PER_INITIATOR 103 #define OCS_IO_WATERMARK_PER_INITIATOR 8 104 #endif 105 106 extern void ocs_node_init_device(ocs_node_t *node, int send_plogi); 107 extern void ocs_process_prli_payload(ocs_node_t *node, fc_prli_payload_t *prli); 108 extern void ocs_d_send_prli_rsp(ocs_io_t *io, uint16_t ox_id); 109 extern void ocs_send_ls_acc_after_attach(ocs_io_t *io, fc_header_t *hdr, ocs_node_send_ls_acc_e ls); 110 111 extern void*__ocs_d_wait_loop(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 112 extern void*__ocs_d_wait_plogi_acc_cmpl(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 113 extern void*__ocs_d_init(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 114 extern void*__ocs_d_wait_plogi_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 115 extern void*__ocs_d_wait_plogi_rsp_recvd_prli(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 116 extern void*__ocs_d_wait_domain_attach(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 117 extern void*__ocs_d_wait_topology_notify(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 118 extern void*__ocs_d_wait_node_attach(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 119 extern void*__ocs_d_wait_attach_evt_shutdown(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 120 extern void*__ocs_d_initiate_shutdown(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 121 extern void*__ocs_d_port_logged_in(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 122 extern void*__ocs_d_wait_logo_acc_cmpl(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 123 extern void*__ocs_d_device_ready(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 124 extern void*__ocs_d_device_gone(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 125 extern void*__ocs_d_wait_adisc_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 126 extern void*__ocs_d_wait_logo_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 127 extern void*__ocs_d_wait_prlo_rsp(ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg); 128 129 #endif /* __OCS_DEVICE_H__ */ 130