Module Name: src
Committed By: msaitoh
Date: Wed Nov 22 15:15:09 UTC 2017
Modified Files:
src/sys/dev/pci/ixgbe: if_bypass.c ixgbe.c ixgbe.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/if_bypass.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/ixgbe/ixgbe.h
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/if_bypass.c
diff -u src/sys/dev/pci/ixgbe/if_bypass.c:1.1 src/sys/dev/pci/ixgbe/if_bypass.c:1.2
--- src/sys/dev/pci/ixgbe/if_bypass.c:1.1 Wed Aug 30 08:49:18 2017
+++ src/sys/dev/pci/ixgbe/if_bypass.c Wed Nov 22 15:15:09 2017
@@ -134,6 +134,7 @@ ixgbe_bp_version(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_set_state(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_timeout(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_main_on(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_main_off(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_aux_on(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_aux_off(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_wd_set(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_wd_reset(SYSCTLFN_ARGS)
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 @@ ixgbe_bp_log(SYSCTLFN_ARGS)
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 @@ ixgbe_bypass_init(struct adapter *adapte
/* 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;
}
Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.112 src/sys/dev/pci/ixgbe/ixgbe.c:1.113
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.112 Thu Nov 16 03:07:18 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Nov 22 15:15:09 2017
@@ -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_msf(void *);
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 @@ ixgbe_attach(device_t parent, device_t d
} else
adapter->num_segs = IXGBE_82598_SCATTER;
+ hw->mac.ops.set_lan_id(hw);
ixgbe_init_device_features(adapter);
if (ixgbe_configure_interrupts(adapter)) {
Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.27 src/sys/dev/pci/ixgbe/ixgbe.h:1.28
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.27 Thu Nov 2 08:41:15 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.h Wed Nov 22 15:15:09 2017
@@ -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_free_receive_structures(struc
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"