Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Add a new sysctl to read rxr->next_to_refr...



details:   https://anonhg.NetBSD.org/src/rev/dc9ec5ed720e
branches:  trunk
changeset: 984655:dc9ec5ed720e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jul 15 08:09:31 2021 +0000

description:
Add a new sysctl to read rxr->next_to_refresh.

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  38 ++++++++++++++++++++++++++++++++++++--
 sys/dev/pci/ixgbe/ixv.c   |  38 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 72 insertions(+), 4 deletions(-)

diffs (146 lines):

diff -r 075ebf361f97 -r dc9ec5ed720e sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 15 08:02:47 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 15 08:09:31 2021 +0000
@@ -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_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 @@
                        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 */
 
 /************************************************************************
+ * 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
diff -r 075ebf361f97 -r dc9ec5ed720e sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Thu Jul 15 08:02:47 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Thu Jul 15 08:09:31 2021 +0000
@@ -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 @@
                    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 */
 
 /************************************************************************
+ * 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 @@
                        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,



Home | Main Index | Thread Index | Old Index