Module Name: src
Committed By: msaitoh
Date: Thu Jul 15 08:09:31 UTC 2021
Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c
Log Message:
Add a new sysctl to read rxr->next_to_refresh.
To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/ixgbe/ixv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.286 src/sys/dev/pci/ixgbe/ixgbe.c:1.287
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.286 Wed Jul 7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 15 08:09:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $ */
/******************************************************************************
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -253,6 +253,7 @@ static int ixgbe_sysctl_power_state(SYSC
static int ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO);
#endif
static int ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
+static int ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
static int ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO);
static int ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO);
static int ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -1930,6 +1931,13 @@ ixgbe_add_hw_stats(struct adapter *adapt
break;
if (sysctl_createv(log, 0, &rnode, &cnode,
+ CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxrf",
+ SYSCTL_DESCR("Receive Descriptor next to refresh"),
+ ixgbe_sysctl_next_to_refresh_handler, 0, (void *)rxr, 0,
+ CTL_CREATE, CTL_EOL) != 0)
+ break;
+
+ if (sysctl_createv(log, 0, &rnode, &cnode,
CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
SYSCTL_DESCR("Receive Descriptor Head"),
ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0,
@@ -2302,6 +2310,32 @@ ixgbe_sysctl_next_to_check_handler(SYSCT
} /* ixgbe_sysctl_next_to_check_handler */
/************************************************************************
+ * ixgbe_sysctl_next_to_refresh_handler - Receive Descriptor next to check
+ * handler function
+ *
+ * Retrieves the next_to_refresh value
+ ************************************************************************/
+static int
+ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
+{
+ struct sysctlnode node = *rnode;
+ struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+ struct adapter *adapter;
+ uint32_t val;
+
+ if (!rxr)
+ return (0);
+
+ adapter = rxr->adapter;
+ if (ixgbe_fw_recovery_mode_swflag(adapter))
+ return (EPERM);
+
+ val = rxr->next_to_refresh;
+ node.sysctl_data = &val;
+ return sysctl_lookup(SYSCTLFN_CALL(&node));
+} /* ixgbe_sysctl_next_to_refresh_handler */
+
+/************************************************************************
* ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function
*
* Retrieves the RDH value from the hardware
Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.163 src/sys/dev/pci/ixgbe/ixv.c:1.164
--- src/sys/dev/pci/ixgbe/ixv.c:1.163 Wed Jul 7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ixv.c Thu Jul 15 08:09:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $ */
/******************************************************************************
@@ -35,7 +35,7 @@
/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -144,6 +144,7 @@ static void ixv_set_sysctl_value(struct
const char *, int *, int);
static int ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
static int ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO);
+static int ixv_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO);
static int ixv_sysctl_rdh_handler(SYSCTLFN_PROTO);
static int ixv_sysctl_rdt_handler(SYSCTLFN_PROTO);
static int ixv_sysctl_tdt_handler(SYSCTLFN_PROTO);
@@ -2033,6 +2034,32 @@ ixv_sysctl_next_to_check_handler(SYSCTLF
} /* ixv_sysctl_next_to_check_handler */
/************************************************************************
+ * ixv_sysctl_next_to_refresh_handler - Receive Descriptor next to refresh
+ * handler function
+ *
+ * Retrieves the next_to_refresh value
+ ************************************************************************/
+static int
+ixv_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS)
+{
+ struct sysctlnode node = *rnode;
+ struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data;
+ struct adapter *adapter;
+ uint32_t val;
+
+ if (!rxr)
+ return (0);
+
+ adapter = rxr->adapter;
+ if (ixgbe_fw_recovery_mode_swflag(adapter))
+ return (EPERM);
+
+ val = rxr->next_to_refresh;
+ node.sysctl_data = &val;
+ return sysctl_lookup(SYSCTLFN_CALL(&node));
+} /* ixv_sysctl_next_to_refresh_handler */
+
+/************************************************************************
* ixv_sysctl_rdh_handler - Receive Descriptor Head handler function
*
* Retrieves the RDH value from the hardware
@@ -2703,6 +2730,13 @@ ixv_add_stats_sysctls(struct adapter *ad
break;
if (sysctl_createv(log, 0, &rnode, &cnode,
+ CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxrf",
+ SYSCTL_DESCR("Receive Descriptor next to refresh"),
+ ixv_sysctl_next_to_refresh_handler, 0, (void *)rxr, 0,
+ CTL_CREATE, CTL_EOL) != 0)
+ break;
+
+ if (sysctl_createv(log, 0, &rnode, &cnode,
CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head",
SYSCTL_DESCR("Receive Descriptor Head"),
ixv_sysctl_rdh_handler, 0, (void *)rxr, 0,