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 Use ixgbe_eitr_write() when writing the EI...



details:   https://anonhg.NetBSD.org/src/rev/9ceea11b7c3f
branches:  trunk
changeset: 322138:9ceea11b7c3f
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Apr 19 07:40:12 2018 +0000

description:
Use ixgbe_eitr_write() when writing the EITR for the link interrupt like
queue's EITR to write the register safely. This change is not relatively
so important than queue's EITR because link's EITR is written in if_init().

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c |  17 ++++++++---------
 sys/dev/pci/ixgbe/ixv.c   |  17 ++++++++---------
 2 files changed, 16 insertions(+), 18 deletions(-)

diffs (147 lines):

diff -r 10128d1b7784 -r 9ceea11b7c3f sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Thu Apr 19 07:36:23 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Thu Apr 19 07:40:12 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.148 2018/04/17 08:38:05 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.149 2018/04/19 07:40:12 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -208,7 +208,7 @@
 static void    ixgbe_set_ivar(struct adapter *, u8, u8, s8);
 static void    ixgbe_configure_ivars(struct adapter *);
 static u8 *    ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
-static void    ixgbe_eitr_write(struct ix_queue *, uint32_t);
+static void    ixgbe_eitr_write(struct adapter *, uint32_t, uint32_t);
 
 static void    ixgbe_setup_vlan_hw_support(struct adapter *);
 #if 0
@@ -2559,7 +2559,7 @@
         *    the last interval.
         */
        if (que->eitr_setting)
-               ixgbe_eitr_write(que, que->eitr_setting);
+               ixgbe_eitr_write(adapter, que->msix, que->eitr_setting);
 
        que->eitr_setting = 0;
 
@@ -3042,16 +3042,15 @@
 } /* ixgbe_msix_link */
 
 static void
-ixgbe_eitr_write(struct ix_queue *que, uint32_t itr)
+ixgbe_eitr_write(struct adapter *adapter, uint32_t index, uint32_t itr)
 {
-       struct adapter *adapter = que->adapter;
        
         if (adapter->hw.mac.type == ixgbe_mac_82598EB)
                 itr |= itr << 16;
         else
                 itr |= IXGBE_EITR_CNT_WDIS;
 
-       IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(que->msix), itr);
+       IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(index), itr);
 }
 
 
@@ -3099,7 +3098,7 @@
                ixgbe_max_interrupt_rate = rate;
        } else
                ixgbe_max_interrupt_rate = 0;
-       ixgbe_eitr_write(que, reg);
+       ixgbe_eitr_write(adapter, que->msix, reg);
 
        return (0);
 } /* ixgbe_sysctl_interrupt_rate_handler */
@@ -3919,7 +3918,7 @@
        }
 
        /* Set moderation on the Link interrupt */
-       IXGBE_WRITE_REG(hw, IXGBE_EITR(adapter->vector), IXGBE_LINK_ITR);
+       ixgbe_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR);
 
        /* Enable power to the phy. */
        ixgbe_set_phy_power(hw, TRUE);
@@ -4054,7 +4053,7 @@
                /* ... and the TX */
                ixgbe_set_ivar(adapter, txr->me, que->msix, 1);
                /* Set an Initial EITR value */
-               ixgbe_eitr_write(que, newitr);
+               ixgbe_eitr_write(adapter, que->msix, newitr);
                /*
                 * To eliminate influence of the previous state.
                 * At this point, Tx/Rx interrupt handler
diff -r 10128d1b7784 -r 9ceea11b7c3f sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Thu Apr 19 07:36:23 2018 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Thu Apr 19 07:40:12 2018 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.94 2018/04/17 08:38:05 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.95 2018/04/19 07:40:12 msaitoh Exp $*/
 
 /******************************************************************************
 
@@ -117,7 +117,7 @@
 static void    ixv_set_ivar(struct adapter *, u8, u8, s8);
 static void    ixv_configure_ivars(struct adapter *);
 static u8 *    ixv_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *);
-static void    ixv_eitr_write(struct ix_queue *, uint32_t);
+static void    ixv_eitr_write(struct adapter *, uint32_t, uint32_t);
 
 static void    ixv_setup_vlan_support(struct adapter *);
 #if 0
@@ -802,7 +802,7 @@
        IXGBE_WRITE_REG(hw, IXGBE_VTEIAM, mask);
 
        /* Set moderation on the Link interrupt */
-       IXGBE_WRITE_REG(hw, IXGBE_VTEITR(adapter->vector), IXGBE_LINK_ITR);
+       ixv_eitr_write(adapter, adapter->vector, IXGBE_LINK_ITR);
 
        /* Stats init */
        ixv_init_stats(adapter);
@@ -916,7 +916,7 @@
         *    the last interval.
         */
        if (que->eitr_setting)
-               ixv_eitr_write(que, que->eitr_setting);
+               ixv_eitr_write(adapter, que->msix, que->eitr_setting);
 
        que->eitr_setting = 0;
 
@@ -991,9 +991,8 @@
 } /* ixv_msix_mbx */
 
 static void
-ixv_eitr_write(struct ix_queue *que, uint32_t itr)
+ixv_eitr_write(struct adapter *adapter, uint32_t index, uint32_t itr)
 {
-       struct adapter *adapter = que->adapter;
 
        /*
         * Newer devices than 82598 have VF function, so this function is
@@ -1001,7 +1000,7 @@
         */
        itr |= IXGBE_EITR_CNT_WDIS;
 
-       IXGBE_WRITE_REG(&adapter->hw, IXGBE_VTEITR(que->msix), itr);
+       IXGBE_WRITE_REG(&adapter->hw, IXGBE_VTEITR(index), itr);
 }
 
 
@@ -2132,7 +2131,7 @@
                /* ... and the TX */
                ixv_set_ivar(adapter, i, que->msix, 1);
                /* Set an initial value in EITR */
-               ixv_eitr_write(que, IXGBE_EITR_DEFAULT);
+               ixv_eitr_write(adapter, que->msix, IXGBE_EITR_DEFAULT);
        }
 
        /* For the mailbox interrupt */
@@ -2285,7 +2284,7 @@
                ixv_max_interrupt_rate = rate;
        } else
                ixv_max_interrupt_rate = 0;
-       ixv_eitr_write(que, reg);
+       ixv_eitr_write(adapter, que->msix, reg);
 
        return (0);
 } /* ixv_sysctl_interrupt_rate_handler */



Home | Main Index | Thread Index | Old Index