aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/igb/igb_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/igb/igb_ethtool.c')
-rw-r--r--drivers/net/igb/igb_ethtool.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
index 27eae49e79c2..9598ac09f4b8 100644
--- a/drivers/net/igb/igb_ethtool.c
+++ b/drivers/net/igb/igb_ethtool.c
@@ -64,6 +64,7 @@ static const struct igb_stats igb_gstrings_stats[] = {
64 { "rx_crc_errors", IGB_STAT(stats.crcerrs) }, 64 { "rx_crc_errors", IGB_STAT(stats.crcerrs) },
65 { "rx_frame_errors", IGB_STAT(net_stats.rx_frame_errors) }, 65 { "rx_frame_errors", IGB_STAT(net_stats.rx_frame_errors) },
66 { "rx_no_buffer_count", IGB_STAT(stats.rnbc) }, 66 { "rx_no_buffer_count", IGB_STAT(stats.rnbc) },
67 { "rx_queue_drop_packet_count", IGB_STAT(net_stats.rx_fifo_errors) },
67 { "rx_missed_errors", IGB_STAT(stats.mpc) }, 68 { "rx_missed_errors", IGB_STAT(stats.mpc) },
68 { "tx_aborted_errors", IGB_STAT(stats.ecol) }, 69 { "tx_aborted_errors", IGB_STAT(stats.ecol) },
69 { "tx_carrier_errors", IGB_STAT(stats.tncrs) }, 70 { "tx_carrier_errors", IGB_STAT(stats.tncrs) },
@@ -96,9 +97,10 @@ static const struct igb_stats igb_gstrings_stats[] = {
96}; 97};
97 98
98#define IGB_QUEUE_STATS_LEN \ 99#define IGB_QUEUE_STATS_LEN \
99 ((((struct igb_adapter *)netdev_priv(netdev))->num_rx_queues + \ 100 (((((struct igb_adapter *)netdev_priv(netdev))->num_rx_queues)* \
100 ((struct igb_adapter *)netdev_priv(netdev))->num_tx_queues) * \ 101 (sizeof(struct igb_rx_queue_stats) / sizeof(u64))) + \
101 (sizeof(struct igb_queue_stats) / sizeof(u64))) 102 ((((struct igb_adapter *)netdev_priv(netdev))->num_tx_queues) * \
103 (sizeof(struct igb_tx_queue_stats) / sizeof(u64))))
102#define IGB_GLOBAL_STATS_LEN \ 104#define IGB_GLOBAL_STATS_LEN \
103 sizeof(igb_gstrings_stats) / sizeof(struct igb_stats) 105 sizeof(igb_gstrings_stats) / sizeof(struct igb_stats)
104#define IGB_STATS_LEN (IGB_GLOBAL_STATS_LEN + IGB_QUEUE_STATS_LEN) 106#define IGB_STATS_LEN (IGB_GLOBAL_STATS_LEN + IGB_QUEUE_STATS_LEN)
@@ -275,13 +277,17 @@ static int igb_set_pauseparam(struct net_device *netdev,
275static u32 igb_get_rx_csum(struct net_device *netdev) 277static u32 igb_get_rx_csum(struct net_device *netdev)
276{ 278{
277 struct igb_adapter *adapter = netdev_priv(netdev); 279 struct igb_adapter *adapter = netdev_priv(netdev);
278 return adapter->rx_csum; 280 return !(adapter->flags & IGB_FLAG_RX_CSUM_DISABLED);
279} 281}
280 282
281static int igb_set_rx_csum(struct net_device *netdev, u32 data) 283static int igb_set_rx_csum(struct net_device *netdev, u32 data)
282{ 284{
283 struct igb_adapter *adapter = netdev_priv(netdev); 285 struct igb_adapter *adapter = netdev_priv(netdev);
284 adapter->rx_csum = data; 286
287 if (data)
288 adapter->flags &= ~IGB_FLAG_RX_CSUM_DISABLED;
289 else
290 adapter->flags |= IGB_FLAG_RX_CSUM_DISABLED;
285 291
286 return 0; 292 return 0;
287} 293}
@@ -293,10 +299,16 @@ static u32 igb_get_tx_csum(struct net_device *netdev)
293 299
294static int igb_set_tx_csum(struct net_device *netdev, u32 data) 300static int igb_set_tx_csum(struct net_device *netdev, u32 data)
295{ 301{
296 if (data) 302 struct igb_adapter *adapter = netdev_priv(netdev);
303
304 if (data) {
297 netdev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); 305 netdev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
298 else 306 if (adapter->hw.mac.type == e1000_82576)
299 netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM); 307 netdev->features |= NETIF_F_SCTP_CSUM;
308 } else {
309 netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
310 NETIF_F_SCTP_CSUM);
311 }
300 312
301 return 0; 313 return 0;
302} 314}
@@ -1950,7 +1962,8 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
1950{ 1962{
1951 struct igb_adapter *adapter = netdev_priv(netdev); 1963 struct igb_adapter *adapter = netdev_priv(netdev);
1952 u64 *queue_stat; 1964 u64 *queue_stat;
1953 int stat_count = sizeof(struct igb_queue_stats) / sizeof(u64); 1965 int stat_count_tx = sizeof(struct igb_tx_queue_stats) / sizeof(u64);
1966 int stat_count_rx = sizeof(struct igb_rx_queue_stats) / sizeof(u64);
1954 int j; 1967 int j;
1955 int i; 1968 int i;
1956 1969
@@ -1963,14 +1976,14 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
1963 for (j = 0; j < adapter->num_tx_queues; j++) { 1976 for (j = 0; j < adapter->num_tx_queues; j++) {
1964 int k; 1977 int k;
1965 queue_stat = (u64 *)&adapter->tx_ring[j].tx_stats; 1978 queue_stat = (u64 *)&adapter->tx_ring[j].tx_stats;
1966 for (k = 0; k < stat_count; k++) 1979 for (k = 0; k < stat_count_tx; k++)
1967 data[i + k] = queue_stat[k]; 1980 data[i + k] = queue_stat[k];
1968 i += k; 1981 i += k;
1969 } 1982 }
1970 for (j = 0; j < adapter->num_rx_queues; j++) { 1983 for (j = 0; j < adapter->num_rx_queues; j++) {
1971 int k; 1984 int k;
1972 queue_stat = (u64 *)&adapter->rx_ring[j].rx_stats; 1985 queue_stat = (u64 *)&adapter->rx_ring[j].rx_stats;
1973 for (k = 0; k < stat_count; k++) 1986 for (k = 0; k < stat_count_rx; k++)
1974 data[i + k] = queue_stat[k]; 1987 data[i + k] = queue_stat[k];
1975 i += k; 1988 i += k;
1976 } 1989 }
@@ -2004,6 +2017,8 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
2004 p += ETH_GSTRING_LEN; 2017 p += ETH_GSTRING_LEN;
2005 sprintf(p, "rx_queue_%u_bytes", i); 2018 sprintf(p, "rx_queue_%u_bytes", i);
2006 p += ETH_GSTRING_LEN; 2019 p += ETH_GSTRING_LEN;
2020 sprintf(p, "rx_queue_%u_drops", i);
2021 p += ETH_GSTRING_LEN;
2007 } 2022 }
2008/* BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */ 2023/* BUG_ON(p - data != IGB_STATS_LEN * ETH_GSTRING_LEN); */
2009 break; 2024 break;