net/gve: add passive device-requested reset
PATCH 1/1 net/gve: add passive device-requested reset
In addition to application-initiated resets, during normal operation, the device can indicate the need to reset by writing a value to a device status register. This patch introduces an alarm that polls the status of that register and informs the application of the need to reset. The application is responsible for registering a callback that will execute in the event that the alarm discovers that the device requests a reset.
---
Depends-on: patch-1bf64edce3 ("net/gve: add reset path")
doc/guides/nics/gve.rst | 32 ++++++++++++++- drivers/net/gve/gve_ethdev.c | 77 ++++++++++++++++++++++++++++++++++++ drivers/net/gve/gve_ethdev.h | 3 ++ 3 files changed, 110 insertions(+), 2 deletions(-)
doc/guides/nics/gve.rst +30 -2
@@ -130,8 +130,8 @@ Security Protocols - Flow priorities are not supported (must be 0). - Masking is limited to full matches i.e. ``0x00...0`` or ``0xFF...F``. -Application-Initiated Reset -^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Device Reset +^^^^^^^^^^^^ The driver allows an application to reset the gVNIC device. This function will tear down and reinitialize the device's resources,
@@ -139,3 +139,31 @@ including queues and administrative queues. It is the application's responsibility to reinitialize and restart the device after resetting it. + +In addition, the driver supports device-requested resets, which are triggered +when the device encounters an unrecoverable error. The driver detects this via +a device status register and raises an ``RTE_ETH_EVENT_INTR_RESET`` event. + +The application must register a callback to handle this event. The callback +should handle the reset process (reset, reconfigure, restart). + +.. code-block:: c + + static int + dev_rst_req_callback(uint16_t port_id, enum rte_eth_event_type type, + void *param, void *ret_param) + { + RTE_SET_USED(param); + RTE_SET_USED(ret_param); + + if (type == RTE_ETH_EVENT_INTR_RESET) { + printf("Device requested reset on port %u\n", port_id); + rte_eth_dev_reset(port_id); + /* Reconfigure and restart port ... */ + } + return 0; + } + + /* Register this callback in the main execution flow */ + rte_eth_dev_callback_register(port_id, RTE_ETH_EVENT_INTR_RESET, + dev_rst_req_callback, NULL);
drivers/net/gve/gve_ethdev.c +77 -0
107 lines not on this page · raw message
drivers/net/gve/gve_ethdev.h +3 -0
@@ -7,6 +7,7 @@#include <ethdev_driver.h> #include <ethdev_pci.h> +#include <rte_alarm.h> #include <rte_ether.h> #include <rte_pci.h> #include <pthread.h>
@@ -57,6 +58,8 @@ RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ RTE_ETH_RSS_IPV6_UDP_EX) +#define GVE_DEV_POLL_INTERVAL_US (1 * 1000 * 1000)/* 1 second in microseconds */ +/* A list of pages registered with the device during setup and used by a queue * as buffers */
Signature · 1 line
2.53.0.1118.gaef5881109-goog
Quoted 11 lines · On Fri, 27 Mar 2026 00:20:38 +0000 "Jasper Tran O'Leary"…
In addition to application-initiated resets, during normal operation, the device can indicate the need to reset by writing a value to a device status register. This patch introduces an alarm that polls the status of that register and informs the application of the need to reset. The application is responsible for registering a callback that will execute in the event that the alarm discovers that the device requests a reset.
Signed-off-by Jasper Tran O'Leary <[email protected]>Reviewed-by Joshua Washington <[email protected]>---
Since not a bug fix, holding this off until 26.07 release
Stephen Hemminger
AppliedQuoted 10 lines · On Fri, 27 Mar 2026 00:20:38 +0000 "Jasper Tran O'Leary"…
In addition to application-initiated resets, during normal operation, the device can indicate the need to reset by writing a value to a device status register. This patch introduces an alarm that polls the status of that register and informs the application of the need to reset. The application is responsible for registering a callback that will execute in the event that the alarm discovers that the device requests a reset.
Signed-off-by Jasper Tran O'Leary <[email protected]>Reviewed-by Joshua Washington <[email protected]>
Makes sense, AI analysis had one item worth noting. Not sure where documentation related (if any) should go.
The alarm callback calls rte_eth_dev_callback_process() synchronously, which means the application's reset handler runs in the alarm thread context. The documentation example shows calling rte_eth_dev_reset() directly in the callback — this works (rte_eal_alarm_cancel from within a callback is allowed), but a production application would likely want to set a flag and handle the reset from the main thread. Worth a note in the doc example.
The polling interval is 1 second vs 20 seconds in the kernel gve driver. Not wrong, but more aggressive — is there a reason for the shorter interval? Otherwise looks good.
Applied to next-net