mirror of
https://github.com/opnsense/src.git
synced 2026-02-19 02:30:08 -05:00
ena: Add support for device request reset message over AENQ
This commit adds a handler for the new aenq message ENA_ADMIN_DEVICE_REQUEST_RESET, which in turn causes the driver to trigger reset of a new type: ENA_REGS_RESET_DEVICE_REQUEST. Also adds counting of such occurrences in a new statistic for it. Approved by: cperciva (mentor) Sponsored by: Amazon, Inc. (cherry picked from commit 705879424bc76fcc925e78eb7643dbf4bd9a11eb)
This commit is contained in:
parent
9aa14351c1
commit
ebb857f4ce
3 changed files with 16 additions and 1 deletions
|
|
@ -2990,7 +2990,8 @@ ena_device_init(struct ena_adapter *adapter, device_t pdev,
|
|||
BIT(ENA_ADMIN_WARNING) |
|
||||
BIT(ENA_ADMIN_NOTIFICATION) |
|
||||
BIT(ENA_ADMIN_KEEP_ALIVE) |
|
||||
BIT(ENA_ADMIN_CONF_NOTIFICATIONS);
|
||||
BIT(ENA_ADMIN_CONF_NOTIFICATIONS) |
|
||||
BIT(ENA_ADMIN_DEVICE_REQUEST_RESET);
|
||||
|
||||
aenq_groups &= get_feat_ctx->aenq.supported_groups;
|
||||
rc = ena_com_set_aenq_config(ena_dev, aenq_groups);
|
||||
|
|
@ -4195,12 +4196,22 @@ static void ena_conf_notification(void *adapter_data,
|
|||
}
|
||||
}
|
||||
|
||||
static void ena_admin_device_request_reset(void *adapter_data,
|
||||
struct ena_admin_aenq_entry *aenq_e)
|
||||
{
|
||||
struct ena_adapter *adapter = (struct ena_adapter *)adapter_data;
|
||||
ena_log(adapter->pdev, WARN,
|
||||
"The device has detected an unhealthy state, reset is requested\n");
|
||||
ena_trigger_reset(adapter, ENA_REGS_RESET_DEVICE_REQUEST);
|
||||
}
|
||||
|
||||
static struct ena_aenq_handlers aenq_handlers = {
|
||||
.handlers = {
|
||||
[ENA_ADMIN_LINK_CHANGE] = ena_update_on_link_change,
|
||||
[ENA_ADMIN_NOTIFICATION] = ena_notification,
|
||||
[ENA_ADMIN_KEEP_ALIVE] = ena_keep_alive_wd,
|
||||
[ENA_ADMIN_CONF_NOTIFICATIONS] = ena_conf_notification,
|
||||
[ENA_ADMIN_DEVICE_REQUEST_RESET] = ena_admin_device_request_reset,
|
||||
},
|
||||
.unimplemented_handler = unimplemented_aenq_handler
|
||||
};
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ struct ena_stats_dev {
|
|||
counter_u64_t rx_desc_malformed;
|
||||
counter_u64_t missing_admin_interrupt;
|
||||
counter_u64_t admin_to;
|
||||
counter_u64_t device_request_reset;
|
||||
};
|
||||
|
||||
struct ena_hw_stats {
|
||||
|
|
@ -558,6 +559,7 @@ static const struct ena_reset_stats_offset resets_to_stats_offset_map[ENA_REGS_R
|
|||
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED, tx_desc_malformed),
|
||||
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED, rx_desc_malformed),
|
||||
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT, missing_admin_interrupt),
|
||||
ENA_RESET_STATS_ENTRY(ENA_REGS_RESET_DEVICE_REQUEST, device_request_reset),
|
||||
};
|
||||
|
||||
int ena_up(struct ena_adapter *adapter);
|
||||
|
|
|
|||
|
|
@ -301,6 +301,8 @@ ena_sysctl_add_stats(struct ena_adapter *adapter)
|
|||
&dev_stats->missing_admin_interrupt, "Missing admin interrupts count");
|
||||
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "admin_to", CTLFLAG_RD,
|
||||
&dev_stats->admin_to, "Admin queue timeouts count");
|
||||
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "device_request_reset", CTLFLAG_RD,
|
||||
&dev_stats->device_request_reset, "Device reset requests count");
|
||||
SYSCTL_ADD_COUNTER_U64(ctx, child, OID_AUTO, "total_resets", CTLFLAG_RD,
|
||||
&dev_stats->total_resets, "Total resets count");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue