Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/df07c3f58954
branches:  netbsd-8
changeset: 851231:df07c3f58954
user:      snj <snj%NetBSD.org@localhost>
date:      Thu Dec 21 19:28:53 2017 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #441):
        sys/dev/pci/files.pci: 1.390
        sys/dev/pci/ixgbe/if_bypass.c: new
        sys/dev/pci/ixgbe/if_fdir.c: new
        sys/dev/pci/ixgbe/if_sriov.c: new
        sys/dev/pci/ixgbe/ixgbe_bypass.h: new
        sys/dev/pci/ixgbe/ixgbe_fdir.h: new
        sys/dev/pci/ixgbe/ixgbe_features.h: new
        sys/dev/pci/ixgbe/ixgbe_netmap.c: new
        sys/dev/pci/ixgbe/ixgbe_netmap.h: new
        sys/dev/pci/ixgbe/ixgbe_rss.h: new
        sys/dev/pci/ixgbe/ixgbe_sriov.h: new
        sys/dev/pci/ixgbe/ix_txrx.c: 1.28, 1.30 via patch
        sys/dev/pci/ixgbe/ixgbe.c: 1.97-1.105, 1.107-1.111, 1.113-1.115
        sys/dev/pci/ixgbe/ixgbe.h: 1.26-1.29 via patch
        sys/dev/pci/ixgbe/ixv.c: 1.57-1.58, 1.60-1.61, 1.63-1.64, 1.66-1.72, 1.75 via patch
        sys/dev/pci/ixgbe/ixgbe_api.c: 1.17-1.18 via patch
        sys/dev/pci/ixgbe/ixgbe_type.h: 1.26-1.30 via patch
        sys/dev/pci/ixgbe/ixgbe_82598.c: 1.9-1.10 via patch
        sys/dev/pci/ixgbe/ixgbe_82598.h: 1.6-1.7
        sys/dev/pci/ixgbe/ixgbe_82599.c: 1.15-1.16 via patch
        sys/dev/pci/ixgbe/ixgbe_82599.h: 1.5-1.6
        sys/dev/pci/ixgbe/ixgbe_api.h: 1.10-1.11 via patch
        sys/dev/pci/ixgbe/ixgbe_common.c: 1.14-1.16 via patch
        sys/dev/pci/ixgbe/ixgbe_common.h: 1.8-1.9 via patch
        sys/dev/pci/ixgbe/ixgbe_dcb.c: 1.5-1.6
        sys/dev/pci/ixgbe/ixgbe_dcb.h: 1.4-1.5
        sys/dev/pci/ixgbe/ixgbe_dcb_82598.c: 1.4-1.5
        sys/dev/pci/ixgbe/ixgbe_dcb_82598.h: 1.4-1.5
        sys/dev/pci/ixgbe/ixgbe_dcb_82599.c: 1.4-1.5
        sys/dev/pci/ixgbe/ixgbe_dcb_82599.h: 1.4-1.5
        sys/dev/pci/ixgbe/ixgbe_mbx.c: 1.7-1.9 via patch
        sys/dev/pci/ixgbe/ixgbe_mbx.h: 1.11-1.12 via patch
        sys/dev/pci/ixgbe/ixgbe_osdep.c: 1.2
        sys/dev/pci/ixgbe/ixgbe_osdep.h: 1.18-1.19 via patch
        sys/dev/pci/ixgbe/ixgbe_phy.c: 1.12-1.14 via patch
        sys/dev/pci/ixgbe/ixgbe_phy.h: 1.9-1.10 via patch
        sys/dev/pci/ixgbe/ixgbe_vf.c: 1.13-1.15 via patch
        sys/dev/pci/ixgbe/ixgbe_vf.h: 1.9-1.11 via patch
        sys/dev/pci/ixgbe/ixgbe_x540.c: 1.10-1.12
        sys/dev/pci/ixgbe/ixgbe_x540.h: 1.6-1.7
        sys/dev/pci/ixgbe/ixgbe_x550.c: 1.6-1.7
        sys/dev/pci/ixgbe/ixgbe_x550.h: 1.3
Sync with FreeBSD's up to r326022, fix bugs and some improvements:
- Don't limit number of queue pair to 8. Take chip's max TX queues and
  max RX queues into account.
- Add C3000 (Denverton) support.
- Add bypass function support for bypass adapters.
- Change EEE sysctl.
- Remove thermal test sysctl.
- ixv(4): set RSS mapping.
- ixv(4): Add TSOv6.
- ixv(4): Fix hardware counter.
- ixv(4): Make TX/RX descriptors size the same as ixg(4).
- ixv(4): Print device name in ixv_attach().
- ixv(4): Make mailbox statistic counters evcnt(9).
- ixv(4): Fix a problem that mailbox interrupt never occurred.
- ixv(4): Don't check neither VTEICR nor VTEICS same as Linux. It
  seems that both registers can't be used to check which MSI-X vector
  is triggered.
- ixv(4): Print Mailbox API version.
- Print driver feature capabilities and enable bits when verbose boot.
- Fix a bug that X550EM_A (Denverton) can't force 10BaseT.
- Remove all half-duplex setting because of the chip specification.
- Add 2.5GBASE-T and 5GBASE-T support.
- Set ifm_baudrate correctly.
- Protect ec_multi* with mutex like other MP safe Ethernet drivers.
- On X550 and newer, print NVM Image Version with %u.%02x.
- On X540, print PHY FW Revision with %u.%x. 0x4030 will be printed
  as "Revision 4.3 ID 0x0"
- Fix value check of OEM_NVM_IMAGE_VER.
- Print PHY ID only for copper PHY.
- Fix a bug that X550 and newer didn't linkup if it forces
  100BaseTX-FDX or 10BaseT-FDX.
- Fix a bug that RX may accesses freed area. It also fixes a problem
  that if_init() takes long time on many core machine.
- Check ETHERCAP_VLAN_HWTAGGING in ixgbe_setup_vlan_hw_support(). This
  change has no influence to netbsd because it's enabled by default
  and NetBSD has no API to disable it.
- Whitespace fix.

diffstat:

 sys/dev/pci/files.pci               |      4 +-
 sys/dev/pci/ixgbe/if_bypass.c       |    831 ++
 sys/dev/pci/ixgbe/if_fdir.c         |    160 +
 sys/dev/pci/ixgbe/if_sriov.c        |    914 +++
 sys/dev/pci/ixgbe/ix_txrx.c         |   1412 ++--
 sys/dev/pci/ixgbe/ixgbe.c           |  10223 ++++++++++++++++-----------------
 sys/dev/pci/ixgbe/ixgbe.h           |    590 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c     |     55 +-
 sys/dev/pci/ixgbe/ixgbe_82598.h     |     50 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c     |     96 +-
 sys/dev/pci/ixgbe/ixgbe_82599.h     |     47 +-
 sys/dev/pci/ixgbe/ixgbe_api.c       |    250 +-
 sys/dev/pci/ixgbe/ixgbe_api.h       |     75 +-
 sys/dev/pci/ixgbe/ixgbe_bypass.h    |     51 +
 sys/dev/pci/ixgbe/ixgbe_common.c    |    962 ++-
 sys/dev/pci/ixgbe/ixgbe_common.h    |     68 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.c       |     53 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.h       |     43 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.c |     43 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.h |     43 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.c |     43 +-
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.h |     43 +-
 sys/dev/pci/ixgbe/ixgbe_fdir.h      |     58 +
 sys/dev/pci/ixgbe/ixgbe_features.h  |     83 +
 sys/dev/pci/ixgbe/ixgbe_mbx.c       |    207 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.h       |     68 +-
 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     |     23 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c       |    517 +-
 sys/dev/pci/ixgbe/ixgbe_phy.h       |     56 +-
 sys/dev/pci/ixgbe/ixgbe_rss.h       |     63 +
 sys/dev/pci/ixgbe/ixgbe_sriov.h     |    102 +
 sys/dev/pci/ixgbe/ixgbe_type.h      |    548 +-
 sys/dev/pci/ixgbe/ixgbe_vf.c        |    184 +-
 sys/dev/pci/ixgbe/ixgbe_vf.h        |     31 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c      |    144 +-
 sys/dev/pci/ixgbe/ixgbe_x540.h      |     46 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c      |   2486 ++++++-
 sys/dev/pci/ixgbe/ixgbe_x550.h      |     69 +-
 sys/dev/pci/ixgbe/ixv.c             |   3982 +++++++------
 42 files changed, 15103 insertions(+), 10209 deletions(-)

diffs (truncated from 30887 to 300 lines):

diff -r 05c3701d19b2 -r df07c3f58954 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci     Thu Dec 21 19:19:30 2017 +0000
+++ b/sys/dev/pci/files.pci     Thu Dec 21 19:28:53 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.pci,v 1.388 2017/04/13 10:37:36 knakahara Exp $
+#      $NetBSD: files.pci,v 1.388.4.1 2017/12/21 19:28:53 snj 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 05c3701d19b2 -r df07c3f58954 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     Thu Dec 21 19:28:53 2017 +0000
@@ -0,0 +1,831 @@
+/******************************************************************************
+
+  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;
+       node.sysctl_data = &featversion;
+       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;
+
+       node.sysctl_data = &state;
+       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;
+
+       node.sysctl_data = &timeout;
+       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);



Home | Main Index | Thread Index | Old Index