Module Name:    src
Committed By:   msaitoh
Date:           Thu Apr 19 07:40:12 UTC 2018

Modified Files:
        src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
 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().


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/ixgbe/ixv.c

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.148 src/sys/dev/pci/ixgbe/ixgbe.c:1.149
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.148	Tue Apr 17 08:38:05 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Apr 19 07:40:12 2018
@@ -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_update_link_status
 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 @@ ixgbe_msix_que(void *arg)
 	 *    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(void *arg)
 } /* 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_sysctl_interrupt_rate_handler(SYSC
 		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 @@ ixgbe_init_locked(struct adapter *adapte
 	}
 
 	/* 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 @@ ixgbe_configure_ivars(struct adapter *ad
 		/* ... 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

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.94 src/sys/dev/pci/ixgbe/ixv.c:1.95
--- src/sys/dev/pci/ixgbe/ixv.c:1.94	Tue Apr 17 08:38:05 2018
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Apr 19 07:40:12 2018
@@ -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 int	ixv_sysctl_debug(SYSCTLFN_PRO
 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 @@ ixv_init_locked(struct adapter *adapter)
 	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 @@ ixv_msix_que(void *arg)
 	 *    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(void *arg)
 } /* 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 @@ ixv_eitr_write(struct ix_queue *que, uin
 	 */
 	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 @@ ixv_configure_ivars(struct adapter *adap
 		/* ... 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_sysctl_interrupt_rate_handler(SYSCTL
 		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 */

Reply via email to