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.c67
1 files changed, 29 insertions, 38 deletions
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 75f3a68ee354..8464d8a013b0 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -32,15 +32,6 @@
32 32
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34 34
35extern int ixgb_up(struct ixgb_adapter *adapter);
36extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
37extern void ixgb_reset(struct ixgb_adapter *adapter);
38extern int ixgb_setup_rx_resources(struct ixgb_adapter *adapter);
39extern int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
40extern void ixgb_free_rx_resources(struct ixgb_adapter *adapter);
41extern void ixgb_free_tx_resources(struct ixgb_adapter *adapter);
42extern void ixgb_update_stats(struct ixgb_adapter *adapter);
43
44#define IXGB_ALL_RAR_ENTRIES 16 35#define IXGB_ALL_RAR_ENTRIES 16
45 36
46struct ixgb_stats { 37struct ixgb_stats {
@@ -136,7 +127,7 @@ ixgb_set_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
136 return -EINVAL; 127 return -EINVAL;
137 128
138 if(netif_running(adapter->netdev)) { 129 if(netif_running(adapter->netdev)) {
139 ixgb_down(adapter, TRUE); 130 ixgb_down(adapter, true);
140 ixgb_reset(adapter); 131 ixgb_reset(adapter);
141 ixgb_up(adapter); 132 ixgb_up(adapter);
142 ixgb_set_speed_duplex(netdev); 133 ixgb_set_speed_duplex(netdev);
@@ -185,7 +176,7 @@ ixgb_set_pauseparam(struct net_device *netdev,
185 hw->fc.type = ixgb_fc_none; 176 hw->fc.type = ixgb_fc_none;
186 177
187 if(netif_running(adapter->netdev)) { 178 if(netif_running(adapter->netdev)) {
188 ixgb_down(adapter, TRUE); 179 ixgb_down(adapter, true);
189 ixgb_up(adapter); 180 ixgb_up(adapter);
190 ixgb_set_speed_duplex(netdev); 181 ixgb_set_speed_duplex(netdev);
191 } else 182 } else
@@ -194,7 +185,7 @@ ixgb_set_pauseparam(struct net_device *netdev,
194 return 0; 185 return 0;
195} 186}
196 187
197static uint32_t 188static u32
198ixgb_get_rx_csum(struct net_device *netdev) 189ixgb_get_rx_csum(struct net_device *netdev)
199{ 190{
200 struct ixgb_adapter *adapter = netdev_priv(netdev); 191 struct ixgb_adapter *adapter = netdev_priv(netdev);
@@ -203,14 +194,14 @@ ixgb_get_rx_csum(struct net_device *netdev)
203} 194}
204 195
205static int 196static int
206ixgb_set_rx_csum(struct net_device *netdev, uint32_t data) 197ixgb_set_rx_csum(struct net_device *netdev, u32 data)
207{ 198{
208 struct ixgb_adapter *adapter = netdev_priv(netdev); 199 struct ixgb_adapter *adapter = netdev_priv(netdev);
209 200
210 adapter->rx_csum = data; 201 adapter->rx_csum = data;
211 202
212 if(netif_running(netdev)) { 203 if(netif_running(netdev)) {
213 ixgb_down(adapter,TRUE); 204 ixgb_down(adapter, true);
214 ixgb_up(adapter); 205 ixgb_up(adapter);
215 ixgb_set_speed_duplex(netdev); 206 ixgb_set_speed_duplex(netdev);
216 } else 207 } else
@@ -218,14 +209,14 @@ ixgb_set_rx_csum(struct net_device *netdev, uint32_t data)
218 return 0; 209 return 0;
219} 210}
220 211
221static uint32_t 212static u32
222ixgb_get_tx_csum(struct net_device *netdev) 213ixgb_get_tx_csum(struct net_device *netdev)
223{ 214{
224 return (netdev->features & NETIF_F_HW_CSUM) != 0; 215 return (netdev->features & NETIF_F_HW_CSUM) != 0;
225} 216}
226 217
227static int 218static int
228ixgb_set_tx_csum(struct net_device *netdev, uint32_t data) 219ixgb_set_tx_csum(struct net_device *netdev, u32 data)
229{ 220{
230 if (data) 221 if (data)
231 netdev->features |= NETIF_F_HW_CSUM; 222 netdev->features |= NETIF_F_HW_CSUM;
@@ -236,7 +227,7 @@ ixgb_set_tx_csum(struct net_device *netdev, uint32_t data)
236} 227}
237 228
238static int 229static int
239ixgb_set_tso(struct net_device *netdev, uint32_t data) 230ixgb_set_tso(struct net_device *netdev, u32 data)
240{ 231{
241 if(data) 232 if(data)
242 netdev->features |= NETIF_F_TSO; 233 netdev->features |= NETIF_F_TSO;
@@ -245,7 +236,7 @@ ixgb_set_tso(struct net_device *netdev, uint32_t data)
245 return 0; 236 return 0;
246} 237}
247 238
248static uint32_t 239static u32
249ixgb_get_msglevel(struct net_device *netdev) 240ixgb_get_msglevel(struct net_device *netdev)
250{ 241{
251 struct ixgb_adapter *adapter = netdev_priv(netdev); 242 struct ixgb_adapter *adapter = netdev_priv(netdev);
@@ -253,7 +244,7 @@ ixgb_get_msglevel(struct net_device *netdev)
253} 244}
254 245
255static void 246static void
256ixgb_set_msglevel(struct net_device *netdev, uint32_t data) 247ixgb_set_msglevel(struct net_device *netdev, u32 data)
257{ 248{
258 struct ixgb_adapter *adapter = netdev_priv(netdev); 249 struct ixgb_adapter *adapter = netdev_priv(netdev);
259 adapter->msg_enable = data; 250 adapter->msg_enable = data;
@@ -263,7 +254,7 @@ ixgb_set_msglevel(struct net_device *netdev, uint32_t data)
263static int 254static int
264ixgb_get_regs_len(struct net_device *netdev) 255ixgb_get_regs_len(struct net_device *netdev)
265{ 256{
266#define IXGB_REG_DUMP_LEN 136*sizeof(uint32_t) 257#define IXGB_REG_DUMP_LEN 136*sizeof(u32)
267 return IXGB_REG_DUMP_LEN; 258 return IXGB_REG_DUMP_LEN;
268} 259}
269 260
@@ -273,9 +264,9 @@ ixgb_get_regs(struct net_device *netdev,
273{ 264{
274 struct ixgb_adapter *adapter = netdev_priv(netdev); 265 struct ixgb_adapter *adapter = netdev_priv(netdev);
275 struct ixgb_hw *hw = &adapter->hw; 266 struct ixgb_hw *hw = &adapter->hw;
276 uint32_t *reg = p; 267 u32 *reg = p;
277 uint32_t *reg_start = reg; 268 u32 *reg_start = reg;
278 uint8_t i; 269 u8 i;
279 270
280 /* the 1 (one) below indicates an attempt at versioning, if the 271 /* the 1 (one) below indicates an attempt at versioning, if the
281 * interface in ethtool or the driver changes, this 1 should be 272 * interface in ethtool or the driver changes, this 1 should be
@@ -404,7 +395,7 @@ ixgb_get_regs(struct net_device *netdev,
404 *reg++ = IXGB_GET_STAT(adapter, xofftxc); /* 134 */ 395 *reg++ = IXGB_GET_STAT(adapter, xofftxc); /* 134 */
405 *reg++ = IXGB_GET_STAT(adapter, rjc); /* 135 */ 396 *reg++ = IXGB_GET_STAT(adapter, rjc); /* 135 */
406 397
407 regs->len = (reg - reg_start) * sizeof(uint32_t); 398 regs->len = (reg - reg_start) * sizeof(u32);
408} 399}
409 400
410static int 401static int
@@ -416,7 +407,7 @@ ixgb_get_eeprom_len(struct net_device *netdev)
416 407
417static int 408static int
418ixgb_get_eeprom(struct net_device *netdev, 409ixgb_get_eeprom(struct net_device *netdev,
419 struct ethtool_eeprom *eeprom, uint8_t *bytes) 410 struct ethtool_eeprom *eeprom, u8 *bytes)
420{ 411{
421 struct ixgb_adapter *adapter = netdev_priv(netdev); 412 struct ixgb_adapter *adapter = netdev_priv(netdev);
422 struct ixgb_hw *hw = &adapter->hw; 413 struct ixgb_hw *hw = &adapter->hw;
@@ -454,7 +445,7 @@ ixgb_get_eeprom(struct net_device *netdev,
454 eeprom_buff[i] = ixgb_get_eeprom_word(hw, (first_word + i)); 445 eeprom_buff[i] = ixgb_get_eeprom_word(hw, (first_word + i));
455 } 446 }
456 447
457 memcpy(bytes, (uint8_t *)eeprom_buff + (eeprom->offset & 1), 448 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 1),
458 eeprom->len); 449 eeprom->len);
459 kfree(eeprom_buff); 450 kfree(eeprom_buff);
460 451
@@ -464,14 +455,14 @@ geeprom_error:
464 455
465static int 456static int
466ixgb_set_eeprom(struct net_device *netdev, 457ixgb_set_eeprom(struct net_device *netdev,
467 struct ethtool_eeprom *eeprom, uint8_t *bytes) 458 struct ethtool_eeprom *eeprom, u8 *bytes)
468{ 459{
469 struct ixgb_adapter *adapter = netdev_priv(netdev); 460 struct ixgb_adapter *adapter = netdev_priv(netdev);
470 struct ixgb_hw *hw = &adapter->hw; 461 struct ixgb_hw *hw = &adapter->hw;
471 uint16_t *eeprom_buff; 462 u16 *eeprom_buff;
472 void *ptr; 463 void *ptr;
473 int max_len, first_word, last_word; 464 int max_len, first_word, last_word;
474 uint16_t i; 465 u16 i;
475 466
476 if(eeprom->len == 0) 467 if(eeprom->len == 0)
477 return -EINVAL; 468 return -EINVAL;
@@ -570,14 +561,14 @@ ixgb_set_ringparam(struct net_device *netdev,
570 return -EINVAL; 561 return -EINVAL;
571 562
572 if(netif_running(adapter->netdev)) 563 if(netif_running(adapter->netdev))
573 ixgb_down(adapter,TRUE); 564 ixgb_down(adapter, true);
574 565
575 rxdr->count = max(ring->rx_pending,(uint32_t)MIN_RXD); 566 rxdr->count = max(ring->rx_pending,(u32)MIN_RXD);
576 rxdr->count = min(rxdr->count,(uint32_t)MAX_RXD); 567 rxdr->count = min(rxdr->count,(u32)MAX_RXD);
577 rxdr->count = ALIGN(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE); 568 rxdr->count = ALIGN(rxdr->count, IXGB_REQ_RX_DESCRIPTOR_MULTIPLE);
578 569
579 txdr->count = max(ring->tx_pending,(uint32_t)MIN_TXD); 570 txdr->count = max(ring->tx_pending,(u32)MIN_TXD);
580 txdr->count = min(txdr->count,(uint32_t)MAX_TXD); 571 txdr->count = min(txdr->count,(u32)MAX_TXD);
581 txdr->count = ALIGN(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE); 572 txdr->count = ALIGN(txdr->count, IXGB_REQ_TX_DESCRIPTOR_MULTIPLE);
582 573
583 if(netif_running(adapter->netdev)) { 574 if(netif_running(adapter->netdev)) {
@@ -633,7 +624,7 @@ ixgb_led_blink_callback(unsigned long data)
633} 624}
634 625
635static int 626static int
636ixgb_phys_id(struct net_device *netdev, uint32_t data) 627ixgb_phys_id(struct net_device *netdev, u32 data)
637{ 628{
638 struct ixgb_adapter *adapter = netdev_priv(netdev); 629 struct ixgb_adapter *adapter = netdev_priv(netdev);
639 630
@@ -669,7 +660,7 @@ ixgb_get_sset_count(struct net_device *netdev, int sset)
669 660
670static void 661static void
671ixgb_get_ethtool_stats(struct net_device *netdev, 662ixgb_get_ethtool_stats(struct net_device *netdev,
672 struct ethtool_stats *stats, uint64_t *data) 663 struct ethtool_stats *stats, u64 *data)
673{ 664{
674 struct ixgb_adapter *adapter = netdev_priv(netdev); 665 struct ixgb_adapter *adapter = netdev_priv(netdev);
675 int i; 666 int i;
@@ -678,12 +669,12 @@ ixgb_get_ethtool_stats(struct net_device *netdev,
678 for(i = 0; i < IXGB_STATS_LEN; i++) { 669 for(i = 0; i < IXGB_STATS_LEN; i++) {
679 char *p = (char *)adapter+ixgb_gstrings_stats[i].stat_offset; 670 char *p = (char *)adapter+ixgb_gstrings_stats[i].stat_offset;
680 data[i] = (ixgb_gstrings_stats[i].sizeof_stat == 671 data[i] = (ixgb_gstrings_stats[i].sizeof_stat ==
681 sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; 672 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
682 } 673 }
683} 674}
684 675
685static void 676static void
686ixgb_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) 677ixgb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
687{ 678{
688 int i; 679 int i;
689 680