33 #include <asm/uaccess.h>
35 #define IXGB_ALL_RAR_ENTRIES 16
46 #define IXGB_STAT(m) IXGB_STATS, \
47 FIELD_SIZEOF(struct ixgb_adapter, m), \
48 offsetof(struct ixgb_adapter, m)
49 #define IXGB_NETDEV_STAT(m) NETDEV_STATS, \
50 FIELD_SIZEOF(struct net_device, m), \
51 offsetof(struct net_device, m)
53 static struct ixgb_stats ixgb_gstrings_stats[] = {
78 {
"tx_timeout_count",
IXGB_STAT(tx_timeout_count) },
79 {
"tx_restart_queue",
IXGB_STAT(restart_queue) },
88 {
"rx_csum_offload_good",
IXGB_STAT(hw_csum_rx_good)},
89 {
"rx_csum_offload_errors",
IXGB_STAT(hw_csum_rx_error)},
90 {
"tx_csum_offload_good",
IXGB_STAT(hw_csum_tx_good)},
91 {
"tx_csum_offload_errors",
IXGB_STAT(hw_csum_tx_error)}
94 #define IXGB_STATS_LEN ARRAY_SIZE(ixgb_gstrings_stats)
106 if (netif_carrier_ok(adapter->
netdev)) {
110 ethtool_cmd_speed_set(ecmd, -1);
125 netif_wake_queue(netdev);
132 u32 speed = ethtool_cmd_speed(ecmd);
138 if (netif_running(adapter->
netdev)) {
150 ixgb_get_pauseparam(
struct net_device *netdev,
169 ixgb_set_pauseparam(
struct net_device *netdev,
187 if (netif_running(adapter->
netdev)) {
210 #define IXGB_GET_STAT(_A_, _R_) _A_->stats._R_
215 #define IXGB_REG_DUMP_LEN 136*sizeof(u32)
356 regs->
len = (reg - reg_start) *
sizeof(
u32);
360 ixgb_get_eeprom_len(
struct net_device *netdev)
373 int i, max_len, first_word, last_word;
376 if (eeprom->
len == 0) {
383 max_len = ixgb_get_eeprom_len(netdev);
390 if ((eeprom->
offset + eeprom->
len) > max_len)
391 eeprom->
len = (max_len - eeprom->
offset);
393 first_word = eeprom->
offset >> 1;
394 last_word = (eeprom->
offset + eeprom->
len - 1) >> 1;
402 for (i = 0; i <= (last_word - first_word); i++)
420 int max_len, first_word, last_word;
423 if (eeprom->
len == 0)
429 max_len = ixgb_get_eeprom_len(netdev);
434 if ((eeprom->
offset + eeprom->
len) > max_len)
435 eeprom->
len = (max_len - eeprom->
offset);
437 first_word = eeprom->
offset >> 1;
438 last_word = (eeprom->
offset + eeprom->
len - 1) >> 1;
443 ptr = (
void *)eeprom_buff;
451 if ((eeprom->
offset + eeprom->
len) & 1) {
454 eeprom_buff[last_word - first_word]
459 for (i = 0; i <= (last_word - first_word); i++)
484 drvinfo->
eedump_len = ixgb_get_eeprom_len(netdev);
511 tx_old = adapter->tx_ring;
517 if (netif_running(adapter->
netdev))
528 if (netif_running(adapter->
netdev)) {
539 tx_new = adapter->tx_ring;
541 adapter->tx_ring = tx_old;
545 adapter->tx_ring = tx_new;
556 adapter->tx_ring = tx_old;
583 ixgb_get_sset_count(
struct net_device *netdev,
int sset)
594 ixgb_get_ethtool_stats(
struct net_device *netdev,
603 switch (ixgb_gstrings_stats[i].
type) {
605 p = (
char *) netdev +
606 ixgb_gstrings_stats[i].stat_offset;
609 p = (
char *) adapter +
610 ixgb_gstrings_stats[i].stat_offset;
628 ixgb_gstrings_stats[i].stat_string,
635 static const struct ethtool_ops ixgb_ethtool_ops = {
636 .get_settings = ixgb_get_settings,
637 .set_settings = ixgb_set_settings,
638 .get_drvinfo = ixgb_get_drvinfo,
639 .get_regs_len = ixgb_get_regs_len,
640 .get_regs = ixgb_get_regs,
642 .get_eeprom_len = ixgb_get_eeprom_len,
643 .get_eeprom = ixgb_get_eeprom,
644 .set_eeprom = ixgb_set_eeprom,
645 .get_ringparam = ixgb_get_ringparam,
646 .set_ringparam = ixgb_set_ringparam,
647 .get_pauseparam = ixgb_get_pauseparam,
648 .set_pauseparam = ixgb_set_pauseparam,
649 .get_msglevel = ixgb_get_msglevel,
650 .set_msglevel = ixgb_set_msglevel,
651 .get_strings = ixgb_get_strings,
652 .set_phys_id = ixgb_set_phys_id,
653 .get_sset_count = ixgb_get_sset_count,
654 .get_ethtool_stats = ixgb_get_ethtool_stats,