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 Update ixg(4) and ixv(4) up to FreeBSD r30...



details:   https://anonhg.NetBSD.org/src/rev/6478bf117d77
branches:  trunk
changeset: 349299:6478bf117d77
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Dec 05 08:50:29 2016 +0000

description:
Update ixg(4) and ixv(4) up to FreeBSD r303890:
- Configure ixgbe phy & gbic power.
  Setup phy and gbic power as per Linux 4.3.13 driver.
  This fixes link not detected on X540-AT2 after booting to Linux which
  turns the phy power off on detach. (FreeBSD r295093)
- Fixup DA cable detection routine. (FreeBSD r303032)
- Some minor changes

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c      |   14 +--
 sys/dev/pci/ixgbe/ixgbe.c        |  153 ++++++++++++++++++++++++++------------
 sys/dev/pci/ixgbe/ixgbe.h        |    5 +-
 sys/dev/pci/ixgbe/ixgbe_api.c    |    6 +-
 sys/dev/pci/ixgbe/ixgbe_common.c |   13 ++-
 sys/dev/pci/ixgbe/ixgbe_mbx.c    |    8 +-
 sys/dev/pci/ixgbe/ixgbe_osdep.h  |   32 ++++++-
 sys/dev/pci/ixgbe/ixgbe_phy.c    |   18 ++--
 sys/dev/pci/ixgbe/ixgbe_type.h   |   18 +--
 sys/dev/pci/ixgbe/ixgbe_x540.c   |    3 +-
 sys/dev/pci/ixgbe/ixgbe_x550.c   |   19 ++++-
 sys/dev/pci/ixgbe/ixv.c          |    8 +-
 12 files changed, 193 insertions(+), 104 deletions(-)

diffs (truncated from 790 to 300 lines):

diff -r 5d0f2916df67 -r 6478bf117d77 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Mon Dec 05 07:24:16 2016 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Mon Dec 05 08:50:29 2016 +0000
@@ -58,8 +58,8 @@
  * 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/ix_txrx.c 292751 2015-12-26 17:27:48Z bz $*/
-/*$NetBSD: ix_txrx.c,v 1.9 2016/12/02 12:14:37 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 301538 2016-06-07 04:51:50Z sephe $*/
+/*$NetBSD: ix_txrx.c,v 1.10 2016/12/05 08:50:29 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -433,7 +433,7 @@
        }
 
        /* Make certain there are enough descriptors */
-       if (map->dm_nsegs > txr->tx_avail - 2) {
+       if (txr->tx_avail < (map->dm_nsegs + 2)) {
                txr->no_desc_avail.ev_count++;
                ixgbe_dmamap_unload(txr->txtag, txbuf->map);
                return EAGAIN;
@@ -1804,7 +1804,6 @@
        struct ifnet            *ifp = adapter->ifp;
 #ifdef LRO
        struct lro_ctrl         *lro = &rxr->lro;
-       struct lro_entry        *queued;
 #endif /* LRO */
        int                     i, nextp, processed = 0;
        u32                     staterr = 0;
@@ -2026,7 +2025,7 @@
 #endif
                                     default:
                                         M_HASHTYPE_SET(sendmp,
-                                            M_HASHTYPE_OPAQUE);
+                                            M_HASHTYPE_OPAQUE_HASH);
                                 }
                         } else {
                                 sendmp->m_pkthdr.flowid = que->msix;
@@ -2066,10 +2065,7 @@
        /*
         * Flush any outstanding LRO work
         */
-       while ((queued = SLIST_FIRST(&lro->lro_active)) != NULL) {
-               SLIST_REMOVE_HEAD(&lro->lro_active, next);
-               tcp_lro_flush(lro, queued);
-       }
+       tcp_lro_flush_all(lro);
 #endif /* LRO */
 
        IXGBE_RX_UNLOCK(rxr);
diff -r 5d0f2916df67 -r 6478bf117d77 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Mon Dec 05 07:24:16 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Mon Dec 05 08:50:29 2016 +0000
@@ -58,8 +58,8 @@
  * 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_ix.c 294578 2016-01-22 17:03:32Z smh $*/
-/*$NetBSD: ixgbe.c,v 1.51 2016/12/02 12:14:37 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/
+/*$NetBSD: ixgbe.c,v 1.52 2016/12/05 08:50:29 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -194,12 +194,14 @@
 
 static void    ixgbe_add_device_sysctls(struct adapter *);
 static void     ixgbe_add_hw_stats(struct adapter *);
+static int     ixgbe_set_flowcntl(struct adapter *, int);
+static int     ixgbe_set_advertise(struct adapter *, int);
 
 /* Sysctl handlers */
 static void    ixgbe_set_sysctl_value(struct adapter *, const char *,
                     const char *, int *, int);
-static int     ixgbe_set_flowcntl(SYSCTLFN_PROTO);
-static int     ixgbe_set_advertise(SYSCTLFN_PROTO);
+static int     ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO);
+static int     ixgbe_sysctl_advertise(SYSCTLFN_PROTO);
 static int     ixgbe_sysctl_thermal_test(SYSCTLFN_PROTO);
 static int     ixgbe_sysctl_dmac(SYSCTLFN_PROTO);
 static int     ixgbe_sysctl_phy_temp(SYSCTLFN_PROTO);
@@ -280,19 +282,37 @@
 ** traffic for that interrupt vector
 */
 static int ixgbe_enable_aim = TRUE;
-#define SYSCTL_INT(__x, __y)
-SYSCTL_INT("hw.ixgbe.enable_aim", &ixgbe_enable_aim);
+#define SYSCTL_INT(_a1, _a2, _a3, _a4, _a5, _a6, _a7)
+SYSCTL_INT(_hw_ix, OID_AUTO, enable_aim, CTLFLAG_RWTUN, &ixgbe_enable_aim, 0,
+    "Enable adaptive interrupt moderation");
 
 static int ixgbe_max_interrupt_rate = (4000000 / IXGBE_LOW_LATENCY);
-SYSCTL_INT("hw.ixgbe.max_interrupt_rate", &ixgbe_max_interrupt_rate);
+SYSCTL_INT(_hw_ix, OID_AUTO, max_interrupt_rate, CTLFLAG_RDTUN,
+    &ixgbe_max_interrupt_rate, 0, "Maximum interrupts per second");
 
 /* How many packets rxeof tries to clean at a time */
 static int ixgbe_rx_process_limit = 256;
-SYSCTL_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit);
+SYSCTL_INT(_hw_ix, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN,
+    &ixgbe_rx_process_limit, 0,
+    "Maximum number of received packets to process at a time,"
+    "-1 means unlimited");
 
 /* How many packets txeof tries to clean at a time */
 static int ixgbe_tx_process_limit = 256;
-SYSCTL_INT("hw.ixgbe.tx_process_limit", &ixgbe_tx_process_limit);
+SYSCTL_INT(_hw_ix, OID_AUTO, tx_process_limit, CTLFLAG_RDTUN,
+    &ixgbe_tx_process_limit, 0,
+    "Maximum number of sent packets to process at a time,"
+    "-1 means unlimited");
+
+/* Flow control setting, default to full */
+static int ixgbe_flow_control = ixgbe_fc_full;
+SYSCTL_INT(_hw_ix, OID_AUTO, flow_control, CTLFLAG_RDTUN,
+    &ixgbe_flow_control, 0, "Default flow control used for all adapters");
+
+/* Advertise Speed, default to 0 (auto) */
+static int ixgbe_advertise_speed = 0;
+SYSCTL_INT(_hw_ix, OID_AUTO, advertise_speed, CTLFLAG_RDTUN,
+    &ixgbe_advertise_speed, 0, "Default advertised speed for all adapters");
 
 /*
 ** Smart speed setting, default to on
@@ -308,7 +328,8 @@
  * but this allows it to be forced off for testing.
  */
 static int ixgbe_enable_msix = 1;
-SYSCTL_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix);
+SYSCTL_INT(_hw_ix, OID_AUTO, enable_msix, CTLFLAG_RDTUN, &ixgbe_enable_msix, 0,
+    "Enable MSI-X interrupts");
 
 /*
  * Number of Queues, can be set to 0,
@@ -317,7 +338,8 @@
  * can be overriden manually here.
  */
 static int ixgbe_num_queues = 1;
-SYSCTL_INT("hw.ixgbe.num_queues", &ixgbe_num_queues);
+SYSCTL_INT(_hw_ix, OID_AUTO, num_queues, CTLFLAG_RDTUN, &ixgbe_num_queues, 0,
+    "Number of queues to configure, 0 indicates autoconfigure");
 
 /*
 ** Number of TX descriptors per ring,
@@ -325,11 +347,13 @@
 ** the better performing choice.
 */
 static int ixgbe_txd = PERFORM_TXD;
-SYSCTL_INT("hw.ixgbe.txd", &ixgbe_txd);
+SYSCTL_INT(_hw_ix, OID_AUTO, txd, CTLFLAG_RDTUN, &ixgbe_txd, 0,
+    "Number of transmit descriptors per queue");
 
 /* Number of RX descriptors per ring */
 static int ixgbe_rxd = PERFORM_RXD;
-SYSCTL_INT("hw.ixgbe.rxd", &ixgbe_rxd);
+SYSCTL_INT(_hw_ix, OID_AUTO, rxd, CTLFLAG_RDTUN, &ixgbe_rxd, 0,
+    "Number of receive descriptors per queue");
 
 /*
 ** Defining this on will allow the use
@@ -337,7 +361,8 @@
 ** doing so you are on your own :)
 */
 static int allow_unsupported_sfp = false;
-SYSCTL_INT("hw.ix.unsupported_sfp", &allow_unsupported_sfp);
+#define TUNABLE_INT(__x, __y)
+TUNABLE_INT("hw.ix.unsupported_sfp", &allow_unsupported_sfp);
 
 /* Keep running tab on them for sanity check */
 static int ixgbe_total_ports;
@@ -575,6 +600,11 @@
                break;
        }
 
+       /* hw.ix defaults init */
+       ixgbe_set_advertise(adapter, ixgbe_advertise_speed);
+       ixgbe_set_flowcntl(adapter, ixgbe_flow_control);
+       adapter->enable_aim = ixgbe_enable_aim;
+
        error = -1;
        if ((adapter->msix > 1) && (ixgbe_enable_msix))
                error = ixgbe_allocate_msix(adapter, pa);
@@ -583,6 +613,12 @@
        if (error) 
                goto err_late;
 
+       /* Enable the optics for 82599 SFP+ fiber */
+       ixgbe_enable_tx_laser(hw);
+
+       /* Enable power to the phy. */
+       ixgbe_set_phy_power(hw, TRUE);
+
        /* Setup OS specific network interface */
        if (ixgbe_setup_interface(dev, adapter) != 0)
                goto err_late;
@@ -1307,6 +1343,9 @@
                        device_printf(dev, "Error setting up EEE: %d\n", err);
        }
 
+       /* Enable power to the phy. */
+       ixgbe_set_phy_power(hw, TRUE);
+
        /* Config/Enable Link */
        ixgbe_config_link(adapter);
 
@@ -1638,7 +1677,7 @@
 
        /* Do AIM now? */
 
-       if (ixgbe_enable_aim == FALSE)
+       if (adapter->enable_aim == FALSE)
                goto no_calc;
        /*
        ** Do Adaptive Interrupt Moderation:
@@ -2163,7 +2202,7 @@
        mta = (struct ixgbe_mc_addr *)*update_ptr;
        *vmdq = mta->vmdq;
 
-       *update_ptr = (u8*)(mta + 1);;
+       *update_ptr = (u8*)(mta + 1);
        return (mta->addr);
 }
 
@@ -4087,6 +4126,9 @@
 
        KASSERT(mutex_owned(&adapter->core_mtx));
 
+       if (!hw->wol_enabled)
+               ixgbe_set_phy_power(hw, FALSE);
+
        /* Limit power management flow to X550EM baseT */
        if (hw->device_id == IXGBE_DEV_ID_X550EM_X_10G_T
            && hw->phy.ops.enter_lplu) {
@@ -4403,7 +4445,7 @@
        if (sysctl_createv(log, 0, &rnode, &cnode,
            CTLFLAG_READWRITE, CTLTYPE_INT,
            "fc", SYSCTL_DESCR(IXGBE_SYSCTL_DESC_SET_FC),
-           ixgbe_set_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
+           ixgbe_sysctl_flowcntl, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
                aprint_error_dev(dev, "could not create sysctl\n");
 
        /* XXX This is an *instance* sysctl controlling a *global* variable.
@@ -4418,7 +4460,7 @@
        if (sysctl_createv(log, 0, &rnode, &cnode,
            CTLFLAG_READWRITE, CTLTYPE_INT,
            "advertise_speed", SYSCTL_DESCR(IXGBE_SYSCTL_DESC_ADV_SPEED),
-           ixgbe_set_advertise, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
+           ixgbe_sysctl_advertise, 0, (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0)
                aprint_error_dev(dev, "could not create sysctl\n");
 
        if (sysctl_createv(log, 0, &rnode, &cnode,
@@ -4873,23 +4915,32 @@
 **     3 - full
 */
 static int
-ixgbe_set_flowcntl(SYSCTLFN_ARGS)
+ixgbe_sysctl_flowcntl(SYSCTLFN_ARGS)
 {
+       int error, fc;
        struct sysctlnode node = *rnode;
        struct adapter *adapter = (struct adapter *)node.sysctl_data;
-       int error, last;
 
        node.sysctl_data = &adapter->fc;
-       last = adapter->fc;
+       fc = adapter->fc;
+
        error = sysctl_lookup(SYSCTLFN_CALL(&node));
        if (error != 0 || newp == NULL)
                return error;
 
        /* Don't bother if it's not changed */
-       if (adapter->fc == last)
+       if (adapter->fc == fc)
                return (0);
 
-       switch (adapter->fc) {
+       return ixgbe_set_flowcntl(adapter, fc);
+}
+
+
+static int
+ixgbe_set_flowcntl(struct adapter *adapter, int fc)
+{
+
+       switch (fc) {
                case ixgbe_fc_rx_pause:
                case ixgbe_fc_tx_pause:
                case ixgbe_fc_full:
@@ -4903,13 +4954,13 @@
                                ixgbe_enable_rx_drop(adapter);
                        break;
                default:
-                       adapter->fc = last;
                        return (EINVAL);
        }
+       adapter->fc = fc;
        /* Don't autoneg if forcing a value */



Home | Main Index | Thread Index | Old Index