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