* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#ifndef __DEV_MON_CMD_MANAGER_EXT_H__
#define __DEV_MON_CMD_MANAGER_EXT_H__
#if defined(CFG_SOC_PLATFORM_CLOUD_V2)
typedef struct struct_head {
char cmd_version;
char support_info[7];
} STRUCT_HEAD;
#define DMS_HCCS_INFO_RESERVED_BYTES 8
typedef struct hccs_info_struct {
unsigned int pcs_status;
unsigned char reserved[DMS_HCCS_INFO_RESERVED_BYTES];
} hccs_status_info_t;
#define DMS_HCCS_MAX_PCS_NUM (16)
typedef struct {
unsigned int tx_cnt[DMS_HCCS_MAX_PCS_NUM];
unsigned int rx_cnt[DMS_HCCS_MAX_PCS_NUM];
unsigned int crc_err_cnt[DMS_HCCS_MAX_PCS_NUM];
unsigned int retry_cnt[DMS_HCCS_MAX_PCS_NUM];
unsigned int reserve[DMS_HCCS_MAX_PCS_NUM * 3];
} hccs_statistic_info_t;
typedef struct hccs_port_lane_details {
unsigned int hccs_port_pcs_bitmap;
unsigned int pcs_lane_bitmap[DMS_HCCS_MAX_PCS_NUM];
unsigned int reserve[DMS_HCCS_MAX_PCS_NUM];
} hccs_lane_info_t;
#define LANE_MODE_OFFSET 9
#define LANE_MODE_MASK (0x3)
#define LINK_LANE_OFFSET 1
#define HCCS_LANE_SPEED 56
#define SINGLE_PACKETS_BYTES 20
#define FIRST_ERROR_LANE 8
#define MAX_MACRO_NUM 8
#define LANE_NUM 4
#define HCCS_STATUS_OK 0
#define HCCS_STATUS_NOK 1
typedef struct outband_hccs_info {
STRUCT_HEAD struct_head;
unsigned int pcs_status;
unsigned int lane_mode;
unsigned int link_lane_list;
unsigned int link_speed;
unsigned long long tx_packets;
unsigned long long tx_bytes;
unsigned long long rx_packets;
unsigned long long rx_bytes;
unsigned long long retry_cnt;
unsigned long long error_cnt;
unsigned int first_error_lane;
unsigned int snr[LANE_NUM];
unsigned int heh[LANE_NUM];
} OUTBAND_HCCS_INFO;
#define XSFP_SNR_LEN 8
#pragma pack(push, 1)
typedef struct outband_xsfp_power_info_extra {
STRUCT_HEAD struct_head;
int temperature;
int tx_fault;
float host_snr[XSFP_SNR_LEN];
float media_snr[XSFP_SNR_LEN];
unsigned char access_failed;
} OUTBAND_XSFP_POWER_INFO_EXTRA;
#pragma pack(pop)
#define RESERVE_NUMBER_EXT 6
struct rdfx_extra_statistics_info {
unsigned long long cw_total_cnt;
unsigned long long cw_before_correct_cnt;
unsigned long long cw_correct_cnt;
unsigned long long cw_uncorrect_cnt;
unsigned long long cw_bad_cnt;
unsigned long long trans_total_bit;
unsigned long long cw_total_correct_bit;
unsigned long long drop_num;
unsigned long long pcs_err_count;
unsigned long long rx_send_app_good_pkts;
unsigned long long rx_send_app_bad_pkts;
unsigned int reserved[RESERVE_NUMBER_EXT];
};
#define HUYANG_FMEA_LEVEL_MAJOR 2
#define HUYANG_FMEA_LEVEL_MINOR 1
#define HUYANG_FMEA_LEVEL_NONE 0
#define OUTBAND_HUYANG_FMEA_LOG_MAX 10
struct outband_huyang_fmea_log {
unsigned int id;
unsigned char level;
unsigned char type;
unsigned char source;
unsigned char port;
unsigned int time;
unsigned int value;
};
typedef struct outband_huyang_fmea_info {
STRUCT_HEAD struct_head;
unsigned char cdr_type;
unsigned char count;
unsigned char health;
unsigned char current;
struct outband_huyang_fmea_log log[OUTBAND_HUYANG_FMEA_LOG_MAX];
} OUTBAND_HUYANG_FMEA_INFO;
#endif
#if defined(CFG_SOC_PLATFORM_CLOUD_V2)
void dev_mon_api_out_band_get_hccs_info(SYSTEM_CB_T *cb, DM_INTF_S *intf, DM_RECV_ST *msg);
void dev_mon_api_out_band_get_xsfp_power_info_extra(SYSTEM_CB_T *cb, DM_INTF_S *intf, DM_RECV_ST *msg);
void dev_mon_api_out_band_get_huyang_fmea(SYSTEM_CB_T *cb, DM_INTF_S *intf, DM_RECV_ST *msg);
#endif
#endif