Module Name: src Committed By: knakahara Date: Fri Mar 30 03:56:38 UTC 2018
Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.137 -r1.138 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/ixgbe/ixgbe.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.137 src/sys/dev/pci/ixgbe/ixgbe.c:1.138 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.137 Mon Mar 26 06:40:28 2018 +++ src/sys/dev/pci/ixgbe/ixgbe.c Fri Mar 30 03:56:38 2018 @@ -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_configure_ivars(struct adapter *ad 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 @@ ixgbe_update_link_status(struct adapter 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 Index: src/sys/dev/pci/ixgbe/ixgbe.h diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.37 src/sys/dev/pci/ixgbe/ixgbe.h:1.38 --- src/sys/dev/pci/ixgbe/ixgbe.h:1.37 Mon Mar 26 06:40:28 2018 +++ src/sys/dev/pci/ixgbe/ixgbe.h Fri Mar 30 03:56:38 2018 @@ -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 @@ struct tx_ring { 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 rx_ring { 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;