Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Sync with FreeBSD r320688 (and up to r322865):



details:   https://anonhg.NetBSD.org/src/rev/185abfa17293
branches:  trunk
changeset: 826368:185abfa17293
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Aug 30 08:49:18 2017 +0000

description:
- Sync with FreeBSD r320688 (and up to r322865):
  - Add C3000(Denvertion(-NS)) support.
  - Add bypass function support for bypass adapters. Sysctls are provided.
    Not tested because I have no any bypass adapter.
  - ixv(4): set RSS mapping.
  - Change EEE sysctl.
  - ixv(4): Add TSOv6.
  - ixv(4): Mailbox API 1.2 and more are implemented and comment says it
    negotiate with 1.2 but it really does 1.1...
  - Remove thermal test sysctl.
  - Fix unknown bugs.
- Print driver feature capabilities and enable bits when verbose boot.

diffstat:

 sys/dev/pci/files.pci               |     4 +-
 sys/dev/pci/ixgbe/if_bypass.c       |   821 ++++++
 sys/dev/pci/ixgbe/if_fdir.c         |   160 +
 sys/dev/pci/ixgbe/if_sriov.c        |   914 +++++++
 sys/dev/pci/ixgbe/ix_txrx.c         |  1408 +++++-----
 sys/dev/pci/ixgbe/ixgbe.c           |  4373 +++++++++++++++-------------------
 sys/dev/pci/ixgbe/ixgbe.h           |   583 +---
 sys/dev/pci/ixgbe/ixgbe_82598.c     |    54 +-
 sys/dev/pci/ixgbe/ixgbe_82598.h     |    49 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c     |    95 +-
 sys/dev/pci/ixgbe/ixgbe_82599.h     |    46 +-
 sys/dev/pci/ixgbe/ixgbe_api.c       |   249 +-
 sys/dev/pci/ixgbe/ixgbe_api.h       |    74 +-
 sys/dev/pci/ixgbe/ixgbe_bypass.h    |    51 +
 sys/dev/pci/ixgbe/ixgbe_common.c    |   961 +++++--
 sys/dev/pci/ixgbe/ixgbe_common.h    |    67 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.c       |    52 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.h       |    42 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.c |    42 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.h |    42 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.c |    42 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.h |    42 +-
 sys/dev/pci/ixgbe/ixgbe_fdir.h      |    58 +
 sys/dev/pci/ixgbe/ixgbe_features.h  |    83 +
 sys/dev/pci/ixgbe/ixgbe_mbx.c       |   166 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h       |    67 +-
 sys/dev/pci/ixgbe/ixgbe_netmap.c    |   521 ++++
 sys/dev/pci/ixgbe/ixgbe_netmap.h    |    59 +
 sys/dev/pci/ixgbe/ixgbe_osdep.c     |     9 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h     |    20 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c       |   467 +--
 sys/dev/pci/ixgbe/ixgbe_phy.h       |    55 +-
 sys/dev/pci/ixgbe/ixgbe_rss.h       |    64 +
 sys/dev/pci/ixgbe/ixgbe_sriov.h     |   102 +
 sys/dev/pci/ixgbe/ixgbe_type.h      |   522 +++-
 sys/dev/pci/ixgbe/ixgbe_vf.c        |   183 +-
 sys/dev/pci/ixgbe/ixgbe_vf.h        |    18 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c      |   138 +-
 sys/dev/pci/ixgbe/ixgbe_x540.h      |    45 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c      |  2421 +++++++++++++++---
 sys/dev/pci/ixgbe/ixgbe_x550.h      |    69 +-
 sys/dev/pci/ixgbe/ixv.c             |  1617 +++++++-----
 42 files changed, 10758 insertions(+), 6097 deletions(-)

diffs (truncated from 24130 to 300 lines):

diff -r 8e75368aa4bf -r 185abfa17293 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Wed Aug 30 08:24:57 2017 +0000
+++ b/sys/dev/pci/files.pci     Wed Aug 30 08:49:18 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.389 2017/08/02 08:39:14 cherry Exp $
+#      $NetBSD: files.pci,v 1.390 2017/08/30 08:49:18 msaitoh Exp $
 #
 # Config file and device description for machine-independent PCI code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -680,6 +680,8 @@
 file   dev/pci/ixgbe/ixgbe_osdep.c     ixg | ixv
 file   dev/pci/ixgbe/ixgbe_phy.c       ixg | ixv
 file   dev/pci/ixgbe/ixgbe_vf.c        ixg | ixv
+file   dev/pci/ixgbe/if_bypass.c       ixg | ixv
+file   dev/pci/ixgbe/if_fdir.c         ixg | ixv
 
 # This appears to be the driver for virtual instances of i82599.
 device ixv: ether, ifnet, arp
diff -r 8e75368aa4bf -r 185abfa17293 sys/dev/pci/ixgbe/if_bypass.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/ixgbe/if_bypass.c     Wed Aug 30 08:49:18 2017 +0000
@@ -0,0 +1,821 @@
+/******************************************************************************
+
+  Copyright (c) 2001-2017, Intel Corporation
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+
+   1. Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+
+   3. Neither the name of the Intel Corporation nor the names of its
+      contributors may be used to endorse or promote products derived from
+      this software without specific prior written permission.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+******************************************************************************/
+/*$FreeBSD: head/sys/dev/ixgbe/if_bypass.c 320688 2017-07-05 17:27:03Z erj $*/
+
+
+#include "ixgbe.h"
+
+/************************************************************************
+ * ixgbe_bypass_mutex_enter
+ *
+ *   Mutex support for the bypass feature. Using a dual lock
+ *   to facilitate a privileged access to the watchdog update
+ *   over other threads.
+ ************************************************************************/
+static void
+ixgbe_bypass_mutex_enter(struct adapter *adapter)
+{
+       while (atomic_cas_uint(&adapter->bypass.low, 0, 1) == 0)
+               usec_delay(3000);
+       while (atomic_cas_uint(&adapter->bypass.high, 0, 1) == 0)
+               usec_delay(3000);
+       return;
+} /* ixgbe_bypass_mutex_enter */
+
+/************************************************************************
+ * ixgbe_bypass_mutex_clear
+ ************************************************************************/
+static void
+ixgbe_bypass_mutex_clear(struct adapter *adapter)
+{
+       while (atomic_cas_uint(&adapter->bypass.high, 1, 0) == 0)
+               usec_delay(6000);
+       while (atomic_cas_uint(&adapter->bypass.low, 1, 0) == 0)
+               usec_delay(6000);
+       return;
+} /* ixgbe_bypass_mutex_clear */
+
+/************************************************************************
+ * ixgbe_bypass_wd_mutex_enter
+ *
+ *   Watchdog entry is allowed to simply grab the high priority
+ ************************************************************************/
+static void
+ixgbe_bypass_wd_mutex_enter(struct adapter *adapter)
+{
+       while (atomic_cas_uint(&adapter->bypass.high, 0, 1) == 0)
+               usec_delay(3000);
+       return;
+} /* ixgbe_bypass_wd_mutex_enter */
+
+/************************************************************************
+ * ixgbe_bypass_wd_mutex_clear
+ ************************************************************************/
+static void
+ixgbe_bypass_wd_mutex_clear(struct adapter *adapter)
+{
+       while (atomic_cas_uint(&adapter->bypass.high, 1, 0) == 0)
+               usec_delay(6000);
+       return;
+} /* ixgbe_bypass_wd_mutex_clear */
+
+/************************************************************************
+ * ixgbe_get_bypass_time
+ ************************************************************************/
+static void
+ixgbe_get_bypass_time(u32 *year, u32 *sec)
+{
+       struct timespec current;
+
+       *year = 1970;           /* time starts at 01/01/1970 */
+       nanotime(&current);
+       *sec = current.tv_sec;
+
+       while(*sec > SEC_THIS_YEAR(*year)) {
+               *sec -= SEC_THIS_YEAR(*year);
+               (*year)++;
+       }
+} /* ixgbe_get_bypass_time */
+
+/************************************************************************
+ * ixgbe_bp_version
+ *
+ *   Display the feature version
+ ************************************************************************/
+static int
+ixgbe_bp_version(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node = *rnode;
+       struct adapter  *adapter = (struct adapter *)node.sysctl_data;
+       struct ixgbe_hw *hw = &adapter->hw;
+       int             error = 0;
+       static int      featversion = 0;
+       u32             cmd;
+
+       ixgbe_bypass_mutex_enter(adapter);
+       cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
+       cmd |= (BYPASS_EEPROM_VER_ADD << BYPASS_CTL2_OFFSET_SHIFT) &
+           BYPASS_CTL2_OFFSET_M;
+       if ((error = hw->mac.ops.bypass_rw(hw, cmd, &featversion) != 0))
+               goto err;
+       msec_delay(100);
+       cmd &= ~BYPASS_WE;
+       if ((error = hw->mac.ops.bypass_rw(hw, cmd, &featversion) != 0))
+               goto err;
+       ixgbe_bypass_mutex_clear(adapter);
+       featversion &= BYPASS_CTL2_DATA_M;
+       error = sysctl_lookup(SYSCTLFN_CALL(&node));
+       return (error);
+err:
+       ixgbe_bypass_mutex_clear(adapter);
+       return (error);
+
+} /* ixgbe_bp_version */
+
+/************************************************************************
+ * ixgbe_bp_set_state
+ *
+ *   Show/Set the Bypass State:
+ *     1 = NORMAL
+ *     2 = BYPASS
+ *     3 = ISOLATE
+ *
+ *     With no argument the state is displayed,
+ *     passing a value will set it.
+ ************************************************************************/
+static int
+ixgbe_bp_set_state(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node = *rnode;
+       struct adapter  *adapter = (struct adapter *)node.sysctl_data;
+       struct ixgbe_hw *hw = &adapter->hw;
+       int             error = 0;
+       static int      state = 0;
+
+       /* Get the current state */
+       ixgbe_bypass_mutex_enter(adapter);
+       error = hw->mac.ops.bypass_rw(hw,
+           BYPASS_PAGE_CTL0, &state);
+       ixgbe_bypass_mutex_clear(adapter);
+       if (error)
+               return (error);
+       state = (state >> BYPASS_STATUS_OFF_SHIFT) & 0x3;
+
+       error = sysctl_lookup(SYSCTLFN_CALL(&node));
+       if ((error) || (newp == NULL))
+               return (error);
+
+       /* Sanity check new state */
+       switch (state) {
+       case BYPASS_NORM:
+       case BYPASS_BYPASS:
+       case BYPASS_ISOLATE:
+               break;
+       default:
+               return (EINVAL);
+       }
+       ixgbe_bypass_mutex_enter(adapter);
+       if ((error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+           BYPASS_MODE_OFF_M, state) != 0))
+               goto out;
+       /* Set AUTO back on so FW can receive events */
+       error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+           BYPASS_MODE_OFF_M, BYPASS_AUTO);
+out:
+       ixgbe_bypass_mutex_clear(adapter);
+       usec_delay(6000);
+       return (error);
+} /* ixgbe_bp_set_state */
+
+/************************************************************************
+ * The following routines control the operational
+ * "rules" of the feature, what behavior will occur
+ * when particular events occur.
+ *     Values are:
+ *             0 - no change for the event (NOP)
+ *             1 - go to Normal operation
+ *             2 - go to Bypass operation
+ *             3 - go to Isolate operation
+ * Calling the entry with no argument just displays
+ * the current rule setting.
+ ************************************************************************/
+
+/************************************************************************
+ * ixgbe_bp_timeout
+ *
+ * This is to set the Rule for the watchdog,
+ * not the actual watchdog timeout value.
+ ************************************************************************/
+static int
+ixgbe_bp_timeout(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node = *rnode;
+       struct adapter  *adapter = (struct adapter *)node.sysctl_data;
+       struct ixgbe_hw *hw = &adapter->hw;
+       int             error = 0;
+       static int      timeout = 0;
+
+       /* Get the current value */
+       ixgbe_bypass_mutex_enter(adapter);
+       error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &timeout);
+       ixgbe_bypass_mutex_clear(adapter);
+       if (error)
+               return (error);
+       timeout = (timeout >> BYPASS_WDTIMEOUT_SHIFT) & 0x3;
+
+       error = sysctl_lookup(SYSCTLFN_CALL(&node));
+       if ((error) || (newp == NULL))
+               return (error);
+
+       /* Sanity check on the setting */
+       switch (timeout) {
+       case BYPASS_NOP:
+       case BYPASS_NORM:
+       case BYPASS_BYPASS:
+       case BYPASS_ISOLATE:
+               break;
+       default:
+               return (EINVAL);
+       }
+
+       /* Set the new state */
+       ixgbe_bypass_mutex_enter(adapter);
+       error = hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL0,
+           BYPASS_WDTIMEOUT_M, timeout << BYPASS_WDTIMEOUT_SHIFT);
+       ixgbe_bypass_mutex_clear(adapter);
+       usec_delay(6000);
+       return (error);
+} /* ixgbe_bp_timeout */
+
+/************************************************************************
+ * ixgbe_bp_main_on
+ ************************************************************************/
+static int
+ixgbe_bp_main_on(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node = *rnode;
+       struct adapter  *adapter = (struct adapter *)node.sysctl_data;
+       struct ixgbe_hw *hw = &adapter->hw;
+       int             error = 0;
+       static int      main_on = 0;
+
+       ixgbe_bypass_mutex_enter(adapter);
+       error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on);
+       main_on = (main_on >> BYPASS_MAIN_ON_SHIFT) & 0x3;
+       ixgbe_bypass_mutex_clear(adapter);
+       if (error)
+               return (error);
+



Home | Main Index | Thread Index | Old Index