1 /* 2 * SPDX-FileCopyrightText: Copyright (c) 2014-2017 NVIDIA CORPORATION & AFFILIATES. All rights reserved. 3 * SPDX-License-Identifier: MIT 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 * DEALINGS IN THE SOFTWARE. 22 */ 23 24 #ifndef _NVLINK_CTX_H_ 25 #define _NVLINK_CTX_H_ 26 27 // 28 // Link transition times in ms. 29 // TODO: Review with HW for optimal transition times; 30 // 31 #define LINK_TRANSITION_TIME_OFF 1 32 #define LINK_TRANSITION_TIME_SAFE 5 33 #define LINK_TRANSITION_TIME_HS 500 34 #define LINK_TRANSITION_TIMEOUT_IN_MS 2000 35 36 typedef struct 37 { 38 /* 39 * Lock for all core lib structures except nvlink_link structures 40 */ 41 void *topLevelLock; 42 43 /* 44 * Head of the device-list 45 */ 46 nvlink_device nv_devicelist_head; 47 48 /* 49 * Head of the established intranode nvlink connections list 50 */ 51 nvlink_intranode_conn nv_intraconn_head; 52 53 /* 54 * Head of the added internode nvlink connections list 55 */ 56 nvlink_internode_conn nv_interconn_head; 57 58 /* 59 * Topology information 60 * registeredEndpoints : #Endpoints registered in the core library 61 * connectedEndpoints : #Endpoints whose remote has been determined 62 * notConnectedEndpoints: #Endpoints whose remote has not been determined 63 */ 64 NvU32 registeredEndpoints; 65 NvU32 connectedEndpoints; 66 NvU32 notConnectedEndpoints; 67 NvBool bNewEndpoints; 68 69 /* 70 * Endpoint count in different link states 71 * endpointsInSafe : #Endpoints in SAFE state 72 * endpointsInFail : #Endpoints that failed to transition to ACTIVE 73 * endpointsInActive: #Endpoints in ACTIVE 74 */ 75 NvU32 endpointsInSafe; 76 NvU32 endpointsInFail; 77 NvU32 endpointsInActive; 78 79 /* 80 * Fabric node id set by ioctl interface. This id will be assigned to each 81 * nvlink device during registration and matched for endpoint look-up on 82 * ioctls, which operate on endpoints. 83 */ 84 NvU16 nodeId; 85 }nvlink_lib_context; 86 87 extern nvlink_lib_context nvlinkLibCtx; 88 89 #endif //_NVLINK_CTX_H_ 90 91