1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef LNN_LANE_DFX_H 17 #define LNN_LANE_DFX_H 18 19 #include <stdint.h> 20 #include "lnn_event.h" 21 #include "lnn_lane_link_p2p.h" 22 #include "lnn_lane_interface.h" 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 typedef enum { 29 EVENT_LANE_STAGE = 0x0, // the lane state when report lane event info 30 EVENT_LANE_HANDLE, // lane handle 31 EVENT_LANE_LINK_TYPE, // lane link type 32 EVENT_LANE_MIN_BW, // qos info lane min bw 33 EVENT_LANE_MAX_LANE_LATENCY, // qos info lane max lane latency 34 EVENT_LANE_MIN_LANE_LATENCY, // qos info lane min lane latency 35 EVENT_LANE_RTT_LEVEL, // pos info lane rtt level 36 EVENT_TRANS_TYPE, // trans type 37 EVENT_LOCAL_CAP, // local dynamic capability 38 EVENT_REMOTE_CAP, // remote dynamic capability 39 EVENT_ONLINE_STATE, // online type 40 EVENT_GUIDE_TYPE, // lane guide type 41 EVENT_GUIDE_RETRY, // is lane guide retry 42 EVENT_HML_REUSE, // is HML retry 43 EVENT_WIFI_DETECT_STATE, // wifi detect state 44 EVENT_DELAY_FREE, // is delay free 45 EVENT_32_BIT_MAX, // max index for lane event type 32-bit array 46 } LaneEventType32Bit; 47 48 typedef enum { 49 EVENT_LANE_ID = 0x0, // lane id 50 EVENT_BUILD_LINK_TIME, // lane build link time 51 EVENT_WIFI_DETECT_TIME, // wifi detect time 52 EVENT_FREE_LINK_TIME, // lane free link time 53 EVENT_64_BIT_MAX, // max index for lane event type 64-bit array 54 } LaneEventType64Bit; 55 56 typedef enum { 57 LANE_PROCESS_TYPE_UINT32 = 0x0, 58 LANE_PROCESS_TYPE_UINT64, 59 LANE_PROCESS_TYPE_BUTT, 60 } LaneProcessValueType; // indicates whether the type of the reported information is uint32_t or uint64_t 61 62 typedef enum { 63 WIFI_DETECT_SUCC, // wifi detect success 64 WIFI_DETECT_FAIL, // wifi detect fail 65 WIFI_DETECT_BUTT, 66 } WifiDetectState; 67 68 typedef struct { 69 ListNode node; 70 uint32_t laneProcessList32Bit[EVENT_32_BIT_MAX]; 71 uint64_t laneProcessList64Bit[EVENT_64_BIT_MAX]; 72 char peerNetWorkId[NETWORK_ID_BUF_LEN]; 73 } LaneProcess; 74 75 int32_t CreateLaneEventInfo(const LaneProcess *processInfo); 76 int32_t UpdateLaneEventInfo(uint32_t laneHandle, uint32_t eventType, LaneProcessValueType valueType, void *arg); 77 int32_t GetLaneEventInfo(uint32_t laneHandle, LaneProcess *laneProcess); 78 int32_t ReportLaneEventInfo(uint32_t laneHandle, int32_t result); 79 int32_t InitLaneEvent(void); 80 void DeinitLaneEvent(void); 81 82 #ifdef __cplusplus 83 } 84 #endif 85 #endif // LNN_LANE_DFX_H