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 r28...



details:   https://anonhg.NetBSD.org/src/rev/7be71ef33ea4
branches:  trunk
changeset: 349253:7be71ef33ea4
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Dec 02 10:34:23 2016 +0000

description:
Update ixg(4) and ixv(4) up to FreeBSD r289238:
- Add support for sysctl knobs to live tune the per interrupt rx/tx packet
  processing limits in ixgbe(4)
- Some others (netmap, etc.)

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c   |  12 +---
 sys/dev/pci/ixgbe/ixgbe.c     |  49 ++++++++++++++++++---
 sys/dev/pci/ixgbe/ixgbe.h     |  12 +++-
 sys/dev/pci/ixgbe/ixgbe_mbx.h |   2 +-
 sys/dev/pci/ixgbe/ixgbe_vf.c  |   2 +-
 sys/dev/pci/ixgbe/ixv.c       |  96 ++++++++++++++++++++++++++++++++++++++----
 6 files changed, 141 insertions(+), 32 deletions(-)

diffs (truncated from 416 to 300 lines):

diff -r 0a100d339310 -r 7be71ef33ea4 sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Fri Dec 02 10:24:31 2016 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Fri Dec 02 10:34:23 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 285528 2015-07-14 09:13:18Z hiren $*/
-/*$NetBSD: ix_txrx.c,v 1.6 2016/12/02 10:24:31 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 289238 2015-10-13 17:34:18Z sbruno $*/
+/*$NetBSD: ix_txrx.c,v 1.7 2016/12/02 10:34:23 msaitoh Exp $*/
 
 #include "ixgbe.h"
 
@@ -267,11 +267,7 @@
         * If everything is setup correctly, it should be the
         * same bucket that the current CPU we're on is.
         */
-#if __FreeBSD_version < 1100054
-       if (m->m_flags & M_FLOWID) {
-#else
        if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) {
-#endif
 #ifdef RSS
                if (rss_hash2bucket(m->m_pkthdr.flowid,
                    M_HASHTYPE_GET(m), &bucket_id) == 0)
@@ -1028,7 +1024,7 @@
        struct adapter          *adapter = txr->adapter;
        struct ifnet            *ifp = adapter->ifp;
        u32                     work, processed = 0;
-       u16                     limit = txr->process_limit;
+       u32                     limit = adapter->tx_process_limit;
        struct ixgbe_tx_buf     *buf;
        union ixgbe_adv_tx_desc *txd;
 
@@ -1818,7 +1814,7 @@
 #endif /* LRO */
        int                     i, nextp, processed = 0;
        u32                     staterr = 0;
-       u16                     count = rxr->process_limit;
+       u32                     count = adapter->rx_process_limit;
        union ixgbe_adv_rx_desc *cur;
        struct ixgbe_rx_buf     *rbuf, *nbuf;
 #ifdef RSS
diff -r 0a100d339310 -r 7be71ef33ea4 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Fri Dec 02 10:24:31 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Dec 02 10:34:23 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 285590 2015-07-15 00:35:50Z pkelsey $*/
-/*$NetBSD: ixgbe.c,v 1.46 2016/12/02 10:24:31 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 289238 2015-10-13 17:34:18Z sbruno $*/
+/*$NetBSD: ixgbe.c,v 1.47 2016/12/02 10:34:23 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -198,6 +198,8 @@
 static void     ixgbe_add_hw_stats(struct adapter *);
 
 /* 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_thermal_test(SYSCTLFN_PROTO);
@@ -449,6 +451,11 @@
        aprint_normal(": %s, Version - %s\n",
            ixgbe_strings[ent->index], ixgbe_driver_version);
 
+#ifdef DEV_NETMAP
+       adapter->init_locked = ixgbe_init_locked;
+       adapter->stop_locked = ixgbe_stop;
+#endif
+
        /* Core Lock Init*/
        IXGBE_CORE_LOCK_INIT(adapter, device_xname(dev));
 
@@ -465,6 +472,15 @@
                goto err_out;
        }
 
+       /* Sysctls for limiting the amount of work done in the taskqueues */
+       ixgbe_set_sysctl_value(adapter, "rx_processing_limit",
+           "max number of rx packets to process",
+           &adapter->rx_process_limit, ixgbe_rx_process_limit);
+
+       ixgbe_set_sysctl_value(adapter, "tx_processing_limit",
+           "max number of tx packets to process",
+       &adapter->tx_process_limit, ixgbe_tx_process_limit);
+
        /* Do descriptor calc and sanity checks */
        if (((ixgbe_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
            ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) {
@@ -687,6 +703,8 @@
        }
 #endif /* PCI_IOV */
 
+       pmf_device_deregister(dev);
+
        /* Stop the adapter */
        IXGBE_CORE_LOCK(adapter);
        ixgbe_setup_low_power_mode(adapter);
@@ -3033,9 +3051,6 @@
                /* Cache the tail address */
                txr->tail = IXGBE_TDT(j);
 
-               /* Set the processing limit */
-               txr->process_limit = ixgbe_tx_process_limit;
-
                /* Disable Head Writeback */
                switch (hw->mac.type) {
                case ixgbe_mac_82598EB:
@@ -3293,9 +3308,6 @@
                IXGBE_WRITE_REG(hw, IXGBE_RDH(j), 0);
                IXGBE_WRITE_REG(hw, IXGBE_RDT(j), 0);
 
-               /* Set the processing limit */
-               rxr->process_limit = ixgbe_rx_process_limit;
-
                /* Set the driver rx tail address */
                rxr->tail =  IXGBE_RDT(rxr->me);
        }
@@ -4700,6 +4712,27 @@
            stats->namebuf, "1024-1522 byte frames transmitted");
 }
 
+static void
+ixgbe_set_sysctl_value(struct adapter *adapter, const char *name,
+    const char *description, int *limit, int value)
+{
+       device_t dev =  adapter->dev;
+       struct sysctllog **log;
+       const struct sysctlnode *rnode, *cnode;
+
+       log = &adapter->sysctllog;
+       if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) {
+               aprint_error_dev(dev, "could not create sysctl root\n");
+               return;
+       }
+       if (sysctl_createv(log, 0, &rnode, &cnode,
+           CTLFLAG_READWRITE, CTLTYPE_INT,
+           name, SYSCTL_DESCR(description),
+               NULL, 0, limit, 0, CTL_CREATE, CTL_EOL) != 0)
+               aprint_error_dev(dev, "could not create sysctl\n");
+       *limit = value;
+}
+
 /*
 ** Set flow control using sysctl:
 ** Flow control values:
diff -r 0a100d339310 -r 7be71ef33ea4 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Fri Dec 02 10:24:31 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Fri Dec 02 10:34:23 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/ixgbe.h 283893 2015-06-01 20:05:06Z jhb $*/
-/*$NetBSD: ixgbe.h,v 1.14 2016/12/02 10:24:31 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe.h 289238 2015-10-13 17:34:18Z sbruno $*/
+/*$NetBSD: ixgbe.h,v 1.15 2016/12/02 10:34:23 msaitoh Exp $*/
 
 
 #ifndef _IXGBE_H_
@@ -388,7 +388,6 @@
        volatile u16            tx_avail;
        u16                     next_avail_desc;
        u16                     next_to_clean;
-       u32                     process_limit;
        u16                     num_desc;
        u32                     txd_cmd;
        ixgbe_dma_tag_t         *txtag;
@@ -431,7 +430,6 @@
         u16                    next_to_check;
        u16                     num_desc;
        u16                     mbuf_sz;
-       u32                     process_limit;
        char                    mtx_name[16];
        struct ixgbe_rx_buf     *rx_buffers;
        ixgbe_dma_tag_t         *ptag;
@@ -559,6 +557,7 @@
         */
        struct tx_ring          *tx_rings;
        u32                     num_tx_desc;
+       u32                     tx_process_limit;
 
        /*
         * Receive rings:
@@ -567,6 +566,7 @@
        struct rx_ring          *rx_rings;
        u64                     active_queues;
        u32                     num_rx_desc;
+       u32                     rx_process_limit;
 
        /* Multicast array memory */
        struct ixgbe_mc_addr    *mta;
@@ -575,6 +575,10 @@
 #ifdef PCI_IOV
        struct ixgbe_vf         *vfs;
 #endif
+#ifdef DEV_NETMAP
+       void                    (*init_locked)(struct adapter *);
+       void                    (*stop_locked)(void *);
+#endif
 
        /* Misc stats maintained by the driver */
        struct evcnt            dropped_pkts;
diff -r 0a100d339310 -r 7be71ef33ea4 sys/dev/pci/ixgbe/ixgbe_mbx.h
--- a/sys/dev/pci/ixgbe/ixgbe_mbx.h     Fri Dec 02 10:24:31 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_mbx.h     Fri Dec 02 10:34:23 2016 +0000
@@ -31,7 +31,7 @@
 
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_mbx.h 283883 2015-06-01 17:43:34Z jfv $*/
-/*$NetBSD: ixgbe_mbx.h,v 1.8 2016/12/02 10:24:31 msaitoh Exp $*/
+/*$NetBSD: ixgbe_mbx.h,v 1.9 2016/12/02 10:34:23 msaitoh Exp $*/
 
 #ifndef _IXGBE_MBX_H_
 #define _IXGBE_MBX_H_
diff -r 0a100d339310 -r 7be71ef33ea4 sys/dev/pci/ixgbe/ixgbe_vf.c
--- a/sys/dev/pci/ixgbe/ixgbe_vf.c      Fri Dec 02 10:24:31 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.c      Fri Dec 02 10:34:23 2016 +0000
@@ -31,7 +31,7 @@
 
 ******************************************************************************/
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_vf.c 285590 2015-07-15 00:35:50Z pkelsey $*/
-/*$NetBSD: ixgbe_vf.c,v 1.10 2016/12/02 10:24:31 msaitoh Exp $*/
+/*$NetBSD: ixgbe_vf.c,v 1.11 2016/12/02 10:34:23 msaitoh Exp $*/
 
 
 #include "ixgbe_api.h"
diff -r 0a100d339310 -r 7be71ef33ea4 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Fri Dec 02 10:24:31 2016 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Fri Dec 02 10:34:23 2016 +0000
@@ -30,8 +30,8 @@
   POSSIBILITY OF SUCH DAMAGE.
 
 ******************************************************************************/
-/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 285590 2015-07-15 00:35:50Z pkelsey $*/
-/*$NetBSD: ixv.c,v 1.24 2016/12/02 10:24:31 msaitoh Exp $*/
+/*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 289238 2015-10-13 17:34:18Z sbruno $*/
+/*$NetBSD: ixv.c,v 1.25 2016/12/02 10:34:23 msaitoh Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -121,6 +121,8 @@
 static void    ixv_init_stats(struct adapter *);
 static void    ixv_update_stats(struct adapter *);
 static void    ixv_add_stats_sysctls(struct adapter *);
+static void    ixv_set_sysctl_value(struct adapter *, const char *,
+                   const char *, int *, int);
 
 /* The MSI/X Interrupt handlers */
 static int     ixv_msix_que(void *);
@@ -133,6 +135,18 @@
 const struct sysctlnode *ixv_sysctl_instance(struct adapter *);
 static ixgbe_vendor_info_t *ixv_lookup(const struct pci_attach_args *);
 
+#ifdef DEV_NETMAP
+/*
+ * This is defined in <dev/netmap/ixgbe_netmap.h>, which is included by
+ * if_ix.c.
+ */
+extern void ixgbe_netmap_attach(struct adapter *adapter);
+
+#include <net/netmap.h>
+#include <sys/selinfo.h>
+#include <dev/netmap/netmap_kern.h>
+#endif /* DEV_NETMAP */
+
 /*********************************************************************
  *  FreeBSD Device Interface Entry Points
  *********************************************************************/
@@ -161,6 +175,9 @@
 DRIVER_MODULE(ixv, pci, ixv_driver, ixv_devclass, 0, 0);
 MODULE_DEPEND(ixv, pci, 1, 1, 1);
 MODULE_DEPEND(ixv, ether, 1, 1, 1);
+#ifdef DEV_NETMAP
+MODULE_DEPEND(ix, netmap, 1, 1, 1);
+#endif /* DEV_NETMAP */
 /* XXX depend on 'ix' ? */
 #endif
 
@@ -327,6 +344,11 @@
        aprint_normal(": %s, Version - %s\n",
            ixv_strings[ent->index], ixv_driver_version);
 
+#ifdef DEV_NETMAP
+       adapter->init_locked = ixv_init_locked;
+       adapter->stop_locked = ixv_stop;
+#endif
+
        /* Core Lock Init*/
        IXGBE_CORE_LOCK_INIT(adapter, device_xname(dev));
 
@@ -346,6 +368,15 @@
                goto err_out;
        }



Home | Main Index | Thread Index | Old Index