aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000/e1000.h3
-rw-r--r--drivers/net/e1000/e1000_ethtool.c51
2 files changed, 53 insertions, 1 deletions
diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index e9a416f40162..c87f2cbdbae3 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -111,6 +111,9 @@ do { \
111#define E1000_MIN_RXD 80 111#define E1000_MIN_RXD 80
112#define E1000_MAX_82544_RXD 4096 112#define E1000_MAX_82544_RXD 4096
113 113
114#define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
115#define E1000_MAX_ITR_USECS 10000 /* 100 irq/sec */
116
114/* this is the size past which hardware will drop packets when setting LPE=0 */ 117/* this is the size past which hardware will drop packets when setting LPE=0 */
115#define MAXIMUM_ETHERNET_VLAN_SIZE 1522 118#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
116 119
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index c854c96f5ab3..27f996a2010f 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -1904,6 +1904,53 @@ static int e1000_phys_id(struct net_device *netdev, u32 data)
1904 return 0; 1904 return 0;
1905} 1905}
1906 1906
1907static int e1000_get_coalesce(struct net_device *netdev,
1908 struct ethtool_coalesce *ec)
1909{
1910 struct e1000_adapter *adapter = netdev_priv(netdev);
1911
1912 if (adapter->hw.mac_type < e1000_82545)
1913 return -EOPNOTSUPP;
1914
1915 if (adapter->itr_setting <= 3)
1916 ec->rx_coalesce_usecs = adapter->itr_setting;
1917 else
1918 ec->rx_coalesce_usecs = 1000000 / adapter->itr_setting;
1919
1920 return 0;
1921}
1922
1923static int e1000_set_coalesce(struct net_device *netdev,
1924 struct ethtool_coalesce *ec)
1925{
1926 struct e1000_adapter *adapter = netdev_priv(netdev);
1927 struct e1000_hw *hw = &adapter->hw;
1928
1929 if (hw->mac_type < e1000_82545)
1930 return -EOPNOTSUPP;
1931
1932 if ((ec->rx_coalesce_usecs > E1000_MAX_ITR_USECS) ||
1933 ((ec->rx_coalesce_usecs > 3) &&
1934 (ec->rx_coalesce_usecs < E1000_MIN_ITR_USECS)) ||
1935 (ec->rx_coalesce_usecs == 2))
1936 return -EINVAL;
1937
1938 if (ec->rx_coalesce_usecs <= 3) {
1939 adapter->itr = 20000;
1940 adapter->itr_setting = ec->rx_coalesce_usecs;
1941 } else {
1942 adapter->itr = (1000000 / ec->rx_coalesce_usecs);
1943 adapter->itr_setting = adapter->itr & ~3;
1944 }
1945
1946 if (adapter->itr_setting != 0)
1947 ew32(ITR, 1000000000 / (adapter->itr * 256));
1948 else
1949 ew32(ITR, 0);
1950
1951 return 0;
1952}
1953
1907static int e1000_nway_reset(struct net_device *netdev) 1954static int e1000_nway_reset(struct net_device *netdev)
1908{ 1955{
1909 struct e1000_adapter *adapter = netdev_priv(netdev); 1956 struct e1000_adapter *adapter = netdev_priv(netdev);
@@ -1978,7 +2025,9 @@ static const struct ethtool_ops e1000_ethtool_ops = {
1978 .get_strings = e1000_get_strings, 2025 .get_strings = e1000_get_strings,
1979 .phys_id = e1000_phys_id, 2026 .phys_id = e1000_phys_id,
1980 .get_ethtool_stats = e1000_get_ethtool_stats, 2027 .get_ethtool_stats = e1000_get_ethtool_stats,
1981 .get_sset_count = e1000_get_sset_count, 2028 .get_sset_count = e1000_get_sset_count,
2029 .get_coalesce = e1000_get_coalesce,
2030 .set_coalesce = e1000_set_coalesce,
1982}; 2031};
1983 2032
1984void e1000_set_ethtool_ops(struct net_device *netdev) 2033void e1000_set_ethtool_ops(struct net_device *netdev)