Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2015, The Linux Foundation. All rights reserved. |
| 2 | |
| 3 | Redistribution and use in source and binary forms, with or without |
| 4 | modification, are permitted provided that the following conditions are |
| 5 | met: |
| 6 | * Redistributions of source code must retain the above copyright |
| 7 | notice, this list of conditions and the following disclaimer. |
| 8 | * Redistributions in binary form must reproduce the above |
| 9 | copyright notice, this list of conditions and the following |
| 10 | disclaimer in the documentation and/or other materials provided |
| 11 | with the distribution. |
| 12 | * Neither the name of The Linux Foundation nor the names of its |
| 13 | contributors may be used to endorse or promote products derived |
| 14 | from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef GLINK_INTERNAL_H |
| 30 | #define GLINK_INTERNAL_H |
| 31 | |
| 32 | /*=========================================================================== |
| 33 | |
| 34 | GLink Core Internal Header File |
| 35 | |
| 36 | ===========================================================================*/ |
| 37 | |
| 38 | /*=========================================================================== |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 39 | INCLUDE FILES |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 40 | ===========================================================================*/ |
| 41 | #include "smem_list.h" |
| 42 | #include "glink.h" |
| 43 | #include "glink_os_utils.h" |
| 44 | #include "glink_core_if.h" |
| 45 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 46 | #ifdef __cplusplus |
| 47 | extern "C" { |
| 48 | #endif |
| 49 | |
| 50 | /*=========================================================================== |
| 51 | FEATURE DEFINITIONS |
| 52 | ===========================================================================*/ |
| 53 | #define GLINK_VERSION 0 |
| 54 | #define GLINK_FEATURE_FLAGS 0 |
| 55 | #define GLINK_NUM_HOSTS 7 |
Steven Cahail | 338e2f2 | 2015-08-24 15:11:53 -0600 | [diff] [blame] | 56 | #define GLINK_INVALID_CID 0 |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 57 | |
| 58 | /*=========================================================================== |
| 59 | MACRO DEFINITIONS |
| 60 | ===========================================================================*/ |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 61 | |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 62 | /* Macros to enable/select glink logging and stats collection |
| 63 | * GLINK_MEMORY_LOGGING --> Enable memory based logging |
| 64 | * GLINK_OS_DEFINED_LOGGING --> Enable OS defined logging (uLog for ADSP/MPSS/SLPI) |
| 65 | * These will be selectively defined by the top level Glink Scons file |
| 66 | */ |
| 67 | /**** Logging macros GLINK_LOG_* ****/ |
| 68 | #if defined(GLINK_MEMORY_LOGGING) |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 69 | #define GLINK_MEM_LOG_SIZE 128 |
| 70 | |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 71 | /* Used for xport logging where channel name information is unavaliable */ |
| 72 | #define GLINK_LOG_EVENT_NO_FILTER(type, ch_name, xport, remote_ss, param) \ |
| 73 | glink_mem_log(type, ch_name, xport, remote_ss, param); |
| 74 | |
| 75 | /* Filtering based on ch_ctx, If ch_ctx is not available we should be using |
| 76 | *_NO_FILTER macro for logging */ |
| 77 | #define GLINK_LOG_EVENT(chnl_ctx, type, ch_name, xport, remote_ss, param) \ |
| 78 | if ((log_filter_cfg.ch_filter_status == FALSE) || \ |
| 79 | ((chnl_ctx) == log_filter_cfg.ch_ctx)) \ |
| 80 | { \ |
| 81 | glink_mem_log(type, ch_name, xport, remote_ss, param); \ |
| 82 | } |
| 83 | |
| 84 | #define GLINK_LOG_ERROR_EVENT(type, ch_name, xport, remote_ss, param) \ |
| 85 | glink_mem_log(type, ch_name, xport, remote_ss, param); |
| 86 | |
| 87 | #elif defined(GLINK_OS_DEFINED_LOGGING) |
| 88 | |
| 89 | /* Used for xport logging where channel name information is unavaliable */ |
| 90 | #define GLINK_LOG_EVENT_NO_FILTER(type, ch_name, xport, remote_ss, param) \ |
| 91 | OS_LOG_MSG(5, "[%x, %s, %s, %s, %x]" , type, ch_name, \ |
| 92 | xport, remote_ss, param); |
| 93 | |
| 94 | /* Filtering based on ch_ctx, If ch_ctx is not available we should be using |
| 95 | *_NO_FILTER macro for logging */ |
| 96 | #define GLINK_LOG_EVENT(chnl_ctx, type, ch_name, xport, remote_ss, param) \ |
| 97 | if ((log_filter_cfg.ch_filter_status == FALSE) || \ |
| 98 | ((chnl_ctx) == log_filter_cfg.ch_ctx)) \ |
| 99 | { \ |
| 100 | OS_LOG_MSG(5, "[%x, %s, %s, %s, %x]" , type, ch_name, \ |
| 101 | xport, remote_ss, param); \ |
| 102 | } |
| 103 | |
| 104 | #define GLINK_LOG_ERROR_EVENT(type, ch_name, xport, remote_ss, param) \ |
| 105 | OS_LOG_ERROR(5, "[%x, %s, %s, %s, %x]" , type, ch_name, \ |
| 106 | xport, remote_ss, param); |
| 107 | #else |
| 108 | #define GLINK_LOG_EVENT(lcid, type, ch_name, xport, remote_ss, param) |
| 109 | #define GLINK_LOG_ERROR_EVENT(type, ch_name, xport, remote_ss, param) |
| 110 | #define GLINK_LOG_EVENT_NO_FILTER(type, ch_name, xport, remote_ss, param) |
| 111 | #endif |
| 112 | |
| 113 | /**** Macros used for collecting channel stats ****/ |
| 114 | #if defined(GLINK_CHANNEL_STATS_ENABLED) |
| 115 | #define GLINK_UPDATE_CHANNEL_STATS(ch_stats, var_name, size_in_bytes) \ |
| 116 | { \ |
| 117 | (ch_stats).var_name##_count++; \ |
| 118 | (ch_stats).var_name##_bytes += (size_in_bytes); \ |
| 119 | } |
| 120 | #else |
| 121 | #define GLINK_UPDATE_CHANNEL_STATS(ch_stats, var_name, size_in_bytes) |
| 122 | #endif |
| 123 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 124 | /*=========================================================================== |
| 125 | TYPE DEFINITIONS |
| 126 | ===========================================================================*/ |
| 127 | typedef enum { |
| 128 | GLINK_EVENT_INIT, |
| 129 | GLINK_EVENT_REGISTER_XPORT, |
| 130 | GLINK_EVENT_CH_OPEN, |
| 131 | GLINK_EVENT_CH_CLOSE, |
| 132 | GLINK_EVENT_CH_TX, |
| 133 | GLINK_EVENT_CH_Q_RX_INTENT, |
| 134 | GLINK_EVENT_CH_RX_DONE, |
| 135 | GLINK_EVENT_LINK_UP, |
| 136 | GLINK_EVENT_RX_CMD_VER, |
| 137 | GLINK_EVENT_RM_CH_OPEN, |
| 138 | GLINK_EVENT_CH_OPEN_ACK, |
| 139 | GLINK_EVENT_CH_CLOSE_ACK, |
| 140 | GLINK_EVENT_CH_REMOTE_CLOSE, |
| 141 | GLINK_EVENT_CH_STATE_TRANS, |
| 142 | GLINK_EVENT_CH_INTENT_PUT, |
| 143 | GLINK_EVENT_CH_RX_DATA, |
| 144 | GLINK_EVENT_CH_RX_DATA_FRAG, |
| 145 | GLINK_EVENT_CH_GET_PKT_CTX, |
| 146 | GLINK_EVENT_CH_PUT_PKT_CTX, |
| 147 | GLINK_EVENT_CH_TX_DONE, |
| 148 | GLINK_EVENT_CH_SIG_SET, |
| 149 | GLINK_EVENT_CH_SIG_L_GET, |
| 150 | GLINK_EVENT_CH_SIG_R_GET, |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 151 | GLINK_EVENT_CH_NO_MIGRATION, |
| 152 | GLINK_EVENT_CH_MIGRATION_IN_PROGRESS, |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 153 | GLINK_EVENT_XPORT_INTERNAL, |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 154 | GLINK_EVENT_TRACER_PKT_FAILURE, |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 155 | GLINK_EVENT_TXV_INVALID_BUFFER, |
| 156 | GLINK_EVENT_CH_QOS_REG, |
| 157 | GLINK_EVENT_CH_QOS_CANCEL, |
| 158 | GLINK_EVENT_CH_QOS_START, |
| 159 | GLINK_EVENT_CH_QOS_STOP, |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 160 | GLINK_EVENT_INVALID_REMOTE_SS, |
| 161 | GLINK_EVENT_REGISTER_LINK_STATE_CB, |
| 162 | GLINK_EVENT_DEREGISTER_LINK_STATE_CB, |
Steven Cahail | 7af13a0 | 2015-08-24 16:40:24 -0600 | [diff] [blame] | 163 | GLINK_EVENT_LB_CLIENT, |
| 164 | GLINK_EVENT_SSR |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 165 | }glink_log_event_type; |
| 166 | |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 167 | /*Bit index of logging mask of differnt xport. The corresponding bit index |
| 168 | in glink_xport_log_filter_mask will disable(0) or enable(1) logging*/ |
| 169 | typedef enum { |
| 170 | GLINK_XPORT_RPM_MASK_BIT, |
| 171 | GLINK_XPORT_SMEM_MASK_BIT, |
| 172 | GLINK_XPORT_SMD_MASK_BIT, |
| 173 | GLINK_XPORT_UART_MASK_BIT |
| 174 | }glink_xport_logging_mask_type; |
| 175 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 176 | typedef struct _glink_channel_intents_type { |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 177 | |
| 178 | /* Link for a channel in Tx queue */ |
| 179 | struct _glink_channel_intents_type* next; |
| 180 | |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 181 | /* Pointer to channel context */ |
| 182 | glink_channel_ctx_type *ch_ctx; |
| 183 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 184 | /* Critical section to protest access to intent queues */ |
| 185 | os_cs_type intent_q_cs; |
| 186 | |
| 187 | /* Event that glink_tx waits on and blocks until remote rx_intents |
| 188 | * are available */ |
| 189 | os_event_type rm_intent_avail_evt; |
| 190 | |
| 191 | /* Size of requested intent that this channel wait on */ |
| 192 | size_t rm_intent_req_size; |
| 193 | |
| 194 | /* Linked list of remote Rx intents. Data can be transmitted only when |
| 195 | * remote intents are available */ |
| 196 | smem_list_type remote_intent_q; |
| 197 | |
| 198 | /* Linked list of remote Rx intents which local GLink core has used to |
| 199 | * transmit data, and are pending Tx complete */ |
| 200 | smem_list_type remote_intent_pending_tx_q; |
| 201 | |
| 202 | /* Linked list of local Rx intents. Data can be received only when |
| 203 | * local intents are available */ |
| 204 | smem_list_type local_intent_q; |
| 205 | |
| 206 | /* Linked list of remote Rx intents held by the clients */ |
| 207 | smem_list_type local_intent_client_q; |
| 208 | |
| 209 | /* Read intent being gathered */ |
| 210 | glink_rx_intent_type *cur_read_intent; |
| 211 | |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 212 | /* Linked list of Tx packets in the order they where submitted by |
| 213 | * the channel owner */ |
| 214 | smem_list_type tx_pkt_q; |
| 215 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 216 | } glink_channel_intents_type; |
| 217 | |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 218 | |
| 219 | typedef struct _glink_channel_qos_type { |
| 220 | /* qos request count */ |
| 221 | uint32 qos_req_count; |
| 222 | |
| 223 | /* qos request packet size */ |
| 224 | size_t qos_pkt_size; |
| 225 | |
| 226 | /* qos request latency */ |
| 227 | uint32 qos_latency_us; |
| 228 | |
| 229 | /* qos request rate */ |
| 230 | uint32 qos_rate; |
| 231 | |
| 232 | /* qos priority */ |
| 233 | uint32 qos_tokens; |
| 234 | |
| 235 | /* qos transport context */ |
| 236 | void *qos_transport_ctx; |
| 237 | |
| 238 | /* qos start time for priority balancing */ |
| 239 | os_timetick_type qos_start_priority_time; |
| 240 | |
| 241 | } glink_channel_qos_type; |
| 242 | |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 243 | /*This structure holds all the relevant stats per channel used for debugging*/ |
| 244 | typedef struct _glink_channel_stats_type { |
| 245 | /* Total number of bytes sent by the client */ |
| 246 | uint64 tx_request_bytes; |
| 247 | |
| 248 | /* Total number of bytes sent by the client for which we got tx_done */ |
| 249 | uint64 tx_done_bytes; |
| 250 | |
| 251 | /* Total number of tx requests */ |
| 252 | uint32 tx_request_count; |
| 253 | |
| 254 | /* total number of tx_done events */ |
| 255 | uint32 tx_done_count; |
| 256 | |
| 257 | /* Total number of bytes recieved by the client */ |
| 258 | uint64 rx_notify_bytes; |
| 259 | |
| 260 | /* Total number of bytes for which we got rx_done */ |
| 261 | uint64 rx_done_bytes; |
| 262 | |
| 263 | /* Total number of rx_notify events */ |
| 264 | uint32 rx_notify_count; |
| 265 | |
| 266 | /* Total number of rx_done events */ |
| 267 | uint32 rx_done_count; |
| 268 | |
| 269 | } glink_channel_stats_type; |
| 270 | |
| 271 | /* Contains the configuration for logging within core and xport */ |
| 272 | typedef struct _glink_logging_filter_cfg { |
| 273 | |
| 274 | /* GLink channel filter status */ |
| 275 | boolean ch_filter_status; |
| 276 | |
| 277 | /* channel filter name */ |
| 278 | char ch_name[GLINK_CH_NAME_LEN]; |
| 279 | |
| 280 | /* corresponding lcid of the filter */ |
| 281 | uint32 ch_lcid; |
| 282 | |
| 283 | /* corresponding rcid of the filter*/ |
| 284 | uint32 ch_rcid; |
| 285 | |
| 286 | /* corresponding remote host*/ |
| 287 | uint32 remote_host; |
| 288 | |
| 289 | /* Corresponding channel context */ |
| 290 | glink_channel_ctx_type *ch_ctx; |
| 291 | |
| 292 | /* xport logging mask */ |
| 293 | uint32 xport_filter_mask; |
| 294 | |
| 295 | }glink_logging_filter_cfg_type; |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 296 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 297 | struct glink_channel_ctx { |
| 298 | /* Link needed for use with list APIs. Must be at the head of the struct */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 299 | smem_list_link_type link; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 300 | |
| 301 | /* Channel name */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 302 | char name[GLINK_CH_NAME_LEN]; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 303 | |
| 304 | /* Local channel ID */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 305 | uint32 lcid; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 306 | |
| 307 | /* Remote Channel ID */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 308 | uint32 rcid; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 309 | |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 310 | /* Local Channel state */ |
| 311 | glink_local_state_type local_state; |
| 312 | |
| 313 | /* Remote channel state */ |
| 314 | glink_remote_state_type remote_state; |
| 315 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 316 | /* Channel local control signal state */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 317 | uint32 local_sigs; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 318 | |
| 319 | /* Channel remote control signal state */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 320 | uint32 remote_sigs; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 321 | |
| 322 | /* Critical section to protect tx operations */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 323 | os_cs_type tx_cs; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 324 | |
| 325 | /* channel intent collection */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 326 | glink_channel_intents_type *pintents; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 327 | |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 328 | /* Critical section to protest access to QoS context */ |
| 329 | os_cs_type qos_cs; |
| 330 | |
| 331 | /* qos priority */ |
| 332 | uint32 qos_priority; |
| 333 | |
| 334 | /* channel QoS context */ |
| 335 | glink_channel_qos_type *qosctx; |
| 336 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 337 | /* Interface pointer with with this channel is registered */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 338 | glink_transport_if_type *if_ptr; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 339 | |
| 340 | /** Private data for client to maintain context. This data is passed back |
| 341 | * to client in the notification callbacks */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 342 | const void *priv; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 343 | |
| 344 | /** Data receive notification callback */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 345 | glink_rx_notification_cb notify_rx; |
| 346 | |
| 347 | /** Tracer Packet data receive notification callback */ |
| 348 | glink_rx_tracer_pkt_notification_cb notify_rx_tracer_pkt; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 349 | |
| 350 | /** Vector receive notification callback */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 351 | glink_rxv_notification_cb notify_rxv; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 352 | |
| 353 | /** Data transmit notification callback */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 354 | glink_tx_notification_cb notify_tx_done; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 355 | |
| 356 | /** GLink channel state notification callback */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 357 | glink_state_notification_cb notify_state; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 358 | |
| 359 | /** Intent request from the remote side */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 360 | glink_notify_rx_intent_req_cb notify_rx_intent_req; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 361 | |
| 362 | /** New intent arrival from the remote side */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 363 | glink_notify_rx_intent_cb notify_rx_intent; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 364 | |
| 365 | /** Control signal change notification - Invoked when remote side |
| 366 | * alters its control signals */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 367 | glink_notify_rx_sigs_cb notify_rx_sigs; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 368 | |
| 369 | /** rx_intent abort notification. This callback would be invoked for |
| 370 | * every rx_intent that is queued with GLink core at the time the |
| 371 | * remote side or local side decides to close the port. Optional */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 372 | glink_notify_rx_abort_cb notify_rx_abort; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 373 | |
| 374 | /** tx abort notification. This callback would be invoked if client |
| 375 | * had queued a tx buffer with glink and it had not been transmitted i.e. |
| 376 | * tx_done callback has not been called for this buffer and remote side |
| 377 | * or local side closed the port. Optional */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 378 | glink_notify_tx_abort_cb notify_tx_abort; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 379 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 380 | /* save glink open config options */ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 381 | uint32 ch_open_options; |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 382 | #if defined(GLINK_CHANNEL_STATS_ENABLED) |
| 383 | /* Structure that constains per channel stats */ |
| 384 | glink_channel_stats_type ch_stats; |
| 385 | #endif |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 386 | }; |
| 387 | |
| 388 | |
| 389 | typedef struct _glink_mem_log_entry_type { |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 390 | glink_log_event_type type; |
| 391 | const char *msg; |
| 392 | const char *xport; |
| 393 | const char *remote_ss; |
| 394 | uint32 param; |
| 395 | } glink_mem_log_entry_type; |
| 396 | |
| 397 | /* Structure to store link notification callbacks */ |
| 398 | typedef struct { |
| 399 | /* Link needed for use with list APIs. Must be at the head of the struct */ |
| 400 | smem_list_link_type link; |
| 401 | |
| 402 | const char* xport; /* NULL = any transport */ |
| 403 | const char* remote_ss; /* NULL = any subsystem */ |
| 404 | glink_link_state_notif_cb link_notifier; /* Notification callback */ |
| 405 | void *priv; /* Notification priv ptr */ |
| 406 | } glink_link_notif_data_type; |
| 407 | |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 408 | |
| 409 | /* Function pointer used to iterate glink registered transports |
| 410 | * glink_client_cond_fn is used to find specifc transport client wants |
| 411 | * glink_client_ex_fn will execute client's operation on specific/all transports |
| 412 | * depends on client's choice */ |
| 413 | typedef boolean (*glink_client_cond_fn) |
| 414 | ( |
| 415 | glink_transport_if_type *if_ptr, |
| 416 | void *cond1, /* First condition to compare */ |
| 417 | uint32 cond2, /* Second condition to compare */ |
| 418 | void **out /* Client private return value */ |
| 419 | ); |
| 420 | |
| 421 | typedef void (*glink_client_ex_fn) |
| 422 | ( |
| 423 | glink_transport_if_type *if_ptr, |
| 424 | void *param1, /* First parameter */ |
| 425 | uint32 param2, /* Second parameter */ |
| 426 | void **out /* Client private return value */ |
| 427 | ); |
| 428 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 429 | /*=========================================================================== |
| 430 | GLOBAL DATA DECLARATIONS |
| 431 | ===========================================================================*/ |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 432 | extern const char *glink_hosts_supported[GLINK_NUM_HOSTS]; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 433 | |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 434 | /* Used for filtering logs*/ |
| 435 | extern glink_logging_filter_cfg_type log_filter_cfg; |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 436 | /*=========================================================================== |
| 437 | LOCAL FUNCTION DEFINITIONS |
| 438 | ===========================================================================*/ |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 439 | /*=========================================================================== |
| 440 | EXTERNAL FUNCTION DEFINITIONS |
| 441 | ===========================================================================*/ |
| 442 | /*=========================================================================== |
| 443 | FUNCTION glink_link_up |
| 444 | |
| 445 | DESCRIPTION Indicates that transport is now ready to start negotiation |
| 446 | using the v0 configuration |
| 447 | |
| 448 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 449 | for each edge |
| 450 | |
| 451 | RETURN VALUE None. |
| 452 | |
| 453 | SIDE EFFECTS None |
| 454 | ===========================================================================*/ |
| 455 | void glink_link_up |
| 456 | ( |
| 457 | glink_transport_if_type *if_ptr |
| 458 | ); |
| 459 | |
| 460 | /*=========================================================================== |
| 461 | FUNCTION glink_rx_cmd_version |
| 462 | |
| 463 | DESCRIPTION Receive transport version for remote-initiated version |
| 464 | negotiation |
| 465 | |
| 466 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 467 | for each edge |
| 468 | |
| 469 | version Remote Version |
| 470 | |
| 471 | features Remote Features |
| 472 | |
| 473 | RETURN VALUE None. |
| 474 | |
| 475 | SIDE EFFECTS None |
| 476 | ===========================================================================*/ |
| 477 | void glink_rx_cmd_version |
| 478 | ( |
| 479 | glink_transport_if_type *if_ptr, |
| 480 | uint32 version, |
| 481 | uint32 features |
| 482 | ); |
| 483 | |
| 484 | /*=========================================================================== |
| 485 | FUNCTION glink_rx_cmd_version_ack |
| 486 | |
| 487 | DESCRIPTION Receive ACK to previous glink_transport_if::tx_cmd_version |
| 488 | command |
| 489 | |
| 490 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 491 | for each edge |
| 492 | |
| 493 | version Remote Version |
| 494 | |
| 495 | features Remote Features |
| 496 | |
| 497 | RETURN VALUE None. |
| 498 | |
| 499 | SIDE EFFECTS None |
| 500 | ===========================================================================*/ |
| 501 | void glink_rx_cmd_version_ack |
| 502 | ( |
| 503 | glink_transport_if_type *if_ptr, |
| 504 | uint32 version, |
| 505 | uint32 features |
| 506 | ); |
| 507 | |
| 508 | /*=========================================================================== |
| 509 | FUNCTION glink_rx_cmd_ch_remote_open |
| 510 | |
| 511 | DESCRIPTION Receive remote channel open request; Calls |
| 512 | glink_transport_if:: tx_cmd_ch_remote_open_ack as a result |
| 513 | |
| 514 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 515 | for each edge |
| 516 | |
| 517 | rcid Remote Channel ID |
| 518 | |
| 519 | *name String name for logical channel |
| 520 | |
| 521 | prio requested xport priority from remote side |
| 522 | |
| 523 | RETURN VALUE None. |
| 524 | |
| 525 | SIDE EFFECTS None |
| 526 | ===========================================================================*/ |
| 527 | void glink_rx_cmd_ch_remote_open |
| 528 | ( |
| 529 | glink_transport_if_type *if_ptr, |
| 530 | uint32 rcid, |
| 531 | const char *name, |
| 532 | glink_xport_priority prio |
| 533 | ); |
| 534 | |
| 535 | /*=========================================================================== |
| 536 | FUNCTION glink_rx_cmd_ch_open_ack |
| 537 | |
| 538 | DESCRIPTION This function is invoked by the transport in response to |
| 539 | glink_transport_if:: tx_cmd_ch_open |
| 540 | |
| 541 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 542 | for each edge |
| 543 | |
| 544 | lcid Local Channel ID |
| 545 | |
| 546 | prio Negotiated xport priority obtained from remote side |
| 547 | after negotiation happened on remote side |
| 548 | |
| 549 | RETURN VALUE None. |
| 550 | |
| 551 | SIDE EFFECTS None |
| 552 | ===========================================================================*/ |
| 553 | void glink_rx_cmd_ch_open_ack |
| 554 | ( |
| 555 | glink_transport_if_type *if_ptr, |
| 556 | uint32 lcid, |
| 557 | glink_xport_priority prio |
| 558 | ); |
| 559 | |
| 560 | /*=========================================================================== |
| 561 | FUNCTION glink_rx_cmd_ch_close_ack |
| 562 | |
| 563 | DESCRIPTION This function is invoked by the transport in response to |
| 564 | glink_transport_if_type:: tx_cmd_ch_close |
| 565 | |
| 566 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 567 | for each edge |
| 568 | |
| 569 | lcid Local Channel ID |
| 570 | |
| 571 | RETURN VALUE None. |
| 572 | |
| 573 | SIDE EFFECTS None |
| 574 | ===========================================================================*/ |
| 575 | void glink_rx_cmd_ch_close_ack |
| 576 | ( |
| 577 | glink_transport_if_type *if_ptr, /* Pointer to the interface instance */ |
| 578 | uint32 lcid /* Local channel ID */ |
| 579 | ); |
| 580 | |
| 581 | /*=========================================================================== |
| 582 | FUNCTION glink_rx_cmd_ch_remote_close |
| 583 | |
| 584 | DESCRIPTION Remote channel close request; will result in sending |
| 585 | glink_transport_if_type:: tx_cmd_ch_remote_close_ack |
| 586 | |
| 587 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 588 | for each edge |
| 589 | |
| 590 | rcid Remote Channel ID |
| 591 | |
| 592 | RETURN VALUE None. |
| 593 | |
| 594 | SIDE EFFECTS None |
| 595 | ===========================================================================*/ |
| 596 | void glink_rx_cmd_ch_remote_close |
| 597 | ( |
| 598 | glink_transport_if_type *if_ptr, /* Pointer to the interface instance */ |
| 599 | uint32 rcid /* Remote channel ID */ |
| 600 | ); |
| 601 | |
| 602 | /*=========================================================================== |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 603 | FUNCTION glink_rx_put_pkt_ctx |
| 604 | |
| 605 | DESCRIPTION Transport invokes this call to receive a packet fragment (must |
| 606 | have previously received an rx_cmd_rx_data packet) |
| 607 | |
| 608 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 609 | for each edge |
| 610 | |
| 611 | rcid Remote Channel ID |
| 612 | |
| 613 | *intent_ptr Pointer to the intent fragment |
| 614 | |
| 615 | complete True if pkt is complete |
| 616 | |
| 617 | RETURN VALUE None |
| 618 | |
| 619 | SIDE EFFECTS None |
| 620 | ===========================================================================*/ |
| 621 | void glink_rx_put_pkt_ctx |
| 622 | ( |
| 623 | glink_transport_if_type *if_ptr, /* Pointer to the interface instance */ |
| 624 | uint32 rcid, /* Remote channel ID */ |
| 625 | glink_rx_intent_type *intent_ptr, /* Fragment ptr */ |
| 626 | boolean complete /* True if pkt is complete */ |
| 627 | ); |
| 628 | |
| 629 | /*=========================================================================== |
| 630 | FUNCTION glink_rx_cmd_remote_sigs |
| 631 | |
| 632 | DESCRIPTION Transport invokes this call to inform GLink of remote side |
| 633 | changing its control signals |
| 634 | |
| 635 | ARGUMENTS *if_ptr Pointer to interface instance; must be unique |
| 636 | for each edge |
| 637 | |
| 638 | rcid Remote Channel ID |
| 639 | |
| 640 | remote_sigs Remote signal state. |
| 641 | |
| 642 | RETURN VALUE None. |
| 643 | |
| 644 | SIDE EFFECTS None |
| 645 | ===========================================================================*/ |
| 646 | void glink_rx_cmd_remote_sigs |
| 647 | ( |
| 648 | glink_transport_if_type *if_ptr, /* Pointer to the interface instance */ |
| 649 | uint32 rcid, /* Remote channel ID */ |
| 650 | uint32 remote_sigs /* Remote control signals */ |
| 651 | ); |
| 652 | |
| 653 | /*=========================================================================== |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 654 | FUNCTION glinki_add_ch_to_xport |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 655 | ===========================================================================*/ |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 656 | /** |
| 657 | * Add remote/local channel context to xport open channel queue |
| 658 | * |
| 659 | * @param[in] if_ptr Pointer to xport if on which channel is to |
| 660 | * be opened |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 661 | * @param[in] ch_ctx channel context |
| 662 | * @param[out] allocated_ch_ctx Pointer to channel context pointer |
| 663 | * @param[in] local_open flag to determine if channel is opened |
| 664 | * locally or remotely |
| 665 | * @param[in] prio negotiated xport priority |
| 666 | * (used to send priority via remote_open_ack to |
| 667 | * remote side) |
| 668 | * |
| 669 | * @return pointer to glink_transport_if_type struct |
| 670 | * |
| 671 | * @sideeffects NONE |
| 672 | */ |
| 673 | /*=========================================================================*/ |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 674 | glink_err_type glinki_add_ch_to_xport |
| 675 | ( |
| 676 | glink_transport_if_type *if_ptr, |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 677 | glink_channel_ctx_type *ch_ctx, |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 678 | glink_channel_ctx_type **allocated_ch_ctx, |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 679 | unsigned int local_open, |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 680 | glink_xport_priority prio |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 681 | ); |
| 682 | |
| 683 | void glink_mem_log |
| 684 | ( |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 685 | glink_log_event_type type, |
| 686 | const char *msg, |
| 687 | const char *xport, |
| 688 | const char *remote_ss, |
| 689 | uint32 param |
| 690 | ); |
| 691 | |
| 692 | /*=========================================================================== |
| 693 | FUNCTION glink_core_setup |
| 694 | ===========================================================================*/ |
| 695 | /** |
| 696 | |
| 697 | Initializes internal core functions based on the transport capabilities. |
| 698 | |
| 699 | @param[in] if_ptr The Pointer to the interface instance. |
| 700 | |
| 701 | @return None. |
| 702 | |
| 703 | @sideeffects None. |
| 704 | */ |
| 705 | /*=========================================================================*/ |
| 706 | void glink_core_setup(glink_transport_if_type *if_ptr); |
| 707 | |
| 708 | /*=========================================================================== |
Sridhar Parasuram | 3b05812 | 2015-05-11 16:15:03 -0700 | [diff] [blame] | 709 | FUNCTION glink_core_get_default_interface |
| 710 | ===========================================================================*/ |
| 711 | /** |
| 712 | |
| 713 | Provides default core interface. |
| 714 | |
| 715 | @return Pointer to the default core interface. |
| 716 | |
| 717 | @sideeffects None. |
| 718 | */ |
| 719 | /*=========================================================================*/ |
| 720 | glink_core_if_type* glink_core_get_default_interface(void); |
| 721 | |
| 722 | /*=========================================================================== |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 723 | FUNCTION glink_core_setup_full_xport |
| 724 | ===========================================================================*/ |
| 725 | /** |
| 726 | |
| 727 | Initializes internal core functions for the full-featured transport. |
| 728 | |
| 729 | @param[in] if_ptr The Pointer to the interface instance. |
| 730 | |
| 731 | @return None. |
| 732 | |
| 733 | @sideeffects None. |
| 734 | */ |
| 735 | /*=========================================================================*/ |
| 736 | void glink_core_setup_full_xport(glink_transport_if_type *if_ptr); |
| 737 | |
| 738 | /*=========================================================================== |
| 739 | FUNCTION glink_core_setup_intentless_xport |
| 740 | ===========================================================================*/ |
| 741 | /** |
| 742 | |
| 743 | Initializes internal core functions for the intentless transport. |
| 744 | |
| 745 | @param[in] if_ptr The Pointer to the interface instance. |
| 746 | |
| 747 | @return None. |
| 748 | |
| 749 | @sideeffects None. |
| 750 | */ |
| 751 | /*=========================================================================*/ |
| 752 | void glink_core_setup_intentless_xport(glink_transport_if_type *if_ptr); |
| 753 | |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 754 | /*=========================================================================== |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 755 | FUNCTION glink_core_setup_intent_xport |
| 756 | ===========================================================================*/ |
| 757 | /** |
| 758 | |
| 759 | Initializes internal core functions based on the transport capabilities. |
| 760 | |
| 761 | @param[in] if_ptr The Pointer to the interface instance. |
| 762 | |
| 763 | @return None. |
| 764 | |
| 765 | @sideeffects None. |
| 766 | */ |
| 767 | /*=========================================================================*/ |
| 768 | void glink_core_setup_intent_xport(glink_transport_if_type *if_ptr); |
| 769 | |
| 770 | /*=========================================================================== |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 771 | FUNCTION glink_core_qos_get_priority |
| 772 | ===========================================================================*/ |
| 773 | /** |
| 774 | |
| 775 | Calculates pinitial priority for QoS request. |
| 776 | |
| 777 | @param[in] if_ptr The Pointer to the interface instance. |
| 778 | @param[in] req_rate The requested rate. |
| 779 | |
| 780 | @return Priority. |
| 781 | |
| 782 | @sideeffects None. |
| 783 | */ |
| 784 | /*=========================================================================*/ |
| 785 | uint32 glink_core_qos_get_priority(glink_transport_if_type *if_ptr, uint32 req_rate); |
| 786 | |
| 787 | /*=========================================================================== |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 788 | FUNCTION glinki_channel_fully_opened |
| 789 | ===========================================================================*/ |
| 790 | /** |
| 791 | * Check whether this channel is fully opened or not (local & remote) |
| 792 | * This also checks transport status |
| 793 | * |
| 794 | * @param[in] handle glink channel handle |
| 795 | * |
| 796 | * @return TRUE, if channel is fully opened |
| 797 | * FASLE, otherwise |
| 798 | * |
| 799 | * @sideeffects NONE |
| 800 | */ |
| 801 | /*=========================================================================*/ |
| 802 | boolean glinki_channel_fully_opened |
| 803 | ( |
| 804 | glink_handle_type handle |
| 805 | ); |
| 806 | |
| 807 | /*=========================================================================== |
Steven Cahail | 7978335 | 2015-08-20 15:24:04 -0600 | [diff] [blame] | 808 | FUNCTION glink_core_qos_cancel |
| 809 | ===========================================================================*/ |
| 810 | /** |
| 811 | |
| 812 | Releases QoS resources. |
| 813 | |
| 814 | @param[in] open_ch_ctx Pointer to the channel context. |
| 815 | |
| 816 | @return None. |
| 817 | |
| 818 | @sideeffects None. |
| 819 | */ |
| 820 | /*=========================================================================*/ |
| 821 | void glink_core_qos_cancel(glink_channel_ctx_type *open_ch_ctx); |
| 822 | |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 823 | /*=========================================================================== |
| 824 | FUNCTION glinki_register_link_notif_data |
| 825 | ===========================================================================*/ |
| 826 | /** |
| 827 | * Register link notification data |
| 828 | * |
| 829 | * @param[in] link_notif_data parameter for link notif data |
| 830 | * |
| 831 | * @return NONE |
| 832 | * |
| 833 | * @sideeffects NONE |
| 834 | */ |
| 835 | /*=========================================================================*/ |
| 836 | void glinki_register_link_notif_data |
| 837 | ( |
| 838 | glink_link_notif_data_type *link_notif_data |
| 839 | ); |
| 840 | |
| 841 | /*=========================================================================== |
| 842 | FUNCTION glinki_deregister_link_notif_data |
| 843 | ===========================================================================*/ |
| 844 | /** |
| 845 | * Deregister link notification data |
| 846 | * |
| 847 | * @param[in] link_notif_data parameter for link notif data |
| 848 | * |
| 849 | * @return NONE |
| 850 | * |
| 851 | * @sideeffects NONE |
| 852 | */ |
| 853 | /*=========================================================================*/ |
| 854 | void glinki_deregister_link_notif_data |
| 855 | ( |
| 856 | glink_link_notif_data_type *link_notif_data |
| 857 | ); |
| 858 | |
| 859 | /*=========================================================================== |
| 860 | FUNCTION glinki_scan_xports_and_notify |
| 861 | ===========================================================================*/ |
| 862 | /** |
| 863 | * Scan xports and notify link up state event |
| 864 | * |
| 865 | * @param[in] link_notif_data parameter for link notif data |
| 866 | * |
| 867 | * @return NONE |
| 868 | * |
| 869 | * @sideeffects NONE |
| 870 | */ |
| 871 | /*=========================================================================*/ |
| 872 | void glinki_scan_xports_and_notify |
| 873 | ( |
| 874 | glink_link_notif_data_type *link_notif_data |
| 875 | ); |
| 876 | |
| 877 | /*=========================================================================== |
| 878 | FUNCTION glinki_scan_notif_list_and_notify |
| 879 | ===========================================================================*/ |
| 880 | /** |
| 881 | * Scan registered link notification list and notify of xport link state change |
| 882 | * |
| 883 | * @param[in] if_ptr pointer to xport interface |
| 884 | * @param[in] state link state to notify |
| 885 | * |
| 886 | * @return NONE |
| 887 | * |
| 888 | * @sideeffects NONE |
| 889 | */ |
| 890 | /*=========================================================================*/ |
| 891 | void glinki_scan_notif_list_and_notify |
| 892 | ( |
| 893 | glink_transport_if_type *if_ptr, |
| 894 | glink_link_state_type state |
| 895 | ); |
| 896 | |
| 897 | /*=========================================================================== |
| 898 | FUNCTION glinki_xport_linkup |
| 899 | ===========================================================================*/ |
| 900 | /** |
| 901 | * Check whether this transport is in linkup state or not |
| 902 | * |
| 903 | * @param[in] if_ptr transport interface pointer |
| 904 | * |
| 905 | * @return TRUE if this xport is in link up state |
| 906 | * FALSE otherwise |
| 907 | * |
| 908 | * @sideeffects NONE |
| 909 | */ |
| 910 | /*=========================================================================*/ |
| 911 | boolean glinki_xport_linkup |
| 912 | ( |
| 913 | glink_transport_if_type *if_ptr |
| 914 | ); |
| 915 | |
| 916 | /*=========================================================================== |
| 917 | FUNCTION glinki_xports_for_each |
| 918 | ===========================================================================*/ |
| 919 | /** |
| 920 | * Scan all the transports in given edge and perform client's function for each |
| 921 | * transport |
| 922 | * |
| 923 | * @param[in] remote_ss name of remote subsystem, NULL string not accepted |
| 924 | * @param[in] client_ex_fn client function to perform when desired xport is |
| 925 | * found |
| 926 | * @param[in] cond1 first condition to use in client_ex_fn |
| 927 | * @param[in] cond2 second condition to use in client_ex_fn |
| 928 | * @param[out] out value to return in case client wants |
| 929 | * |
| 930 | * @return None. |
| 931 | * |
| 932 | * @sideeffects None. |
| 933 | */ |
| 934 | /*=========================================================================*/ |
| 935 | void glinki_xports_for_each |
| 936 | ( |
| 937 | const char *remote_ss, |
| 938 | glink_client_ex_fn client_ex_fn, |
| 939 | void *param1, |
| 940 | uint32 param2, |
| 941 | void **out |
| 942 | ); |
| 943 | |
| 944 | /*=========================================================================== |
| 945 | FUNCTION glinki_xports_find |
| 946 | ===========================================================================*/ |
| 947 | /** |
| 948 | * Scan all the transports in given edge and finds transport that satisfy |
| 949 | * client's condition |
| 950 | * |
| 951 | * @param[in] remote_ss name of remote subsystem, NULL string not accepted |
| 952 | * @param[in] client_cond_fn client function to check if this transport is |
| 953 | * what client is looking for |
| 954 | * @param[in] cond1 first condition to use in client_ex_fn |
| 955 | * @param[in] cond2 second condition to use in client_ex_fn |
| 956 | * @param[out] out value to return in case client wants |
| 957 | * |
| 958 | * @return pointer to glink_transport_if_type struct |
| 959 | * NULL if there isn't any xport matches client's search condition |
| 960 | * |
| 961 | * @sideeffects None. |
| 962 | */ |
| 963 | /*=========================================================================*/ |
| 964 | glink_transport_if_type *glinki_xports_find |
| 965 | ( |
| 966 | const char *remote_ss, |
| 967 | glink_client_cond_fn client_cond_fn, |
| 968 | void *cond1, |
| 969 | uint32 cond2, |
| 970 | void **out |
| 971 | ); |
| 972 | |
| 973 | /*=========================================================================== |
| 974 | FUNCTION glinki_find_ch_ctx_by_lcid |
| 975 | ===========================================================================*/ |
| 976 | /** |
| 977 | * Find channel context by lcid |
| 978 | * |
| 979 | * @param[in] xport_ctx Pointer to transport private context |
| 980 | * @param[in] lcid local channel ID |
| 981 | * |
| 982 | * @return pointer to glink channel context |
| 983 | * |
| 984 | * @sideeffects This function needs to be protected by channel_q_cs |
| 985 | * Caller is responsible grab/release mutex when calling this |
| 986 | */ |
| 987 | /*=========================================================================*/ |
| 988 | glink_channel_ctx_type *glinki_find_ch_ctx_by_lcid |
| 989 | ( |
| 990 | glink_core_xport_ctx_type *xport_ctx, |
| 991 | uint32 lcid |
| 992 | ); |
| 993 | |
| 994 | /*=========================================================================== |
| 995 | FUNCTION glinki_find_ch_ctx_by_rcid |
| 996 | ===========================================================================*/ |
| 997 | /** |
| 998 | * Find channel context by rcid |
| 999 | * |
| 1000 | * @param[in] xport_ctx Pointer to transport private context |
| 1001 | * @param[in] rcid remote channel ID |
| 1002 | * |
| 1003 | * @return pointer to glink channel context |
| 1004 | * |
| 1005 | * @sideeffects This function needs to be protected by channel_q_cs |
| 1006 | * Caller is responsible grab/release mutex when calling this |
| 1007 | */ |
| 1008 | /*=========================================================================*/ |
| 1009 | glink_channel_ctx_type *glinki_find_ch_ctx_by_rcid |
| 1010 | ( |
| 1011 | glink_core_xport_ctx_type *xport_ctx, |
| 1012 | uint32 rcid |
| 1013 | ); |
| 1014 | |
| 1015 | /*=========================================================================== |
| 1016 | FUNCTION glinki_find_ch_ctx_by_name |
| 1017 | ===========================================================================*/ |
| 1018 | /** |
Steven Cahail | 338e2f2 | 2015-08-24 15:11:53 -0600 | [diff] [blame] | 1019 | * Find channel context by channel name, called by local/remote open function |
| 1020 | * This function will also indicate (valid_open_call) if this open call would |
| 1021 | * be valid or not |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 1022 | * |
| 1023 | * @param[in] xport_ctx Pointer to transport private context |
| 1024 | * @param[in] ch_name channel name |
Steven Cahail | 338e2f2 | 2015-08-24 15:11:53 -0600 | [diff] [blame] | 1025 | * @param[in] local_open flag to indicate this is local open call |
| 1026 | * @param[out] valid_open_call tell whether this open call would be valid |
| 1027 | * or not |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 1028 | * |
| 1029 | * @return pointer to glink channel context |
| 1030 | * NULL if channel doesn't exist |
| 1031 | * |
| 1032 | * @sideeffects This function needs to be protected by channel_q_cs |
| 1033 | * Caller is responsible grab/release mutex when calling this |
| 1034 | */ |
| 1035 | /*=========================================================================*/ |
| 1036 | glink_channel_ctx_type *glinki_find_ch_ctx_by_name |
| 1037 | ( |
| 1038 | glink_core_xport_ctx_type *xport_ctx, |
Steven Cahail | 338e2f2 | 2015-08-24 15:11:53 -0600 | [diff] [blame] | 1039 | const char *ch_name, |
| 1040 | boolean local_open, |
| 1041 | boolean *valid_open_call |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 1042 | ); |
| 1043 | |
| 1044 | /*=========================================================================== |
| 1045 | FUNCTION glinki_find_remote_host |
| 1046 | ===========================================================================*/ |
| 1047 | /** |
| 1048 | * return remote subsystem ID based on remote subsystem name |
| 1049 | * |
| 1050 | * @param[in] remote_ss remote subsystem name |
| 1051 | * |
| 1052 | * @return remote subsystem ID |
| 1053 | * |
| 1054 | * @sideeffects None. |
| 1055 | */ |
| 1056 | /*=========================================================================*/ |
| 1057 | uint32 glinki_find_remote_host |
| 1058 | ( |
| 1059 | const char *remote_ss |
| 1060 | ); |
| 1061 | |
| 1062 | /*=========================================================================== |
| 1063 | FUNCTION glink_get_best_xport |
| 1064 | ===========================================================================*/ |
| 1065 | /** |
| 1066 | * This function gives best available transport for give edge |
| 1067 | * |
| 1068 | * @param[in] remote_ss Name of remote subsystem |
| 1069 | * |
| 1070 | * @return pointer to glink_transport_if_type |
| 1071 | * |
| 1072 | * @sideeffects NONE |
| 1073 | */ |
| 1074 | /*=========================================================================*/ |
| 1075 | glink_transport_if_type *glinki_find_best_xport |
| 1076 | ( |
| 1077 | const char *remote_ss |
| 1078 | ); |
| 1079 | |
| 1080 | /*=========================================================================== |
| 1081 | FUNCTION glinki_find_requested_xport |
| 1082 | ===========================================================================*/ |
| 1083 | /** |
| 1084 | * Find requested or best transport depending on client's request |
| 1085 | * |
| 1086 | * @param[in] xport_name name of transport |
| 1087 | * @param[in] remote_ss remote subsystem name |
| 1088 | * @param[in] open_ch_option option client gave when called glink_open |
| 1089 | * @param[out] suggested_priority best xport priority glink suggests |
| 1090 | * |
| 1091 | * @return pointer to glink_transport_if_type struct |
| 1092 | * |
| 1093 | * @sideeffects NONE |
| 1094 | */ |
| 1095 | /*=========================================================================*/ |
| 1096 | glink_transport_if_type *glinki_find_requested_xport |
| 1097 | ( |
| 1098 | const char *xport_name, |
| 1099 | const char *remote_ss, |
| 1100 | uint32 open_ch_option, |
| 1101 | glink_xport_priority *suggested_priority |
| 1102 | ); |
| 1103 | |
| 1104 | /*=========================================================================== |
| 1105 | FUNCTION glinki_find_xport_by_priority |
| 1106 | ===========================================================================*/ |
| 1107 | /** |
| 1108 | * This function returns glink_transport_if pointer based on transport priority |
| 1109 | * |
| 1110 | * @param[in] prio glink xport prio |
| 1111 | * @param[in] remote_ss remote subsytem name |
| 1112 | * |
| 1113 | * @return pointer to glink_transport_if_type struct |
| 1114 | * |
| 1115 | * @sideeffects NONE |
| 1116 | */ |
| 1117 | /*=========================================================================*/ |
| 1118 | glink_transport_if_type *glinki_find_xport_by_priority |
| 1119 | ( |
| 1120 | glink_xport_priority prio, |
| 1121 | const char *remote_ss |
| 1122 | ); |
| 1123 | |
| 1124 | /*=========================================================================== |
| 1125 | FUNCTION glinki_enqueue_item |
| 1126 | ===========================================================================*/ |
| 1127 | /** |
| 1128 | * Enqueue item to smem list in protected context |
| 1129 | * |
| 1130 | * @param[in] smem_list smem list to enqueue |
| 1131 | * @param[in] item item to enqueue |
| 1132 | * @param[in] cs mutex to protect the list |
| 1133 | * |
| 1134 | * @return None. |
| 1135 | * |
| 1136 | * @sideeffects None. |
| 1137 | */ |
| 1138 | /*=========================================================================*/ |
| 1139 | void glinki_enqueue_item |
| 1140 | ( |
| 1141 | smem_list_type *smem_list_ptr, |
| 1142 | void *item, |
| 1143 | os_cs_type *cs |
| 1144 | ); |
| 1145 | |
| 1146 | /*=========================================================================== |
| 1147 | FUNCTION glinki_dequeue_item |
| 1148 | ===========================================================================*/ |
| 1149 | /** |
| 1150 | * Dequeue item from smem list in protected context |
| 1151 | * |
| 1152 | * @param[in] smem_list smem list to dequeue from |
| 1153 | * @param[in] item item to dequeue |
| 1154 | * @param[in] cs mutex to protect the list |
| 1155 | * |
| 1156 | * @return None. |
| 1157 | * |
| 1158 | * @sideeffects None. |
| 1159 | */ |
| 1160 | /*=========================================================================*/ |
| 1161 | void glinki_dequeue_item |
| 1162 | ( |
| 1163 | smem_list_type *smem_list_ptr, |
| 1164 | void *item, |
| 1165 | os_cs_type *cs |
| 1166 | ); |
| 1167 | |
Steven Cahail | b850bb6 | 2015-08-21 14:39:38 -0600 | [diff] [blame] | 1168 | /*=========================================================================== |
| 1169 | FUNCTION glinki_update_logging_filter |
| 1170 | ===========================================================================*/ |
| 1171 | /** |
| 1172 | * Update/Reset the logging filter if the name and remote host of the |
| 1173 | * logging filter matches to that of the passed channel context |
| 1174 | * |
| 1175 | * @param[in] chnl_ctx Channel content to match/compare |
| 1176 | * @param[in] reset Indicate Update(FALSE) or Reset(TRUE) |
| 1177 | * |
| 1178 | * @return None. |
| 1179 | */ |
| 1180 | /*=========================================================================*/ |
| 1181 | void glinki_update_logging_filter |
| 1182 | ( |
| 1183 | glink_channel_ctx_type *chnl_ctx, |
| 1184 | boolean reset |
| 1185 | ); |
| 1186 | |
Steven Cahail | 8ff053d | 2015-08-25 09:32:12 -0600 | [diff] [blame] | 1187 | /*=========================================================================== |
| 1188 | FUNCTION glinki_acquire_edge_lock |
| 1189 | ===========================================================================*/ |
| 1190 | /** |
| 1191 | * Acquires the transport_q_cs lock for the specified edge |
| 1192 | * |
| 1193 | * @param[in] remote_ss Name of the remote sub system on the edge |
| 1194 | * |
| 1195 | * @return None. |
| 1196 | * |
| 1197 | * @sideeffects None. |
| 1198 | */ |
| 1199 | /*=========================================================================*/ |
| 1200 | void glinki_acquire_edge_lock(const char *ss_name); |
| 1201 | |
| 1202 | /*=========================================================================== |
| 1203 | FUNCTION glinki_release_edge_lock |
| 1204 | ===========================================================================*/ |
| 1205 | /** |
| 1206 | * Releases the transport_q_cs lock for the specified edge |
| 1207 | * |
| 1208 | * @param[in] remote_ss Name of the remote sub system on the edge |
| 1209 | * |
| 1210 | * @return None. |
| 1211 | * |
| 1212 | * @sideeffects None. |
| 1213 | */ |
| 1214 | /*=========================================================================*/ |
| 1215 | void glinki_release_edge_lock(const char *ss_name); |
| 1216 | |
Steven Cahail | 964ff2f | 2015-08-20 19:01:56 -0600 | [diff] [blame] | 1217 | #ifdef FEATURE_TRACER_PACKET |
| 1218 | /*=========================================================================== |
| 1219 | FUNCTION glink_tracer_packet_log_pctx_pkt |
| 1220 | ===========================================================================*/ |
| 1221 | /** |
| 1222 | * Log tracer packet event. Tracer packet is included in glink_core_tx_pkt |
| 1223 | * and needs to use vprovider to extract it |
| 1224 | * |
| 1225 | * @param[in] pctx pointer to glink_core_tx_pkt_type |
| 1226 | * @param[in] event_id event_id |
| 1227 | * |
| 1228 | * @return None |
| 1229 | * |
| 1230 | * @sideeffects None |
| 1231 | */ |
| 1232 | /*=========================================================================*/ |
| 1233 | void glink_tracer_packet_log_pctx_pkt |
| 1234 | ( |
| 1235 | glink_core_tx_pkt_type *pctx, |
| 1236 | uint32 event_id |
| 1237 | ); |
| 1238 | #endif |
| 1239 | |
Sridhar Parasuram | bf39132 | 2015-01-23 09:29:07 -0800 | [diff] [blame] | 1240 | #endif /* GLINK_INTERNAL_H */ |