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 Fix a bug that bypass adapter's sysctls ar...



details:   https://anonhg.NetBSD.org/src/rev/3ec1e02fa2fc
branches:  trunk
changeset: 357712:3ec1e02fa2fc
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Nov 22 15:15:09 2017 +0000

description:
Fix a bug that bypass adapter's sysctls aren't set. Tested with non-genuine
X550-T2 bypass adapter:
- Call ixgbe_sysctl_instance() in ixgbe_bypass_init() to get sysctl's top node
  correctly.
- ixgbe_init_device_features() refers adapter->hw.bus.func for bypass adapter.
  Call set_lan_id() to set adapter->hw.bus.func before calling
  ixgbe_init_device_features(). Without this, bypass sysctl's are added to
  both the first and second port.
- Initalize node.sysctl_data before calling sysctl_lookup() to read correct
  value.

diffstat:

 sys/dev/pci/ixgbe/if_bypass.c |  12 +++++++++++-
 sys/dev/pci/ixgbe/ixgbe.c     |   4 ++--
 sys/dev/pci/ixgbe/ixgbe.h     |   4 +++-
 3 files changed, 16 insertions(+), 4 deletions(-)

diffs (135 lines):

diff -r d5ef3ecf7515 -r 3ec1e02fa2fc sys/dev/pci/ixgbe/if_bypass.c
--- a/sys/dev/pci/ixgbe/if_bypass.c     Wed Nov 22 13:13:18 2017 +0000
+++ b/sys/dev/pci/ixgbe/if_bypass.c     Wed Nov 22 15:15:09 2017 +0000
@@ -134,6 +134,7 @@
                goto err;
        ixgbe_bypass_mutex_clear(adapter);
        featversion &= BYPASS_CTL2_DATA_M;
+       node.sysctl_data = &featversion;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        return (error);
 err:
@@ -171,6 +172,7 @@
                return (error);
        state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3;
 
+       node.sysctl_data = &state;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -233,6 +235,7 @@
                return (error);
        timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3;
 
+       node.sysctl_data = &timeout;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -276,6 +279,7 @@
        if (error)
                return (error);
 
+       node.sysctl_data = &main_on;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -319,6 +323,7 @@
                return (error);
        main_off = (main_off >> BYPASS_MAIN_OFF_SHIFT) & 0x3;
 
+       node.sysctl_data = &main_off;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -362,6 +367,7 @@
                return (error);
        aux_on = (aux_on >> BYPASS_AUX_ON_SHIFT) & 0x3;
 
+       node.sysctl_data = &aux_on;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -405,6 +411,7 @@
                return (error);
        aux_off = (aux_off >> BYPASS_AUX_OFF_SHIFT) & 0x3;
 
+       node.sysctl_data = &aux_off;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -460,6 +467,7 @@
        if ((tmp & (0x1 << BYPASS_WDT_ENABLE_SHIFT)) == 0)
                timeout = 0;
 
+       node.sysctl_data = &timeout;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -529,6 +537,7 @@
        int             cmd, count = 0, error = 0;
        int             reset_wd = 0;
 
+       node.sysctl_data = &reset_wd;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -579,6 +588,7 @@
        struct ixgbe_bypass_eeprom eeprom[BYPASS_MAX_LOGS];
        int                        i, error = 0;
 
+       node.sysctl_data = &status;
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if ((error) || (newp == NULL))
                return (error);
@@ -759,7 +769,7 @@
 
        /* Now set up the SYSCTL infrastructure */
        log = &adapter->sysctllog;
-       if ((rnode = adapter->sysctltop) == NULL) {
+       if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) {
                aprint_error_dev(dev, "could not create sysctl root\n");
                return;
        }
diff -r d5ef3ecf7515 -r 3ec1e02fa2fc sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Wed Nov 22 13:13:18 2017 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Wed Nov 22 15:15:09 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.112 2017/11/16 03:07:18 ozaki-r Exp $ */
+/* $NetBSD: ixgbe.c,v 1.113 2017/11/22 15:15:09 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -257,7 +257,6 @@
 static void    ixgbe_handle_mod(void *);
 static void    ixgbe_handle_phy(void *);
 
-const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
 static ixgbe_vendor_info_t *ixgbe_lookup(const struct pci_attach_args *);
 
 /************************************************************************
@@ -853,6 +852,7 @@
        } else
                adapter->num_segs = IXGBE_82598_SCATTER;
 
+       hw->mac.ops.set_lan_id(hw);
        ixgbe_init_device_features(adapter);
 
        if (ixgbe_configure_interrupts(adapter)) {
diff -r d5ef3ecf7515 -r 3ec1e02fa2fc sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Wed Nov 22 13:13:18 2017 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Wed Nov 22 15:15:09 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.27 2017/11/02 08:41:15 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.28 2017/11/22 15:15:09 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -719,6 +719,8 @@
 void ixgbe_txeof(struct tx_ring *);
 bool ixgbe_rxeof(struct ix_queue *);
 
+const struct sysctlnode *ixgbe_sysctl_instance(struct adapter *);
+
 #include "ixgbe_bypass.h"
 #include "ixgbe_sriov.h"
 #include "ixgbe_fdir.h"



Home | Main Index | Thread Index | Old Index