Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F169452942
D9151.id23916.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D9151.id23916.diff
View Options
Index: head/sys/dev/sfxge/sfxge.h
===================================================================
--- head/sys/dev/sfxge/sfxge.h
+++ head/sys/dev/sfxge/sfxge.h
@@ -248,6 +248,7 @@
#endif
struct sfxge_hw_stats phy_stats;
struct sfxge_hw_stats mac_stats;
+ uint16_t stats_update_period_ms;
efx_link_mode_t link_mode;
uint8_t mcast_addrs[EFX_MAC_MULTICAST_LIST_MAX *
EFX_MAC_ADDR_LEN];
Index: head/sys/dev/sfxge/sfxge_port.c
===================================================================
--- head/sys/dev/sfxge/sfxge_port.c
+++ head/sys/dev/sfxge/sfxge_port.c
@@ -43,6 +43,15 @@
#include "sfxge.h"
+#define SFXGE_PARAM_STATS_UPDATE_PERIOD_MS \
+ SFXGE_PARAM(stats_update_period_ms)
+static int sfxge_stats_update_period_ms = SFXGE_STATS_UPDATE_PERIOD_MS;
+TUNABLE_INT(SFXGE_PARAM_STATS_UPDATE_PERIOD_MS,
+ &sfxge_stats_update_period_ms);
+SYSCTL_INT(_hw_sfxge, OID_AUTO, stats_update_period_ms, CTLFLAG_RDTUN,
+ &sfxge_stats_update_period_ms, 0,
+ "netstat interface statistics update period in milliseconds");
+
static int sfxge_phy_cap_mask(struct sfxge_softc *, int, uint32_t *);
static int
@@ -62,7 +71,7 @@
goto out;
}
- min_ticks = (unsigned int)hz * SFXGE_STATS_UPDATE_PERIOD_MS / 1000;
+ min_ticks = (unsigned int)hz * port->stats_update_period_ms / 1000;
now = ticks;
if ((unsigned int)(now - port->mac_stats.update_time) < min_ticks) {
@@ -515,7 +524,7 @@
/* Update MAC stats by DMA every period */
if ((rc = efx_mac_stats_periodic(enp, &port->mac_stats.dma_buf,
- SFXGE_STATS_UPDATE_PERIOD_MS,
+ port->stats_update_period_ms,
B_FALSE)) != 0)
goto fail6;
@@ -673,6 +682,26 @@
port->sc = NULL;
}
+static uint16_t
+sfxge_port_stats_update_period_ms(struct sfxge_softc *sc)
+{
+ int period_ms = sfxge_stats_update_period_ms;
+
+ if (period_ms < 0) {
+ device_printf(sc->dev,
+ "treat negative stats update period %d as 0 (disable)\n",
+ period_ms);
+ period_ms = 0;
+ } else if (period_ms > UINT16_MAX) {
+ device_printf(sc->dev,
+ "treat too big stats update period %d as %u\n",
+ period_ms, UINT16_MAX);
+ period_ms = UINT16_MAX;
+ }
+
+ return period_ms;
+}
+
int
sfxge_port_init(struct sfxge_softc *sc)
{
@@ -721,6 +750,7 @@
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0)
goto fail2;
+ port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc);
sfxge_mac_stat_init(sc);
port->init_state = SFXGE_PORT_INITIALIZED;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Sep 2, 2:08 PM (4 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37970213
Default Alt Text
D9151.id23916.diff (2 KB)
Attached To
Mode
D9151: sfxge(4): add tunable to configure MAC stats update period
Attached
Detach File
Event Timeline
Log In to Comment