Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156570478
D10926.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D10926.diff
View Options
Index: head/sys/dev/ena/ena.h
===================================================================
--- head/sys/dev/ena/ena.h
+++ head/sys/dev/ena/ena.h
@@ -403,6 +403,10 @@
uint32_t missing_tx_max_queues;
uint32_t missing_tx_threshold;
+ /* Task updating hw stats */
+ struct task stats_task;
+ struct taskqueue *stats_tq;
+
/* Statistics */
struct ena_stats_dev dev_stats;
struct ena_hw_stats hw_stats;
Index: head/sys/dev/ena/ena.c
===================================================================
--- head/sys/dev/ena/ena.c
+++ head/sys/dev/ena/ena.c
@@ -141,6 +141,7 @@
static void ena_disable_msix(struct ena_adapter *);
static void ena_unmask_all_io_irqs(struct ena_adapter *);
static int ena_rss_configure(struct ena_adapter *);
+static void ena_update_hw_stats(void *, int);
static int ena_up_complete(struct ena_adapter *);
static int ena_up(struct ena_adapter *);
static void ena_down(struct ena_adapter *);
@@ -2058,6 +2059,25 @@
return 0;
}
+static void
+ena_update_hw_stats(void *arg, int pending)
+{
+ struct ena_adapter *adapter = arg;
+ int rc;
+
+ for (;;) {
+ if (!adapter->up)
+ return;
+
+ rc = ena_update_stats_counters(adapter);
+ if (rc)
+ ena_trace(ENA_WARNING,
+ "Error updating stats counters, rc = %d", rc);
+
+ pause("ena update hw stats", hz);
+ }
+}
+
static int
ena_up_complete(struct ena_adapter *adapter)
{
@@ -2141,6 +2161,8 @@
callout_reset_sbt(&adapter->timer_service, SBT_1S, SBT_1S,
ena_timer_service, (void *)adapter, 0);
+ taskqueue_enqueue(adapter->stats_tq, &adapter->stats_task);
+
adapter->up = true;
}
@@ -2193,24 +2215,8 @@
{
struct ena_adapter *adapter;
struct ena_hw_stats *stats;
- int rc;
adapter = if_getsoftc(ifp);
-
- /*
- * Update only when asking for first counter and interface is up.
- * Usually asks for all statistics in sequence.
- */
- if (adapter->up) {
- if (cnt == 0) {
- rc = ena_update_stats_counters(adapter);
- if (rc) {
- ena_trace(ENA_WARNING,
- "Error updating stats counters, rc = %d",
- rc);
- }
- }
- }
stats = &adapter->hw_stats;
switch (cnt) {
@@ -2501,6 +2507,10 @@
if_setdrvflagbits(adapter->ifp, IFF_DRV_OACTIVE,
IFF_DRV_RUNNING);
+ /* Drain task responsible for updating hw stats */
+ while (taskqueue_cancel(adapter->stats_tq, &adapter->stats_task, NULL))
+ taskqueue_drain(adapter->stats_tq, &adapter->stats_task);
+
ena_free_io_irq(adapter);
ena_destroy_all_io_queues(adapter);
@@ -3616,6 +3626,18 @@
taskqueue_start_threads(&adapter->reset_tq, 1, PI_NET,
"%s rstq", device_get_nameunit(adapter->pdev));
+ /* Initialize task queue responsible for updating hw stats */
+ TASK_INIT(&adapter->stats_task, 0, ena_update_hw_stats, adapter);
+ adapter->stats_tq = taskqueue_create_fast("ena_stats_update",
+ M_WAITOK | M_ZERO, taskqueue_thread_enqueue, &adapter->stats_tq);
+ if (adapter->stats_tq == NULL) {
+ device_printf(adapter->pdev,
+ "Unable to create taskqueue for updating hw stats\n");
+ goto err_stats_tq;
+ }
+ taskqueue_start_threads(&adapter->stats_tq, 1, PI_REALTIME,
+ "%s stats tq", device_get_nameunit(adapter->pdev));
+
/* Initialize statistics */
ena_alloc_counters((counter_u64_t *)&adapter->dev_stats,
sizeof(struct ena_stats_dev));
@@ -3628,6 +3650,8 @@
adapter->running = true;
return (0);
+err_stats_tq:
+ taskqueue_free(adapter->reset_tq);
err_reset_tq:
ena_free_mgmnt_irq(adapter);
ena_disable_msix(adapter);
@@ -3683,6 +3707,8 @@
ena_down(adapter);
sx_unlock(&adapter->ioctl_sx);
+ taskqueue_free(adapter->stats_tq);
+
if (adapter->ifp != NULL) {
ether_ifdetach(adapter->ifp);
if_free(adapter->ifp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 15, 6:19 PM (3 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33056695
Default Alt Text
D10926.diff (3 KB)
Attached To
Mode
D10926: ena: move hw stats updating routine to separate task
Attached
Detach File
Event Timeline
Log In to Comment