aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2009-10-27 19:45:42 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-28 06:25:31 -0400
commit4fc82adfb01bdee79ec21e44557dc409ef31419a (patch)
treeca9dbca3e71231e7a875ada6000660ec1c65c05f
parent9c1bbbaf3eef357b15c0e94085d96f18c6f1bde6 (diff)
igb: add support for seperate tx-usecs setting in ethtool
This patch adds support for a seperate tx-usecs interrupt moderation setting in ethtool which is supported when tx and rx interrupt vectors are sperated. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/igb/igb.h5
-rw-r--r--drivers/net/igb/igb_ethtool.c49
-rw-r--r--drivers/net/igb/igb_main.c22
3 files changed, 54 insertions, 22 deletions
diff --git a/drivers/net/igb/igb.h b/drivers/net/igb/igb.h
index 6c35c9029a50..bef8cdc1c225 100644
--- a/drivers/net/igb/igb.h
+++ b/drivers/net/igb/igb.h
@@ -249,8 +249,8 @@ struct igb_adapter {
249 unsigned int total_rx_bytes; 249 unsigned int total_rx_bytes;
250 unsigned int total_rx_packets; 250 unsigned int total_rx_packets;
251 /* Interrupt Throttle Rate */ 251 /* Interrupt Throttle Rate */
252 u32 itr; 252 u32 rx_itr_setting;
253 u32 itr_setting; 253 u32 tx_itr_setting;
254 u16 tx_itr; 254 u16 tx_itr;
255 u16 rx_itr; 255 u16 rx_itr;
256 256
@@ -321,6 +321,7 @@ struct igb_adapter {
321#define IGB_FLAG_HAS_MSI (1 << 0) 321#define IGB_FLAG_HAS_MSI (1 << 0)
322#define IGB_FLAG_DCA_ENABLED (1 << 1) 322#define IGB_FLAG_DCA_ENABLED (1 << 1)
323#define IGB_FLAG_QUAD_PORT_A (1 << 2) 323#define IGB_FLAG_QUAD_PORT_A (1 << 2)
324#define IGB_FLAG_QUEUE_PAIRS (1 << 3)
324 325
325enum e1000_state_t { 326enum e1000_state_t {
326 __IGB_TESTING, 327 __IGB_TESTING,
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 048a61578964..84fe25ad1b7c 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -1827,18 +1827,37 @@ static int igb_set_coalesce(struct net_device *netdev,
1827 (ec->rx_coalesce_usecs == 2)) 1827 (ec->rx_coalesce_usecs == 2))
1828 return -EINVAL; 1828 return -EINVAL;
1829 1829
1830 if ((ec->tx_coalesce_usecs > IGB_MAX_ITR_USECS) ||
1831 ((ec->tx_coalesce_usecs > 3) &&
1832 (ec->tx_coalesce_usecs < IGB_MIN_ITR_USECS)) ||
1833 (ec->tx_coalesce_usecs == 2))
1834 return -EINVAL;
1835
1836 if ((adapter->flags & IGB_FLAG_QUEUE_PAIRS) && ec->tx_coalesce_usecs)
1837 return -EINVAL;
1838
1830 /* convert to rate of irq's per second */ 1839 /* convert to rate of irq's per second */
1831 if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) { 1840 if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3)
1832 adapter->itr_setting = ec->rx_coalesce_usecs; 1841 adapter->rx_itr_setting = ec->rx_coalesce_usecs;
1833 adapter->itr = IGB_START_ITR; 1842 else
1834 } else { 1843 adapter->rx_itr_setting = ec->rx_coalesce_usecs << 2;
1835 adapter->itr_setting = ec->rx_coalesce_usecs << 2; 1844
1836 adapter->itr = adapter->itr_setting; 1845 /* convert to rate of irq's per second */
1837 } 1846 if (adapter->flags & IGB_FLAG_QUEUE_PAIRS)
1847 adapter->tx_itr_setting = adapter->rx_itr_setting;
1848 else if (ec->tx_coalesce_usecs && ec->tx_coalesce_usecs <= 3)
1849 adapter->tx_itr_setting = ec->tx_coalesce_usecs;
1850 else
1851 adapter->tx_itr_setting = ec->tx_coalesce_usecs << 2;
1838 1852
1839 for (i = 0; i < adapter->num_q_vectors; i++) { 1853 for (i = 0; i < adapter->num_q_vectors; i++) {
1840 struct igb_q_vector *q_vector = adapter->q_vector[i]; 1854 struct igb_q_vector *q_vector = adapter->q_vector[i];
1841 q_vector->itr_val = adapter->itr; 1855 if (q_vector->rx_ring)
1856 q_vector->itr_val = adapter->rx_itr_setting;
1857 else
1858 q_vector->itr_val = adapter->tx_itr_setting;
1859 if (q_vector->itr_val && q_vector->itr_val <= 3)
1860 q_vector->itr_val = IGB_START_ITR;
1842 q_vector->set_itr = 1; 1861 q_vector->set_itr = 1;
1843 } 1862 }
1844 1863
@@ -1850,15 +1869,21 @@ static int igb_get_coalesce(struct net_device *netdev,
1850{ 1869{
1851 struct igb_adapter *adapter = netdev_priv(netdev); 1870 struct igb_adapter *adapter = netdev_priv(netdev);
1852 1871
1853 if (adapter->itr_setting <= 3) 1872 if (adapter->rx_itr_setting <= 3)
1854 ec->rx_coalesce_usecs = adapter->itr_setting; 1873 ec->rx_coalesce_usecs = adapter->rx_itr_setting;
1855 else 1874 else
1856 ec->rx_coalesce_usecs = adapter->itr_setting >> 2; 1875 ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2;
1876
1877 if (!(adapter->flags & IGB_FLAG_QUEUE_PAIRS)) {
1878 if (adapter->tx_itr_setting <= 3)
1879 ec->tx_coalesce_usecs = adapter->tx_itr_setting;
1880 else
1881 ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2;
1882 }
1857 1883
1858 return 0; 1884 return 0;
1859} 1885}
1860 1886
1861
1862static int igb_nway_reset(struct net_device *netdev) 1887static int igb_nway_reset(struct net_device *netdev)
1863{ 1888{
1864 struct igb_adapter *adapter = netdev_priv(netdev); 1889 struct igb_adapter *adapter = netdev_priv(netdev);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index c9fda113abe6..5724ac8c1ca9 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -734,6 +734,8 @@ msi_only:
734 dev_info(&adapter->pdev->dev, "IOV Disabled\n"); 734 dev_info(&adapter->pdev->dev, "IOV Disabled\n");
735 } 735 }
736#endif 736#endif
737 adapter->vfs_allocated_count = 0;
738 adapter->flags |= IGB_FLAG_QUEUE_PAIRS;
737 adapter->num_rx_queues = 1; 739 adapter->num_rx_queues = 1;
738 adapter->num_tx_queues = 1; 740 adapter->num_tx_queues = 1;
739 adapter->num_q_vectors = 1; 741 adapter->num_q_vectors = 1;
@@ -791,7 +793,9 @@ static void igb_map_rx_ring_to_vector(struct igb_adapter *adapter,
791 q_vector = adapter->q_vector[v_idx]; 793 q_vector = adapter->q_vector[v_idx];
792 q_vector->rx_ring = &adapter->rx_ring[ring_idx]; 794 q_vector->rx_ring = &adapter->rx_ring[ring_idx];
793 q_vector->rx_ring->q_vector = q_vector; 795 q_vector->rx_ring->q_vector = q_vector;
794 q_vector->itr_val = adapter->itr; 796 q_vector->itr_val = adapter->rx_itr_setting;
797 if (q_vector->itr_val && q_vector->itr_val <= 3)
798 q_vector->itr_val = IGB_START_ITR;
795} 799}
796 800
797static void igb_map_tx_ring_to_vector(struct igb_adapter *adapter, 801static void igb_map_tx_ring_to_vector(struct igb_adapter *adapter,
@@ -802,7 +806,9 @@ static void igb_map_tx_ring_to_vector(struct igb_adapter *adapter,
802 q_vector = adapter->q_vector[v_idx]; 806 q_vector = adapter->q_vector[v_idx];
803 q_vector->tx_ring = &adapter->tx_ring[ring_idx]; 807 q_vector->tx_ring = &adapter->tx_ring[ring_idx];
804 q_vector->tx_ring->q_vector = q_vector; 808 q_vector->tx_ring->q_vector = q_vector;
805 q_vector->itr_val = adapter->itr; 809 q_vector->itr_val = adapter->tx_itr_setting;
810 if (q_vector->itr_val && q_vector->itr_val <= 3)
811 q_vector->itr_val = IGB_START_ITR;
806} 812}
807 813
808/** 814/**
@@ -1597,9 +1603,6 @@ static int __devinit igb_probe(struct pci_dev *pdev,
1597 hw->fc.requested_mode = e1000_fc_default; 1603 hw->fc.requested_mode = e1000_fc_default;
1598 hw->fc.current_mode = e1000_fc_default; 1604 hw->fc.current_mode = e1000_fc_default;
1599 1605
1600 adapter->itr_setting = IGB_DEFAULT_ITR;
1601 adapter->itr = IGB_START_ITR;
1602
1603 igb_validate_mdi_setting(hw); 1606 igb_validate_mdi_setting(hw);
1604 1607
1605 /* Initial Wake on LAN setting If APM wake is enabled in the EEPROM, 1608 /* Initial Wake on LAN setting If APM wake is enabled in the EEPROM,
@@ -1854,6 +1857,9 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
1854 1857
1855 adapter->tx_ring_count = IGB_DEFAULT_TXD; 1858 adapter->tx_ring_count = IGB_DEFAULT_TXD;
1856 adapter->rx_ring_count = IGB_DEFAULT_RXD; 1859 adapter->rx_ring_count = IGB_DEFAULT_RXD;
1860 adapter->rx_itr_setting = IGB_DEFAULT_ITR;
1861 adapter->tx_itr_setting = IGB_DEFAULT_ITR;
1862
1857 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; 1863 adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
1858 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; 1864 adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
1859 1865
@@ -3052,7 +3058,6 @@ enum latency_range {
3052 latency_invalid = 255 3058 latency_invalid = 255
3053}; 3059};
3054 3060
3055
3056/** 3061/**
3057 * igb_update_ring_itr - update the dynamic ITR value based on packet size 3062 * igb_update_ring_itr - update the dynamic ITR value based on packet size
3058 * 3063 *
@@ -3216,7 +3221,7 @@ static void igb_set_itr(struct igb_adapter *adapter)
3216 current_itr = max(adapter->rx_itr, adapter->tx_itr); 3221 current_itr = max(adapter->rx_itr, adapter->tx_itr);
3217 3222
3218 /* conservative mode (itr 3) eliminates the lowest_latency setting */ 3223 /* conservative mode (itr 3) eliminates the lowest_latency setting */
3219 if (adapter->itr_setting == 3 && current_itr == lowest_latency) 3224 if (adapter->rx_itr_setting == 3 && current_itr == lowest_latency)
3220 current_itr = low_latency; 3225 current_itr = low_latency;
3221 3226
3222 switch (current_itr) { 3227 switch (current_itr) {
@@ -4577,7 +4582,8 @@ static inline void igb_ring_irq_enable(struct igb_q_vector *q_vector)
4577 struct igb_adapter *adapter = q_vector->adapter; 4582 struct igb_adapter *adapter = q_vector->adapter;
4578 struct e1000_hw *hw = &adapter->hw; 4583 struct e1000_hw *hw = &adapter->hw;
4579 4584
4580 if (adapter->itr_setting & 3) { 4585 if ((q_vector->rx_ring && (adapter->rx_itr_setting & 3)) ||
4586 (!q_vector->rx_ring && (adapter->tx_itr_setting & 3))) {
4581 if (!adapter->msix_entries) 4587 if (!adapter->msix_entries)
4582 igb_set_itr(adapter); 4588 igb_set_itr(adapter);
4583 else 4589 else