aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb/ixgb_ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgb/ixgb_ethtool.c')
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 8464d8a013b0..7c9b35c677f0 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -95,7 +95,7 @@ ixgb_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
95 ecmd->port = PORT_FIBRE; 95 ecmd->port = PORT_FIBRE;
96 ecmd->transceiver = XCVR_EXTERNAL; 96 ecmd->transceiver = XCVR_EXTERNAL;
97 97
98 if(netif_carrier_ok(adapter->netdev)) { 98 if (netif_carrier_ok(adapter->netdev)) {
99 ecmd->speed = SPEED_10000; 99 ecmd->speed = SPEED_10000;
100 ecmd->duplex = DUPLEX_FULL; 100 ecmd->duplex = DUPLEX_FULL;
101 } else { 101 } else {
@@ -122,11 +122,11 @@ ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
122{ 122{
123 struct ixgb_adapter *adapter = netdev_priv(netdev); 123 struct ixgb_adapter *adapter = netdev_priv(netdev);
124 124
125 if(ecmd->autoneg == AUTONEG_ENABLE || 125 if (ecmd->autoneg == AUTONEG_ENABLE ||
126 ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL) 126 ecmd->speed + ecmd->duplex != SPEED_10000 + DUPLEX_FULL)
127 return -EINVAL; 127 return -EINVAL;
128 128
129 if(netif_running(adapter->netdev)) { 129 if (netif_running(adapter->netdev)) {
130 ixgb_down(adapter, true); 130 ixgb_down(adapter, true);
131 ixgb_reset(adapter); 131 ixgb_reset(adapter);
132 ixgb_up(adapter); 132 ixgb_up(adapter);
@@ -146,11 +146,11 @@ ixgb_get_pauseparam(struct net_device *netdev,
146 146
147 pause->autoneg = AUTONEG_DISABLE; 147 pause->autoneg = AUTONEG_DISABLE;
148 148
149 if(hw->fc.type == ixgb_fc_rx_pause) 149 if (hw->fc.type == ixgb_fc_rx_pause)
150 pause->rx_pause = 1; 150 pause->rx_pause = 1;
151 else if(hw->fc.type == ixgb_fc_tx_pause) 151 else if (hw->fc.type == ixgb_fc_tx_pause)
152 pause->tx_pause = 1; 152 pause->tx_pause = 1;
153 else if(hw->fc.type == ixgb_fc_full) { 153 else if (hw->fc.type == ixgb_fc_full) {
154 pause->rx_pause = 1; 154 pause->rx_pause = 1;
155 pause->tx_pause = 1; 155 pause->tx_pause = 1;
156 } 156 }
@@ -163,19 +163,19 @@ ixgb_set_pauseparam(struct net_device *netdev,
163 struct ixgb_adapter *adapter = netdev_priv(netdev); 163 struct ixgb_adapter *adapter = netdev_priv(netdev);
164 struct ixgb_hw *hw = &adapter->hw; 164 struct ixgb_hw *hw = &adapter->hw;
165 165
166 if(pause->autoneg == AUTONEG_ENABLE) 166 if (pause->autoneg == AUTONEG_ENABLE)
167 return -EINVAL; 167 return -EINVAL;
168 168
169 if(pause->rx_pause && pause->tx_pause) 169 if (pause->rx_pause && pause->tx_pause)
170 hw->fc.type = ixgb_fc_full; 170 hw->fc.type = ixgb_fc_full;
171 else if(pause->rx_pause && !pause->tx_pause) 171 else if (pause->rx_pause && !pause->tx_pause)
172 hw->fc.type = ixgb_fc_rx_pause; 172 hw->fc.type = ixgb_fc_rx_pause;
173 else if(!pause->rx_pause && pause->tx_pause) 173 else if (!pause->rx_pause && pause->tx_pause)
174 hw->fc.type = ixgb_fc_tx_pause; 174 hw->fc.type = ixgb_fc_tx_pause;
175 else if(!pause->rx_pause && !pause->tx_pause) 175 else if (!pause->rx_pause && !pause->tx_pause)
176 hw->fc.type = ixgb_fc_none; 176 hw->fc.type = ixgb_fc_none;
177 177
178 if(netif_running(adapter->netdev)) { 178 if (netif_running(adapter->netdev)) {
179 ixgb_down(adapter, true); 179 ixgb_down(adapter, true);
180 ixgb_up(adapter); 180 ixgb_up(adapter);
181 ixgb_set_speed_duplex(netdev); 181 ixgb_set_speed_duplex(netdev);
@@ -200,7 +200,7 @@ ixgb_set_rx_csum(struct net_device *netdev, u32 data)
200 200
201 adapter->rx_csum = data; 201 adapter->rx_csum = data;
202 202
203 if(netif_running(netdev)) { 203 if (netif_running(netdev)) {
204 ixgb_down(adapter, true); 204 ixgb_down(adapter, true);
205 ixgb_up(adapter); 205 ixgb_up(adapter);
206 ixgb_set_speed_duplex(netdev); 206 ixgb_set_speed_duplex(netdev);
@@ -229,7 +229,7 @@ ixgb_set_tx_csum(struct net_device *netdev, u32 data)
229static int 229static int
230ixgb_set_tso(struct net_device *netdev, u32 data) 230ixgb_set_tso(struct net_device *netdev, u32 data)
231{ 231{
232 if(data) 232 if (data)
233 netdev->features |= NETIF_F_TSO; 233 netdev->features |= NETIF_F_TSO;
234 else 234 else
235 netdev->features &= ~NETIF_F_TSO; 235 netdev->features &= ~NETIF_F_TSO;
@@ -415,7 +415,7 @@ ixgb_get_eeprom(struct net_device *netdev,
415 int i, max_len, first_word, last_word; 415 int i, max_len, first_word, last_word;
416 int ret_val = 0; 416 int ret_val = 0;
417 417
418 if(eeprom->len == 0) { 418 if (eeprom->len == 0) {
419 ret_val = -EINVAL; 419 ret_val = -EINVAL;
420 goto geeprom_error; 420 goto geeprom_error;
421 } 421 }
@@ -424,12 +424,12 @@ ixgb_get_eeprom(struct net_device *netdev,
424 424
425 max_len = ixgb_get_eeprom_len(netdev); 425 max_len = ixgb_get_eeprom_len(netdev);
426 426
427 if(eeprom->offset > eeprom->offset + eeprom->len) { 427 if (eeprom->offset > eeprom->offset + eeprom->len) {
428 ret_val = -EINVAL; 428 ret_val = -EINVAL;
429 goto geeprom_error; 429 goto geeprom_error;
430 } 430 }
431 431
432 if((eeprom->offset + eeprom->len) > max_len) 432 if ((eeprom->offset + eeprom->len) > max_len)
433 eeprom->len = (max_len - eeprom->offset); 433 eeprom->len = (max_len - eeprom->offset);
434 434
435 first_word = eeprom->offset >> 1; 435 first_word = eeprom->offset >> 1;
@@ -437,7 +437,7 @@ ixgb_get_eeprom(struct net_device *netdev,
437 437
438 eeprom_buff = kmalloc(sizeof(__le16) * 438 eeprom_buff = kmalloc(sizeof(__le16) *
439 (last_word - first_word + 1), GFP_KERNEL); 439 (last_word - first_word + 1), GFP_KERNEL);
440 if(!eeprom_buff) 440 if (!eeprom_buff)
441 return -ENOMEM; 441 return -ENOMEM;
442 442
443 /* note the eeprom was good because the driver loaded */ 443 /* note the eeprom was good because the driver loaded */
@@ -464,35 +464,35 @@ ixgb_set_eeprom(struct net_device *netdev,
464 int max_len, first_word, last_word; 464 int max_len, first_word, last_word;
465 u16 i; 465 u16 i;
466 466
467 if(eeprom->len == 0) 467 if (eeprom->len == 0)
468 return -EINVAL; 468 return -EINVAL;
469 469
470 if(eeprom->magic != (hw->vendor_id | (hw->device_id << 16))) 470 if (eeprom->magic != (hw->vendor_id | (hw->device_id << 16)))
471 return -EFAULT; 471 return -EFAULT;
472 472
473 max_len = ixgb_get_eeprom_len(netdev); 473 max_len = ixgb_get_eeprom_len(netdev);
474 474
475 if(eeprom->offset > eeprom->offset + eeprom->len) 475 if (eeprom->offset > eeprom->offset + eeprom->len)
476 return -EINVAL; 476 return -EINVAL;
477 477
478 if((eeprom->offset + eeprom->len) > max_len) 478 if ((eeprom->offset + eeprom->len) > max_len)
479 eeprom->len = (max_len - eeprom->offset); 479 eeprom->len = (max_len - eeprom->offset);
480 480
481 first_word = eeprom->offset >> 1; 481 first_word = eeprom->offset >> 1;
482 last_word = (eeprom->offset + eeprom->len - 1) >> 1; 482 last_word = (eeprom->offset + eeprom->len - 1) >> 1;
483 eeprom_buff = kmalloc(max_len, GFP_KERNEL); 483 eeprom_buff = kmalloc(max_len, GFP_KERNEL);
484 if(!eeprom_buff) 484 if (!eeprom_buff)
485 return -ENOMEM; 485 return -ENOMEM;
486 486
487 ptr = (void *)eeprom_buff; 487 ptr = (void *)eeprom_buff;
488 488
489 if(eeprom->offset & 1) { 489 if (eeprom->offset & 1) {
490 /* need read/modify/write of first changed EEPROM word */ 490 /* need read/modify/write of first changed EEPROM word */
491 /* only the second byte of the word is being modified */ 491 /* only the second byte of the word is being modified */
492 eeprom_buff[0] = ixgb_read_eeprom(hw, first_word); 492 eeprom_buff[0] = ixgb_read_eeprom(hw, first_word);
493 ptr++; 493 ptr++;
494 } 494 }
495 if((eeprom->offset + eeprom->len) & 1) { 495 if ((eeprom->offset + eeprom->len) & 1) {
496 /* need read/modify/write of last changed EEPROM word */ 496 /* need read/modify/write of last changed EEPROM word */
497 /* only the first byte of the word is being modified */ 497 /* only the first byte of the word is being modified */
498 eeprom_buff[last_word - first_word] 498 eeprom_buff[last_word - first_word]
@@ -504,7 +504,7 @@ ixgb_set_eeprom(struct net_device *netdev,
504 ixgb_write_eeprom(hw, first_word + i, eeprom_buff[i]); 504 ixgb_write_eeprom(hw, first_word + i, eeprom_buff[i]);
505 505
506 /* Update the checksum over the first part of the EEPROM if needed */ 506 /* Update the checksum over the first part of the EEPROM if needed */
507 if(first_word <= EEPROM_CHECKSUM_REG) 507 if (first_word <= EEPROM_CHECKSUM_REG)
508 ixgb_update_eeprom_checksum(hw); 508 ixgb_update_eeprom_checksum(hw);
509 509
510 kfree(eeprom_buff); 510 kfree(eeprom_buff);
@@ -557,10 +557,10 @@ ixgb_set_ringparam(struct net_device *netdev,
557 tx_old = adapter->tx_ring; 557 tx_old = adapter->tx_ring;
558 rx_old = adapter->rx_ring; 558 rx_old = adapter->rx_ring;
559 559
560 if((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 560 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
561 return -EINVAL; 561 return -EINVAL;
562 562
563 if(netif_running(adapter->netdev)) 563 if (netif_running(adapter->netdev))
564 ixgb_down(adapter, true); 564 ixgb_down(adapter, true);
565 565
566 rxdr->count = max(ring->rx_pending,(u32)MIN_RXD); 566 rxdr->count = max(ring->rx_pending,(u32)MIN_RXD);
@@ -571,11 +571,11 @@ ixgb_set_ringparam(struct net_device *netdev,
571 txdr->count = min(txdr->count,(u32)MAX_TXD); 571 txdr->count = min(txdr->count,(u32)MAX_TXD);
572 txdr->count = ALIGN(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 572 txdr->count = ALIGN(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
573 573
574 if(netif_running(adapter->netdev)) { 574 if (netif_running(adapter->netdev)) {
575 /* Try to get new resources before deleting old */ 575 /* Try to get new resources before deleting old */
576 if((err = ixgb_setup_rx_resources(adapter))) 576 if ((err = ixgb_setup_rx_resources(adapter)))
577 goto err_setup_rx; 577 goto err_setup_rx;
578 if((err = ixgb_setup_tx_resources(adapter))) 578 if ((err = ixgb_setup_tx_resources(adapter)))
579 goto err_setup_tx; 579 goto err_setup_tx;
580 580
581 /* save the new, restore the old in order to free it, 581 /* save the new, restore the old in order to free it,
@@ -589,7 +589,7 @@ ixgb_set_ringparam(struct net_device *netdev,
589 ixgb_free_tx_resources(adapter); 589 ixgb_free_tx_resources(adapter);
590 adapter->rx_ring = rx_new; 590 adapter->rx_ring = rx_new;
591 adapter->tx_ring = tx_new; 591 adapter->tx_ring = tx_new;
592 if((err = ixgb_up(adapter))) 592 if ((err = ixgb_up(adapter)))
593 return err; 593 return err;
594 ixgb_set_speed_duplex(netdev); 594 ixgb_set_speed_duplex(netdev);
595 } 595 }
@@ -615,7 +615,7 @@ ixgb_led_blink_callback(unsigned long data)
615{ 615{
616 struct ixgb_adapter *adapter = (struct ixgb_adapter *)data; 616 struct ixgb_adapter *adapter = (struct ixgb_adapter *)data;
617 617
618 if(test_and_change_bit(IXGB_LED_ON, &adapter->led_status)) 618 if (test_and_change_bit(IXGB_LED_ON, &adapter->led_status))
619 ixgb_led_off(&adapter->hw); 619 ixgb_led_off(&adapter->hw);
620 else 620 else
621 ixgb_led_on(&adapter->hw); 621 ixgb_led_on(&adapter->hw);
@@ -631,7 +631,7 @@ ixgb_phys_id(struct net_device *netdev, u32 data)
631 if (!data) 631 if (!data)
632 data = INT_MAX; 632 data = INT_MAX;
633 633
634 if(!adapter->blink_timer.function) { 634 if (!adapter->blink_timer.function) {
635 init_timer(&adapter->blink_timer); 635 init_timer(&adapter->blink_timer);
636 adapter->blink_timer.function = ixgb_led_blink_callback; 636 adapter->blink_timer.function = ixgb_led_blink_callback;
637 adapter->blink_timer.data = (unsigned long)adapter; 637 adapter->blink_timer.data = (unsigned long)adapter;