summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
diff options
context:
space:
mode:
authorJijie Shao <shaojijie@huawei.com>2025-02-28 19:54:10 +0800
committerPaolo Abeni <pabeni@redhat.com>2025-03-04 13:45:33 +0100
commit7a5d60dcf9981a5cc7b676e2d7472e10e0c1b681 (patch)
tree3720477efbaa4072caeef033fbd7d3e246a47ecc /drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
parente0306637e85da84a0695452f42dc29a552051402 (diff)
net: hibmcge: Add support for BMC diagnose feature
The MAC hardware is on the BMC side, and the driver is on the host side. When the driver is abnormal, the BMC cannot directly detect the exception cause. Therefore, this patch implements the BMC diagnosis feature. When users query driver diagnosis information on the BMC, the driver detects the query request in the scheduled task and reports driver statistics and link status to the BMC through the bar space. The BMC collects logs to analyze exception causes. Currently, the scheduled task is executed every 30 seconds To quickly respond to user query requests, this patch changes the scheduled task to once every second. Signed-off-by: Jijie Shao <shaojijie@huawei.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c')
-rw-r--r--drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
index 3b7955f57b4d..c6a955e640fc 100644
--- a/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
+++ b/drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c
@@ -6,6 +6,7 @@
#include <linux/netdevice.h>
#include <linux/pci.h>
#include "hbg_common.h"
+#include "hbg_diagnose.h"
#include "hbg_err.h"
#include "hbg_ethtool.h"
#include "hbg_hw.h"
@@ -289,13 +290,19 @@ static void hbg_service_task(struct work_struct *work)
if (test_and_clear_bit(HBG_NIC_STATE_NP_LINK_FAIL, &priv->state))
hbg_fix_np_link_fail(priv);
+ hbg_diagnose_message_push(priv);
+
/* The type of statistics register is u32,
* To prevent the statistics register from overflowing,
* the driver dumps the statistics every 30 seconds.
*/
- hbg_update_stats(priv);
+ if (time_after(jiffies, priv->last_update_stats_time + 30 * HZ)) {
+ hbg_update_stats(priv);
+ priv->last_update_stats_time = jiffies;
+ }
+
schedule_delayed_work(&priv->service_task,
- msecs_to_jiffies(30 * MSEC_PER_SEC));
+ msecs_to_jiffies(MSEC_PER_SEC));
}
void hbg_err_reset_task_schedule(struct hbg_priv *priv)