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 Sync with FreeBSD ix-3.3.8 part 1. No func...



details:   https://anonhg.NetBSD.org/src/rev/477a7a8d8a5e
branches:  trunk
changeset: 452320:477a7a8d8a5e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jun 27 05:55:40 2019 +0000

description:
Sync with FreeBSD ix-3.3.8 part 1. No functional change in this part:
 - Move ixgbe_toggle_txdctl() to ixgbe_common.c and modify a bit.
   No functional change because this function is currently used for SR-IOV
   and it's not used in NetBSD.
 - Some modification to match the latest netmap API.
 - Modify ixgbe_hic_unlocked(). No functional change because neither
   IXGBE_HOST_INTERFACE_APPLY_UPDATE_CMD(0x38) nor
   IXGBE_HOST_INTERFACE_SHADOW_RAM_READ_CMD(0x31) are used.
 - Add ixgbe_clear_mbx(). No functional change because this function is not
   used yet.
 - Add some not-yet-used register definitions.
 - Whitespace fixes.

diffstat:

 sys/dev/pci/ixgbe/if_sriov.c     |  46 +--------------------------
 sys/dev/pci/ixgbe/ix_txrx.c      |  19 +++++-----
 sys/dev/pci/ixgbe/ixgbe.c        |   6 +-
 sys/dev/pci/ixgbe/ixgbe.h        |  22 ++++++------
 sys/dev/pci/ixgbe/ixgbe_api.c    |  15 ++++++++-
 sys/dev/pci/ixgbe/ixgbe_api.h    |   3 +-
 sys/dev/pci/ixgbe/ixgbe_common.c |  69 ++++++++++++++++++++++++++++++++++++++-
 sys/dev/pci/ixgbe/ixgbe_common.h |   3 +-
 sys/dev/pci/ixgbe/ixgbe_mbx.c    |  45 +++++++++++++++++++++++++-
 sys/dev/pci/ixgbe/ixgbe_mbx.h    |   3 +-
 sys/dev/pci/ixgbe/ixgbe_netmap.c |   3 +-
 sys/dev/pci/ixgbe/ixgbe_type.h   |  21 +++++++++++-
 12 files changed, 175 insertions(+), 80 deletions(-)

diffs (truncated from 578 to 300 lines):

diff -r 2176caf250d6 -r 477a7a8d8a5e sys/dev/pci/ixgbe/if_sriov.c
--- a/sys/dev/pci/ixgbe/if_sriov.c      Thu Jun 27 02:44:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/if_sriov.c      Thu Jun 27 05:55:40 2019 +0000
@@ -264,50 +264,6 @@
 } /* ixgbe_clear_vfmbmem */
 
 
-static void
-ixgbe_toggle_txdctl(struct ixgbe_hw *hw, struct ixgbe_vf *vf)
-{
-       uint32_t vf_index, offset, reg;
-       uint8_t  queue_count, i;
-
-       IXGBE_CORE_LOCK_ASSERT(adapter);
-
-       vf_index = IXGBE_VF_INDEX(vf->pool);
-
-       /* Determine number of queues by checking
-        * number of virtual functions */
-       reg = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
-       switch (reg & IXGBE_GCR_EXT_VT_MODE_MASK) {
-       case IXGBE_GCR_EXT_VT_MODE_64:
-               queue_count = 2;
-               break;
-       case IXGBE_GCR_EXT_VT_MODE_32:
-               queue_count = 4;
-               break;
-       default:
-               return;
-       }
-
-       /* Toggle queues */
-       for (i = 0; i < queue_count; ++i) {
-               /* Calculate offset of current queue */
-               offset = queue_count * vf_index + i;
-
-               /* Enable queue */
-               reg = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(offset));
-               reg |= IXGBE_TXDCTL_ENABLE;
-               IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(offset), reg);
-               IXGBE_WRITE_FLUSH(hw);
-
-               /* Disable queue */
-               reg = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(offset));
-               reg &= ~IXGBE_TXDCTL_ENABLE;
-               IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(offset), reg);
-               IXGBE_WRITE_FLUSH(hw);
-       }
-} /* ixgbe_toggle_txdctl */
-
-
 static boolean_t
 ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
 {
@@ -364,7 +320,7 @@
 
        ixgbe_clear_rar(&adapter->hw, vf->rar_index);
        ixgbe_clear_vfmbmem(&adapter->hw, vf);
-       ixgbe_toggle_txdctl(&adapter->hw, vf);
+       ixgbe_toggle_txdctl(&adapter->hw, IXGBE_VF_INDEX(vf->pool));
 
        vf->api_ver = IXGBE_API_VER_UNKNOWN;
 } /* ixgbe_process_vf_reset */
diff -r 2176caf250d6 -r 477a7a8d8a5e sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Thu Jun 27 02:44:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Thu Jun 27 05:55:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.52 2019/02/22 06:49:15 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.53 2019/06/27 05:55:40 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -694,7 +694,7 @@
                 * netmap_idx_n2k() handles wraparounds properly.
                 */
                if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && slot) {
-                       int si = netmap_idx_n2k(&na->tx_rings[txr->me], i);
+                       int si = netmap_idx_n2k(na->tx_rings[txr->me], i);
                        netmap_load_map(na, txr->txtag,
                            txbuf->map, NMB(na, slot + si));
                }
@@ -1105,7 +1105,7 @@
        if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) &&
            (adapter->ifp->if_capenable & IFCAP_NETMAP)) {
                struct netmap_adapter *na = NA(adapter->ifp);
-               struct netmap_kring *kring = &na->tx_rings[txr->me];
+               struct netmap_kring *kring = na->tx_rings[txr->me];
                txd = txr->tx_base;
                bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map,
                    BUS_DMASYNC_POSTREAD);
@@ -1123,9 +1123,8 @@
                 * - the driver ignores tx interrupts unless netmap_mitigate=0
                 *   or the slot has the DD bit set.
                 */
-               if (!netmap_mitigate ||
-                   (kring->nr_kflags < kring->nkr_num_slots &&
-                    txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD)) {
+               if (kring->nr_kflags < kring->nkr_num_slots &&
+                   txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD) {
                        netmap_tx_irq(ifp, txr->me);
                }
                return false;
@@ -1405,7 +1404,7 @@
 static int
 ixgbe_allocate_receive_buffers(struct rx_ring *rxr)
 {
-       struct  adapter     *adapter = rxr->adapter;
+       struct adapter      *adapter = rxr->adapter;
        device_t            dev = adapter->dev;
        struct ixgbe_rx_buf *rxbuf;
        int                 bsize, error;
@@ -1530,7 +1529,7 @@
                 * an mbuf, so end the block with a continue;
                 */
                if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && slot) {
-                       int sj = netmap_idx_n2k(&na->rx_rings[rxr->me], j);
+                       int sj = netmap_idx_n2k(na->rx_rings[rxr->me], j);
                        uint64_t paddr;
                        void *addr;
 
@@ -1827,7 +1826,7 @@
                u16         len;
                u16         vtag = 0;
                bool        eop;
- 
+
                /* Sync the ring. */
                ixgbe_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
                    BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
@@ -2307,7 +2306,7 @@
 
        /*
         * Next the RX queues...
-        */ 
+        */
        rsize = roundup2(adapter->num_rx_desc * sizeof(union ixgbe_adv_rx_desc),
            DBA_ALIGN);
        for (int i = 0; i < adapter->num_queues; i++, rxconf++) {
diff -r 2176caf250d6 -r 477a7a8d8a5e sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Jun 27 02:44:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Jun 27 05:55:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.188 2019/06/04 09:43:15 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.189 2019/06/27 05:55:40 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -81,7 +81,7 @@
  * Driver version
  ************************************************************************/
 static const char ixgbe_driver_version[] = "4.0.1-k";
-/* XXX NetBSD: + 3.3.6 */
+/* XXX NetBSD: + 3.3.8 */
 
 /************************************************************************
  * PCI Device ID Table
@@ -4019,7 +4019,7 @@
                if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) &&
                    (ifp->if_capenable & IFCAP_NETMAP)) {
                        struct netmap_adapter *na = NA(adapter->ifp);
-                       struct netmap_kring *kring = &na->rx_rings[i];
+                       struct netmap_kring *kring = na->rx_rings[i];
                        int t = na->num_rx_desc - 1 - nm_kr_rxspace(kring);
 
                        IXGBE_WRITE_REG(hw, IXGBE_RDT(rxr->me), t);
diff -r 2176caf250d6 -r 477a7a8d8a5e sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Thu Jun 27 02:44:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Thu Jun 27 05:55:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.54 2019/02/22 06:49:15 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.55 2019/06/27 05:55:40 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -240,7 +240,7 @@
 #endif
 
 /*
- * Interrupt Moderation parameters 
+ * Interrupt Moderation parameters
  */
 #define IXGBE_LOW_LATENCY      128
 #define IXGBE_AVE_LATENCY      400
@@ -348,7 +348,7 @@
  * The transmit ring, one per queue
  */
 struct tx_ring {
-        struct adapter         *adapter;
+       struct adapter          *adapter;
        kmutex_t                tx_mtx;
        u32                     me;
        u32                     tail;
@@ -396,7 +396,7 @@
  * The Receive ring, one per rx queue
  */
 struct rx_ring {
-        struct adapter         *adapter;
+       struct adapter          *adapter;
        kmutex_t                rx_mtx;
        u32                     me;
        u32                     tail;
@@ -408,8 +408,8 @@
        bool                    lro_enabled;
        bool                    hw_rsc;
        bool                    vtag_strip;
-        u16                    next_to_refresh;
-        u16                    next_to_check;
+       u16                     next_to_refresh;
+       u16                     next_to_check;
        u16                     num_desc;
        u16                     mbuf_sz;
 #if 0
@@ -678,11 +678,11 @@
        "\nControl advertised link speed using these flags:\n" \
        "\t0x01 - advertise 100M\n" \
        "\t0x02 - advertise 1G\n" \
-        "\t0x04 - advertise 10G\n" \
-        "\t0x08 - advertise 10M\n" \
-        "\t0x10 - advertise 2.5G\n" \
-        "\t0x20 - advertise 5G\n\n" \
-        "\t5G, 2.5G, 100M and 10M are only supported on certain adapters."
+       "\t0x04 - advertise 10G\n" \
+       "\t0x08 - advertise 10M\n" \
+       "\t0x10 - advertise 2.5G\n" \
+       "\t0x20 - advertise 5G\n\n" \
+       "\t5G, 2.5G, 100M and 10M are only supported on certain adapters."
 
 #define IXGBE_SYSCTL_DESC_SET_FC \
        "\nSet flow control mode using these values:\n" \
diff -r 2176caf250d6 -r 477a7a8d8a5e sys/dev/pci/ixgbe/ixgbe_api.c
--- a/sys/dev/pci/ixgbe/ixgbe_api.c     Thu Jun 27 02:44:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_api.c     Thu Jun 27 05:55:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_api.c,v 1.22 2018/12/06 13:25:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe_api.c,v 1.23 2019/06/27 05:55:40 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -1106,6 +1106,19 @@
 }
 
 /**
+ *  ixgbe_toggle_txdctl - Toggle VF's queues
+ *  @hw: pointer to hardware structure
+ *  @vind: VMDq pool index
+ *
+ *  Enable and disable each queue in VF.
+ */
+s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vind)
+{
+       return ixgbe_call_func(hw, hw->mac.ops.toggle_txdctl, (hw,
+                              vind), IXGBE_NOT_IMPLEMENTED);
+}
+
+/**
  *  ixgbe_fc_enable - Enable flow control
  *  @hw: pointer to hardware structure
  *
diff -r 2176caf250d6 -r 477a7a8d8a5e sys/dev/pci/ixgbe/ixgbe_api.h
--- a/sys/dev/pci/ixgbe/ixgbe_api.h     Thu Jun 27 02:44:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_api.h     Thu Jun 27 05:55:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_api.h,v 1.14 2018/12/06 13:25:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe_api.h,v 1.15 2019/06/27 05:55:40 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -133,6 +133,7 @@
 s32 ixgbe_set_vlvf(struct ixgbe_hw *hw, u32 vlan, u32 vind,
                   bool vlan_on, u32 *vfta_delta, u32 vfta,
                   bool vlvf_bypass);
+s32 ixgbe_toggle_txdctl(struct ixgbe_hw *hw, u32 vind);
 s32 ixgbe_fc_enable(struct ixgbe_hw *hw);
 s32 ixgbe_setup_fc(struct ixgbe_hw *hw);
 s32 ixgbe_set_fw_drv_ver(struct ixgbe_hw *hw, u8 maj, u8 min, u8 build,
diff -r 2176caf250d6 -r 477a7a8d8a5e sys/dev/pci/ixgbe/ixgbe_common.c
--- a/sys/dev/pci/ixgbe/ixgbe_common.c  Thu Jun 27 02:44:54 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_common.c  Thu Jun 27 05:55:40 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_common.c,v 1.22 2018/04/04 08:59:22 msaitoh Exp $ */
+/* $NetBSD: ixgbe_common.c,v 1.23 2019/06/27 05:55:40 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -136,6 +136,7 @@
        mac->ops.init_uta_tables = NULL;
        mac->ops.enable_rx = ixgbe_enable_rx_generic;
        mac->ops.disable_rx = ixgbe_disable_rx_generic;
+       mac->ops.toggle_txdctl = ixgbe_toggle_txdctl_generic;
 
        /* Flow Control */
        mac->ops.fc_enable = ixgbe_fc_enable_generic;
@@ -4163,6 +4164,61 @@
 }
 
 /**
+ *  ixgbe_toggle_txdctl_generic - Toggle VF's queues
+ *  @hw: pointer to hardware structure
+ *  @vf_number: VF index
+ *



Home | Main Index | Thread Index | Old Index