You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
1.9 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd. 2008-2020. All rights reserved.
* Description: stat mpi
* Author: Hisilicon
* Create: 2008-12-16
*/
#include <sys/ioctl.h>
#include "soc_log.h"
#include "mpi_stat_ext.h"
#include "drv_ioctl_stat.h"
#include "soc_module.h"
#include "mpi_system_ext.h"
#undef LOG_MODULE_ID
#define LOG_MODULE_ID SOC_ID_STAT
td_s32 ext_mpi_stat_event(ext_stat_event event, td_u32 value)
{
td_s32 ret;
td_s32 sys_fd;
stat_event_info event_info;
event_info.event = event;
event_info.value = value;
sys_fd = ext_mpi_sys_get_dev_fd();
if (sys_fd < 0) {
soc_log_err("sys fd is invalid\n");
return TD_FAILURE;
}
ret = ioctl(sys_fd, STAT_CMPI_EVENT, &event_info);
if (ret != TD_SUCCESS) {
soc_log_err("ioctl of STAT_CMPI_EVENT err, Ret:0x%x\n", ret);
return TD_FAILURE;
}
return TD_SUCCESS;
}
td_s32 ext_mpi_stat_notify_ld_event(const ext_stat_ld_event_info *event_info)
{
td_s32 ret;
td_s32 sys_fd;
if (event_info == TD_NULL) {
return TD_FAILURE;
}
sys_fd = ext_mpi_sys_get_dev_fd();
if (sys_fd < 0) {
soc_log_err("sys fd is invalid\n");
return TD_FAILURE;
}
ret = ioctl(sys_fd, STAT_CMPI_LD_EVENT, event_info);
if (ret != TD_SUCCESS) {
soc_log_err("ioctl of STAT_CMPI_LD_EVENT err = %x\n", ret);
return TD_FAILURE;
}
return TD_SUCCESS;
}
td_s32 ext_mpi_stat_info_notify(const stat_info *info)
{
td_s32 ret;
td_s32 sys_fd;
if (info == TD_NULL) {
return TD_FAILURE;
}
sys_fd = ext_mpi_sys_get_dev_fd();
if (sys_fd < 0) {
soc_log_err("sys fd is invalid\n");
return TD_FAILURE;
}
ret = ioctl(sys_fd, STAT_INFO_NOTIFY, info);
if (ret != TD_SUCCESS) {
soc_log_err("ioctl of STAT_INFO_NOTIFY err = %x\n", ret);
return TD_FAILURE;
}
return TD_SUCCESS;
}