aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
authorJesse Brandeburg <jesse.brandeburg@intel.com>2009-03-13 18:13:28 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-14 15:41:08 -0400
commit509ee935ec0828e534e4d48d08d4d0b4bc17ea92 (patch)
treed50803203ef9ec0e528f37546d2e9d3488747c43 /drivers/net/ixgbe/ixgbe_main.c
parent40dcd79a7bd2e0d6bf4680db4bc0268c9f149a1d (diff)
ixgbe: Fix interrupt configuration for 82599
The interrupt models using EITR have changed in 82599. The way the register is laid out, the change is transparent to some of the existing code. However, some of it isn't. This patch fixes all the cases where EITR handling is different than 82598. Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c64
1 files changed, 43 insertions, 21 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 881bbf97ff0c..76fd5c6db02b 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -808,10 +808,14 @@ static void ixgbe_configure_msix(struct ixgbe_adapter *adapter)
808 /* if this is a tx only vector halve the interrupt rate */ 808 /* if this is a tx only vector halve the interrupt rate */
809 if (q_vector->txr_count && !q_vector->rxr_count) 809 if (q_vector->txr_count && !q_vector->rxr_count)
810 q_vector->eitr = (adapter->eitr_param >> 1); 810 q_vector->eitr = (adapter->eitr_param >> 1);
811 else 811 else if (q_vector->rxr_count)
812 /* rx only */ 812 /* rx only */
813 q_vector->eitr = adapter->eitr_param; 813 q_vector->eitr = adapter->eitr_param;
814 814
815 /*
816 * since ths is initial set up don't need to call
817 * ixgbe_write_eitr helper
818 */
815 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(v_idx), 819 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(v_idx),
816 EITR_INTS_PER_SEC_TO_REG(q_vector->eitr)); 820 EITR_INTS_PER_SEC_TO_REG(q_vector->eitr));
817 } 821 }
@@ -896,10 +900,35 @@ update_itr_done:
896 return retval; 900 return retval;
897} 901}
898 902
903/**
904 * ixgbe_write_eitr - write EITR register in hardware specific way
905 * @adapter: pointer to adapter struct
906 * @v_idx: vector index into q_vector array
907 * @itr_reg: new value to be written in *register* format, not ints/s
908 *
909 * This function is made to be called by ethtool and by the driver
910 * when it needs to update EITR registers at runtime. Hardware
911 * specific quirks/differences are taken care of here.
912 */
913void ixgbe_write_eitr(struct ixgbe_adapter *adapter, int v_idx, u32 itr_reg)
914{
915 struct ixgbe_hw *hw = &adapter->hw;
916 if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
917 /* must write high and low 16 bits to reset counter */
918 itr_reg |= (itr_reg << 16);
919 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
920 /*
921 * set the WDIS bit to not clear the timer bits and cause an
922 * immediate assertion of the interrupt
923 */
924 itr_reg |= IXGBE_EITR_CNT_WDIS;
925 }
926 IXGBE_WRITE_REG(hw, IXGBE_EITR(v_idx), itr_reg);
927}
928
899static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector) 929static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector)
900{ 930{
901 struct ixgbe_adapter *adapter = q_vector->adapter; 931 struct ixgbe_adapter *adapter = q_vector->adapter;
902 struct ixgbe_hw *hw = &adapter->hw;
903 u32 new_itr; 932 u32 new_itr;
904 u8 current_itr, ret_itr; 933 u8 current_itr, ret_itr;
905 int i, r_idx, v_idx = ((void *)q_vector - (void *)(adapter->q_vector)) / 934 int i, r_idx, v_idx = ((void *)q_vector - (void *)(adapter->q_vector)) /
@@ -954,17 +983,13 @@ static void ixgbe_set_itr_msix(struct ixgbe_q_vector *q_vector)
954 983
955 if (new_itr != q_vector->eitr) { 984 if (new_itr != q_vector->eitr) {
956 u32 itr_reg; 985 u32 itr_reg;
986
987 /* save the algorithm value here, not the smoothed one */
988 q_vector->eitr = new_itr;
957 /* do an exponential smoothing */ 989 /* do an exponential smoothing */
958 new_itr = ((q_vector->eitr * 90)/100) + ((new_itr * 10)/100); 990 new_itr = ((q_vector->eitr * 90)/100) + ((new_itr * 10)/100);
959 q_vector->eitr = new_itr;
960 itr_reg = EITR_INTS_PER_SEC_TO_REG(new_itr); 991 itr_reg = EITR_INTS_PER_SEC_TO_REG(new_itr);
961 if (adapter->hw.mac.type == ixgbe_mac_82599EB) 992 ixgbe_write_eitr(adapter, v_idx, itr_reg);
962 /* Resolution is 2 usec on 82599, so halve the rate */
963 itr_reg >>= 1;
964 /* must write high and low 16 bits to reset counter */
965 DPRINTK(TX_ERR, DEBUG, "writing eitr(%d): %08X\n", v_idx,
966 itr_reg);
967 IXGBE_WRITE_REG(hw, IXGBE_EITR(v_idx), itr_reg | (itr_reg)<<16);
968 } 993 }
969 994
970 return; 995 return;
@@ -1141,7 +1166,7 @@ static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget)
1141 /* If all Rx work done, exit the polling mode */ 1166 /* If all Rx work done, exit the polling mode */
1142 if (work_done < budget) { 1167 if (work_done < budget) {
1143 napi_complete(napi); 1168 napi_complete(napi);
1144 if (adapter->itr_setting & 3) 1169 if (adapter->itr_setting & 1)
1145 ixgbe_set_itr_msix(q_vector); 1170 ixgbe_set_itr_msix(q_vector);
1146 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 1171 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1147 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rx_ring->v_idx); 1172 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rx_ring->v_idx);
@@ -1190,7 +1215,7 @@ static int ixgbe_clean_rxonly_many(struct napi_struct *napi, int budget)
1190 /* If all Rx work done, exit the polling mode */ 1215 /* If all Rx work done, exit the polling mode */
1191 if (work_done < budget) { 1216 if (work_done < budget) {
1192 napi_complete(napi); 1217 napi_complete(napi);
1193 if (adapter->itr_setting & 3) 1218 if (adapter->itr_setting & 1)
1194 ixgbe_set_itr_msix(q_vector); 1219 ixgbe_set_itr_msix(q_vector);
1195 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 1220 if (!test_bit(__IXGBE_DOWN, &adapter->state))
1196 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, enable_mask); 1221 IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, enable_mask);
@@ -1360,7 +1385,6 @@ out:
1360 1385
1361static void ixgbe_set_itr(struct ixgbe_adapter *adapter) 1386static void ixgbe_set_itr(struct ixgbe_adapter *adapter)
1362{ 1387{
1363 struct ixgbe_hw *hw = &adapter->hw;
1364 struct ixgbe_q_vector *q_vector = adapter->q_vector; 1388 struct ixgbe_q_vector *q_vector = adapter->q_vector;
1365 u8 current_itr; 1389 u8 current_itr;
1366 u32 new_itr = q_vector->eitr; 1390 u32 new_itr = q_vector->eitr;
@@ -1395,15 +1419,13 @@ static void ixgbe_set_itr(struct ixgbe_adapter *adapter)
1395 1419
1396 if (new_itr != q_vector->eitr) { 1420 if (new_itr != q_vector->eitr) {
1397 u32 itr_reg; 1421 u32 itr_reg;
1422
1423 /* save the algorithm value here, not the smoothed one */
1424 q_vector->eitr = new_itr;
1398 /* do an exponential smoothing */ 1425 /* do an exponential smoothing */
1399 new_itr = ((q_vector->eitr * 90)/100) + ((new_itr * 10)/100); 1426 new_itr = ((q_vector->eitr * 90)/100) + ((new_itr * 10)/100);
1400 q_vector->eitr = new_itr;
1401 itr_reg = EITR_INTS_PER_SEC_TO_REG(new_itr); 1427 itr_reg = EITR_INTS_PER_SEC_TO_REG(new_itr);
1402 if (adapter->hw.mac.type == ixgbe_mac_82599EB) 1428 ixgbe_write_eitr(adapter, 0, itr_reg);
1403 /* Resolution is 2 usec on 82599, so halve the rate */
1404 itr_reg >>= 1;
1405 /* must write high and low 16 bits to reset counter */
1406 IXGBE_WRITE_REG(hw, IXGBE_EITR(0), itr_reg | (itr_reg)<<16);
1407 } 1429 }
1408 1430
1409 return; 1431 return;
@@ -1701,7 +1723,7 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
1701 0xA54F2BEC, 0xEA49AF7C, 0xE214AD3D, 0xB855AABE, 1723 0xA54F2BEC, 0xEA49AF7C, 0xE214AD3D, 0xB855AABE,
1702 0x6A3E67EA, 0x14364D17, 0x3BED200D}; 1724 0x6A3E67EA, 0x14364D17, 0x3BED200D};
1703 u32 fctrl, hlreg0; 1725 u32 fctrl, hlreg0;
1704 u32 reta = 0, mrqc; 1726 u32 reta = 0, mrqc = 0;
1705 u32 rdrxctl; 1727 u32 rdrxctl;
1706 int rx_buf_len; 1728 int rx_buf_len;
1707 1729
@@ -2589,7 +2611,7 @@ static int ixgbe_poll(struct napi_struct *napi, int budget)
2589 /* If budget not fully consumed, exit the polling mode */ 2611 /* If budget not fully consumed, exit the polling mode */
2590 if (work_done < budget) { 2612 if (work_done < budget) {
2591 napi_complete(napi); 2613 napi_complete(napi);
2592 if (adapter->itr_setting & 3) 2614 if (adapter->itr_setting & 1)
2593 ixgbe_set_itr(adapter); 2615 ixgbe_set_itr(adapter);
2594 if (!test_bit(__IXGBE_DOWN, &adapter->state)) 2616 if (!test_bit(__IXGBE_DOWN, &adapter->state))
2595 ixgbe_irq_enable(adapter); 2617 ixgbe_irq_enable(adapter);