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 Fix the problem between eitr and link_speed.



details:   https://anonhg.NetBSD.org/src/rev/421a42f7c670
branches:  trunk
changeset: 831422:421a42f7c670
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Mar 30 03:56:38 2018 +0000

description:
Fix the problem between eitr and link_speed.

In ixgbe_msix_que(), que->eitr_setting is limited to IXGBE_MIN_RSC_EITR_10G1G
when link_speed is 1Gbps or 10Gbps. However, que->eitr_setting is set to EITR
register in the *next* Tx/Rx interrupt. If link_speed changes from 100Mbps to
1Gbps ro 10Gbps, que->eitr_setting which is not limited can be set to EITR
register, that is, the problem fixed by ixgbe.c:r1.124 can occur in this case.

To fix this case, que->eitr_setting should be clear when link_speed is changed
or link state is changed.

Furthermore, expand the variants used for AIM (txr->bytes, txr->packets,
rxr->bytes and rxr->packets) from u32 to u64 to avoid wraparound which causes
que->eitr_setting calculation mistake.

XXX pullup-8

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  17 ++++++++++++++++-
 sys/dev/pci/ixgbe/ixgbe.h |  10 +++++-----
 2 files changed, 21 insertions(+), 6 deletions(-)

diffs (69 lines):

diff -r 56f7b1388ac2 -r 421a42f7c670 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Mar 29 21:40:53 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 30 03:56:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.137 2018/03/26 06:40:28 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.138 2018/03/30 03:56:38 knakahara Exp $ */
 
 /******************************************************************************
 
@@ -4012,6 +4012,13 @@
                ixgbe_set_ivar(adapter, txr->me, que->msix, 1);
                /* Set an Initial EITR value */
                ixgbe_eitr_write(que, newitr);
+               /*
+                * To eliminate influence of the previous state.
+                * At this point, Tx/Rx interrupt handler
+                * (ixgbe_msix_que()) cannot be called, so  both
+                * IXGBE_TX_LOCK and IXGBE_RX_LOCK are not required.
+                */
+               que->eitr_setting = 0;
        }
 
        /* For the Link interrupt */
@@ -4509,6 +4516,14 @@
 
        if (adapter->link_up) {
                if (adapter->link_active == FALSE) {
+                       /*
+                        * To eliminate influence of the previous state
+                        * in the same way as ixgbe_init_locked().
+                        */
+                       struct ix_queue *que = adapter->queues;
+                       for (int i = 0; i < adapter->num_queues; i++, que++)
+                               que->eitr_setting = 0;
+
                        if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL){
                                /*
                                 *  Discard count for both MAC Local Fault and
diff -r 56f7b1388ac2 -r 421a42f7c670 sys/dev/pci/ixgbe/ixgbe.h
--- a/sys/dev/pci/ixgbe/ixgbe.h Thu Mar 29 21:40:53 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.h Fri Mar 30 03:56:38 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.37 2018/03/26 06:40:28 msaitoh Exp $ */
+/* $NetBSD: ixgbe.h,v 1.38 2018/03/30 03:56:38 knakahara Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -370,8 +370,8 @@
        u16                     atr_sample;
        u16                     atr_count;
 
-       u32                     bytes;  /* used for AIM */
-       u32                     packets;
+       u64                     bytes;  /* used for AIM */
+       u64                     packets;
        /* Soft Stats */
        struct evcnt            tso_tx;
        struct evcnt            no_desc_avail;
@@ -413,8 +413,8 @@
        struct ixgbe_rx_buf     *rx_buffers;
        ixgbe_dma_tag_t         *ptag;
 
-       u32                     bytes; /* Used for AIM calc */
-       u32                     packets;
+       u64                     bytes; /* Used for AIM calc */
+       u64                     packets;
 
        /* Soft stats */
        struct evcnt            rx_copies;



Home | Main Index | Thread Index | Old Index