1 --- a/Embedded/src/GbE/gcu.h
2 +++ b/Embedded/src/GbE/gcu.h
7 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
8 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of version 2 of the GNU General Public License as
12 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
16 - version: Embedded.L.1.0.34
17 + version: Embedded.Release.Patch.L.1.0.7-5
21 --- a/Embedded/src/GbE/gcu_if.c
22 +++ b/Embedded/src/GbE/gcu_if.c
27 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
28 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
30 This program is free software; you can redistribute it and/or modify
31 it under the terms of version 2 of the GNU General Public License as
32 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
36 - version: Embedded.L.1.0.34
37 + version: Embedded.Release.Patch.L.1.0.7-5
41 @@ -330,10 +330,17 @@ gcu_write_verify(uint32_t phy_num, uint3
43 void gcu_iegbe_resume(struct pci_dev *pdev)
45 +#if ( ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,6) ) && \
46 + ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) )
47 + struct net_device *netdev = pci_get_drvdata(pdev);
48 + struct gcu_adapter *adapter = netdev_priv(netdev);
51 GCU_DBG("%s\n", __func__);
53 pci_restore_state(pdev);
54 - pci_enable_device(pdev);
55 + if(!pci_enable_device(pdev))
56 + GCU_DBG("pci_enable_device failed!\n",);
60 @@ -348,6 +355,12 @@ EXPORT_SYMBOL(gcu_iegbe_resume);
62 int gcu_iegbe_suspend(struct pci_dev *pdev, uint32_t state)
64 +#if ( ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,6) ) && \
65 + ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) )
66 + struct net_device *netdev = pci_get_drvdata(pdev);
67 + struct gcu_adapter *adapter = netdev_priv(netdev);
70 GCU_DBG("%s\n", __func__);
73 --- a/Embedded/src/GbE/gcu_if.h
74 +++ b/Embedded/src/GbE/gcu_if.h
79 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
80 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
82 This program is free software; you can redistribute it and/or modify
83 it under the terms of version 2 of the GNU General Public License as
84 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
88 - version: Embedded.L.1.0.34
89 + version: Embedded.Release.Patch.L.1.0.7-5
93 --- a/Embedded/src/GbE/gcu_main.c
94 +++ b/Embedded/src/GbE/gcu_main.c
99 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
100 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
102 This program is free software; you can redistribute it and/or modify
103 it under the terms of version 2 of the GNU General Public License as
104 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
108 - version: Embedded.L.1.0.34
109 + version: Embedded.Release.Patch.L.1.0.7-5
113 @@ -94,6 +94,7 @@ static struct pci_driver gcu_driver = {
115 static struct gcu_adapter *global_adapter = 0;
116 static spinlock_t global_adapter_spinlock = SPIN_LOCK_UNLOCKED;
117 +static unsigned long g_intflags = 0;
119 MODULE_AUTHOR("Intel(R) Corporation");
120 MODULE_DESCRIPTION("Global Configuration Unit Driver");
121 @@ -124,7 +125,7 @@ gcu_init_module(void)
123 printk(KERN_INFO "%s\n", gcu_copyright);
125 - ret = pci_module_init(&gcu_driver);
126 + ret = pci_register_driver(&gcu_driver);
128 register_reboot_notifier(&gcu_notifier_reboot);
130 @@ -199,8 +200,6 @@ gcu_probe(struct pci_dev *pdev,
134 - SET_MODULE_OWNER(adapter);
136 pci_set_drvdata(pdev, adapter);
138 adapter->pdev = pdev;
139 @@ -238,7 +237,6 @@ gcu_probe(struct pci_dev *pdev,
145 * gcu_probe_err - gcu_probe error handler
147 @@ -295,7 +293,7 @@ gcu_notify_reboot(struct notifier_block
151 - while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
152 + while((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
153 if(pci_dev_driver(pdev) == &gcu_driver){
154 gcu_suspend(pdev, 0x3);
156 @@ -318,6 +316,11 @@ static int
157 gcu_suspend(struct pci_dev *pdev, uint32_t state)
159 /*struct gcu_adapter *adapter = pci_get_drvdata(pdev); */
160 +#if ( ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,6) ) && \
161 + ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) ) )
162 + struct net_device *netdev = pci_get_drvdata(pdev);
163 + struct gcu_adapter *adapter = netdev_priv(netdev);
166 GCU_DBG("%s\n", __func__);
168 @@ -338,7 +341,6 @@ gcu_suspend(struct pci_dev *pdev, uint32
176 @@ -412,7 +414,7 @@ gcu_get_adapter(void)
180 - spin_lock(&global_adapter_spinlock);
181 + spin_lock_irqsave(&global_adapter_spinlock, g_intflags);
183 return global_adapter;
185 @@ -437,7 +439,7 @@ gcu_release_adapter(const struct gcu_ada
189 - spin_unlock(&global_adapter_spinlock);
190 + spin_unlock_irqrestore(&global_adapter_spinlock, g_intflags);
194 --- a/Embedded/src/GbE/gcu_reg.h
195 +++ b/Embedded/src/GbE/gcu_reg.h
200 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
201 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
203 This program is free software; you can redistribute it and/or modify
204 it under the terms of version 2 of the GNU General Public License as
205 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
209 - version: Embedded.L.1.0.34
210 + version: Embedded.Release.Patch.L.1.0.7-5
214 --- a/Embedded/src/GbE/iegbe.7
215 +++ b/Embedded/src/GbE/iegbe.7
218 .\" GPL LICENSE SUMMARY
220 -.\" Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
221 +.\" Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
223 .\" This program is free software; you can redistribute it and/or modify
224 .\" it under the terms of version 2 of the GNU General Public License as
226 .\" Contact Information:
227 .\" Intel Corporation
229 -.\" version: Embedded.L.1.0.34
230 +.\" version: Embedded.Release.Patch.L.1.0.7-5
234 --- a/Embedded/src/GbE/iegbe_ethtool.c
235 +++ b/Embedded/src/GbE/iegbe_ethtool.c
240 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
241 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
243 This program is free software; you can redistribute it and/or modify
244 it under the terms of version 2 of the GNU General Public License as
245 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
249 - version: Embedded.L.1.0.34
250 + version: Embedded.Release.Patch.L.1.0.7-5
254 @@ -132,22 +132,6 @@ static const struct iegbe_stats iegbe_gs
255 { "cpp_master", E1000_STAT(icr_cpp_master) },
256 { "stat", E1000_STAT(icr_stat) },
258 -#ifdef IEGBE_GBE_WORKAROUND
259 - { "txqec", E1000_STAT(stats.txqec) },
260 - { "tx_next_to_clean", E1000_STAT(stats.tx_next_to_clean) },
261 - { "tx_next_to_use", E1000_STAT(stats.tx_next_to_use) },
262 - { "num_tx_queues", E1000_STAT(stats.num_tx_queues) },
264 - { "num_rx_buf_alloc", E1000_STAT(stats.num_rx_buf_alloc) },
265 - { "rx_next_to_clean", E1000_STAT(stats.rx_next_to_clean) },
266 - { "rx_next_to_use", E1000_STAT(stats.rx_next_to_use) },
267 - { "cc_gt_num_rx", E1000_STAT(stats.cc_gt_num_rx) },
268 - { "tx_hnet", E1000_STAT(stats.tx_hnet) },
269 - { "tx_hnentu", E1000_STAT(stats.tx_hnentu) },
270 - { "RUC", E1000_STAT(stats.ruc) },
271 - { "RFC", E1000_STAT(stats.rfc) },
275 #define E1000_STATS_LEN \
276 sizeof(iegbe_gstrings_stats) / sizeof(struct iegbe_stats)
277 @@ -158,7 +142,7 @@ static const char iegbe_gstrings_test[][
278 "Interrupt test (offline)", "Loopback test (offline)",
279 "Link test (on/offline)"
281 -#define E1000_TEST_LEN (sizeof(iegbe_gstrings_test) / (ETH_GSTRING_LEN))
282 +#define E1000_TEST_LEN (sizeof(iegbe_gstrings_test) / ETH_GSTRING_LEN)
283 #endif /* ETHTOOL_TEST */
285 #define E1000_REGS_LEN 0x20
286 @@ -176,9 +160,7 @@ iegbe_get_settings(struct net_device *ne
287 SUPPORTED_10baseT_Full |
288 SUPPORTED_100baseT_Half |
289 SUPPORTED_100baseT_Full |
290 -#ifndef IEGBE_10_100_ONLY
291 SUPPORTED_1000baseT_Full|
296 @@ -259,21 +241,13 @@ iegbe_set_settings(struct net_device *ne
297 ADVERTISED_10baseT_Full |
298 ADVERTISED_100baseT_Half |
299 ADVERTISED_100baseT_Full |
300 -#ifndef IEGBE_10_100_ONLY
301 ADVERTISED_1000baseT_Full|
306 ecmd->advertising = hw->autoneg_advertised;
311 - // ethtool uses DUPLEX_FULL/DUPLEX_HALF
312 - // the driver needs FULL_DUPLEX/HALF_DUPLEX
313 - duplex = (ecmd->duplex == DUPLEX_FULL) ? FULL_DUPLEX : HALF_DUPLEX;
314 - if(iegbe_set_spd_dplx(adapter, ecmd->speed + duplex))
316 + if(iegbe_set_spd_dplx(adapter, ecmd->speed + ecmd->duplex)){
320 @@ -728,8 +702,8 @@ iegbe_set_ringparam(struct net_device *n
321 struct iegbe_rx_ring *rxdr, *rx_old, *rx_new;
322 int i, err, tx_ring_size, rx_ring_size;
324 - tx_ring_size = sizeof(struct iegbe_tx_ring) * adapter->num_queues;
325 - rx_ring_size = sizeof(struct iegbe_rx_ring) * adapter->num_queues;
326 + tx_ring_size = sizeof(struct iegbe_tx_ring) * adapter->num_tx_queues;
327 + rx_ring_size = sizeof(struct iegbe_rx_ring) * adapter->num_rx_queues;
329 if (netif_running(adapter->netdev)){
331 @@ -768,10 +742,10 @@ iegbe_set_ringparam(struct net_device *n
332 E1000_MAX_TXD : E1000_MAX_82544_TXD));
333 E1000_ROUNDUP(txdr->count, REQ_TX_DESCRIPTOR_MULTIPLE);
335 - for (i = 0; i < adapter->num_queues; i++) {
336 - txdr[i].count = txdr->count;
337 - rxdr[i].count = rxdr->count;
339 + for (i = 0; i < adapter->num_tx_queues; i++)
340 + txdr[i].count = txdr->count;
341 + for (i = 0; i < adapter->num_rx_queues; i++)
342 + rxdr[i].count = rxdr->count;
344 if(netif_running(adapter->netdev)) {
345 /* Try to get new resources before deleting old */
346 @@ -950,8 +924,7 @@ iegbe_eeprom_test(struct iegbe_adapter *
349 iegbe_test_intr(int irq,
351 - struct pt_regs *regs)
354 struct net_device *netdev = (struct net_device *) data;
355 struct iegbe_adapter *adapter = netdev_priv(netdev);
356 @@ -973,7 +946,7 @@ iegbe_intr_test(struct iegbe_adapter *ad
357 /* Hook up test interrupt handler just for this test */
358 if(!request_irq(irq, &iegbe_test_intr, 0, netdev->name, netdev)) {
360 - } else if(request_irq(irq, &iegbe_test_intr, SA_SHIRQ,
361 + } else if(request_irq(irq, &iegbe_test_intr, IRQF_SHARED,
362 netdev->name, netdev)){
365 @@ -1393,7 +1366,7 @@ iegbe_set_phy_loopback(struct iegbe_adap
366 * attempt this 10 times.
368 while(iegbe_nonintegrated_phy_loopback(adapter) &&
369 - count++ < 0xa) { };
374 --- a/Embedded/src/GbE/iegbe.h
375 +++ b/Embedded/src/GbE/iegbe.h
377 /*******************************************************************************
380 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
381 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
383 This program is free software; you can redistribute it and/or modify
384 it under the terms of version 2 of the GNU General Public License as
385 @@ -21,7 +21,7 @@ GPL LICENSE SUMMARY
389 - version: Embedded.L.1.0.34
390 + version: Embedded.Release.Patch.L.1.0.7-5
394 @@ -127,9 +127,12 @@ struct iegbe_adapter;
395 #define E1000_MIN_RXD 80
396 #define E1000_MAX_82544_RXD 4096
398 +#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
399 /* Supported Rx Buffer Sizes */
400 #define E1000_RXBUFFER_128 128 /* Used for packet split */
401 #define E1000_RXBUFFER_256 256 /* Used for packet split */
402 +#define E1000_RXBUFFER_512 512
403 +#define E1000_RXBUFFER_1024 1024
404 #define E1000_RXBUFFER_2048 2048
405 #define E1000_RXBUFFER_4096 4096
406 #define E1000_RXBUFFER_8192 8192
407 @@ -164,11 +167,9 @@ struct iegbe_adapter;
408 #define E1000_MASTER_SLAVE iegbe_ms_hw_default
411 -#ifdef NETIF_F_HW_VLAN_TX
412 -#define E1000_MNG_VLAN_NONE -1
414 +#define E1000_MNG_VLAN_NONE (-1)
415 /* Number of packet split data buffers (not including the header buffer) */
416 -#define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
417 +#define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
419 /* only works for sizes that are powers of 2 */
420 #define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
421 @@ -206,6 +207,7 @@ struct iegbe_tx_ring {
425 + boolean_t last_tx_tso;
429 @@ -228,6 +230,9 @@ struct iegbe_rx_ring {
430 struct iegbe_ps_page *ps_page;
431 struct iegbe_ps_page_dma *ps_page_dma;
433 + /* cpu for rx queue */
439 @@ -252,10 +257,8 @@ struct iegbe_adapter {
440 struct timer_list tx_fifo_stall_timer;
441 struct timer_list watchdog_timer;
442 struct timer_list phy_info_timer;
443 -#ifdef NETIF_F_HW_VLAN_TX
444 struct vlan_group *vlgrp;
445 uint16_t mng_vlan_id;
448 uint32_t rx_buffer_len;
450 @@ -265,8 +268,18 @@ struct iegbe_adapter {
452 uint16_t link_duplex;
453 spinlock_t stats_lock;
455 - struct work_struct tx_timeout_task;
456 + spinlock_t tx_queue_lock;
457 + unsigned int total_tx_bytes;
458 + unsigned int total_tx_packets;
459 + unsigned int total_rx_bytes;
460 + unsigned int total_rx_packets;
461 + /* Interrupt Throttle Rate */
463 + uint32_t itr_setting;
467 + struct work_struct reset_task;
470 #ifdef ETHTOOL_PHYS_ID
471 @@ -276,9 +289,8 @@ struct iegbe_adapter {
474 struct iegbe_tx_ring *tx_ring; /* One per active queue */
475 -#ifdef CONFIG_E1000_MQ
476 - struct iegbe_tx_ring **cpu_tx_ring; /* per-cpu */
478 + unsigned int restart_queue;
479 + unsigned long tx_queue_len;
481 uint32_t tx_int_delay;
482 uint32_t tx_abs_int_delay;
483 @@ -286,46 +298,33 @@ struct iegbe_adapter {
487 + uint32_t tx_timeout_count;
488 uint32_t tx_fifo_head;
489 uint32_t tx_head_addr;
490 uint32_t tx_fifo_size;
491 + uint8_t tx_timeout_factor;
492 atomic_t tx_fifo_stall;
493 boolean_t pcix_82544;
494 boolean_t detect_tx_hung;
497 -#ifdef CONFIG_E1000_NAPI
498 - boolean_t (*clean_rx) (struct iegbe_adapter *adapter,
499 + bool (*clean_rx)(struct iegbe_adapter *adapter,
500 struct iegbe_rx_ring *rx_ring,
501 int *work_done, int work_to_do);
503 - boolean_t (*clean_rx) (struct iegbe_adapter *adapter,
504 - struct iegbe_rx_ring *rx_ring);
507 -#ifdef IEGBE_GBE_WORKAROUND
508 void (*alloc_rx_buf) (struct iegbe_adapter *adapter,
509 - struct iegbe_rx_ring *rx_ring,
510 - int cleaned_count);
512 - void (*alloc_rx_buf) (struct iegbe_adapter *adapter,
513 - struct iegbe_rx_ring *rx_ring);
516 + struct iegbe_rx_ring *rx_ring,
517 + int cleaned_count);
518 struct iegbe_rx_ring *rx_ring; /* One per active queue */
519 -#ifdef CONFIG_E1000_NAPI
520 + struct napi_struct napi;
521 struct net_device *polling_netdev; /* One per active queue */
523 -#ifdef CONFIG_E1000_MQ
524 - struct net_device **cpu_netdev; /* per-cpu */
525 - struct call_async_data_struct rx_sched_call_data;
526 - int cpu_for_queue[4];
533 uint64_t hw_csum_err;
534 uint64_t hw_csum_good;
535 uint64_t rx_hdr_split;
536 + uint32_t alloc_rx_buff_failed;
537 uint32_t rx_int_delay;
538 uint32_t rx_abs_int_delay;
540 @@ -334,8 +333,6 @@ struct iegbe_adapter {
542 uint16_t rx_ps_bsize0;
544 - /* Interrupt Throttle Rate */
547 /* OS defined structs */
548 struct net_device *netdev;
549 @@ -378,7 +375,21 @@ struct iegbe_adapter {
550 #ifdef CONFIG_PCI_MSI
553 -#define IEGBE_INTD_DISABLE 0x0400
554 + /* to not mess up cache alignment, always add to the bottom */
555 + boolean_t tso_force;
556 + boolean_t smart_power_down; /* phy smart power down */
557 + boolean_t quad_port_a;
558 + unsigned long flags;
559 + uint32_t eeprom_wol;
564 +enum iegbe_state_t {
569 +#define IEGBE_INTD_DISABLE 0x0400
570 #endif /* _IEGBE_H_ */
572 --- a/Embedded/src/GbE/iegbe_hw.c
573 +++ b/Embedded/src/GbE/iegbe_hw.c
578 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
579 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
581 This program is free software; you can redistribute it and/or modify
582 it under the terms of version 2 of the GNU General Public License as
583 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
587 - version: Embedded.L.1.0.34
588 + version: Embedded.Release.Patch.L.1.0.7-5
592 @@ -2115,7 +2115,7 @@ iegbe_config_mac_to_phy(struct iegbe_hw
594 ret_val = iegbe_oem_set_trans_gasket(hw);
599 ret_val = iegbe_oem_phy_is_full_duplex(
600 hw, (int *) &is_FullDuplex);
601 @@ -2164,7 +2164,7 @@ iegbe_config_mac_to_phy(struct iegbe_hw
603 /* Write the configured values back to the Device Control Reg. */
604 E1000_WRITE_REG(hw, CTRL, ctrl);
605 - return E1000_SUCCESS;
609 /*****************************************************************************
610 @@ -2684,7 +2684,7 @@ iegbe_check_for_link(struct iegbe_hw *hw
612 if(hw->autoneg_failed == 0) {
613 hw->autoneg_failed = 1;
615 + return E1000_SUCCESS;
617 DEBUGOUT("NOT RXing /C/, disable AutoNeg and force link.\r\n");
619 @@ -5875,7 +5875,7 @@ iegbe_get_cable_length(struct iegbe_hw *
625 /* This is to fix a Klockwork defect, that the array index might
626 * be out of bounds. 113 is table size */
628 --- a/Embedded/src/GbE/iegbe_hw.h
629 +++ b/Embedded/src/GbE/iegbe_hw.h
634 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
635 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
637 This program is free software; you can redistribute it and/or modify
638 it under the terms of version 2 of the GNU General Public License as
639 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
643 - version: Embedded.L.1.0.34
644 + version: Embedded.Release.Patch.L.1.0.7-5
648 @@ -299,7 +299,7 @@ void iegbe_set_media_type(struct iegbe_h
649 /* Link Configuration */
650 int32_t iegbe_setup_link(struct iegbe_hw *hw);
651 int32_t iegbe_phy_setup_autoneg(struct iegbe_hw *hw);
652 -void iegbe_config_collision_dist(struct iegbe_hw *hw);
653 +void iegbe_config_collision_dist(struct iegbe_hw *hw);
654 int32_t iegbe_config_fc_after_link_up(struct iegbe_hw *hw);
655 int32_t iegbe_check_for_link(struct iegbe_hw *hw);
656 int32_t iegbe_get_speed_and_duplex(struct iegbe_hw *hw, uint16_t * speed, uint16_t * duplex);
657 @@ -588,14 +588,6 @@ uint8_t iegbe_arc_subsystem_valid(struct
658 * o LSC = Link Status Change
661 -#ifdef IEGBE_GBE_WORKAROUND
662 -#define IMS_ENABLE_MASK ( \
665 - E1000_IMS_RXDMT0 | \
666 - E1000_IMS_RXSEQ | \
669 #define IMS_ENABLE_MASK ( \
672 @@ -606,8 +598,7 @@ uint8_t iegbe_arc_subsystem_valid(struct
674 E1000_ICR_CPP_TARGET | \
675 E1000_ICR_CPP_MASTER | \
680 /* Number of high/low register pairs in the RAR. The RAR (Receive Address
681 * Registers) holds the directed and multicast addresses that we monitor. We
682 @@ -923,10 +914,15 @@ struct iegbe_ffvt_entry {
683 #define E1000_ICS 0x000C8 /* Interrupt Cause Set - WO */
684 #define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */
685 #define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */
686 -// Register conflict, does not exist for ICP_xxxx hardware
687 -// #define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */
688 #define E1000_CTRL_AUX 0x000E0 /* Aux Control -RW */
689 +#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */
690 #define E1000_RCTL 0x00100 /* RX Control - RW */
691 +#define E1000_RDTR1 0x02820 /* RX Delay Timer (1) - RW */
692 +#define E1000_RDBAL1 0x02900 /* RX Descriptor Base Address Low (1) - RW */
693 +#define E1000_RDBAH1 0x02904 /* RX Descriptor Base Address High (1) - RW */
694 +#define E1000_RDLEN1 0x02908 /* RX Descriptor Length (1) - RW */
695 +#define E1000_RDH1 0x02910 /* RX Descriptor Head (1) - RW */
696 +#define E1000_RDT1 0x02918 /* RX Descriptor Tail (1) - RW */
697 #define E1000_FCTTV 0x00170 /* Flow Control Transmit Timer Value - RW */
698 #define E1000_TXCW 0x00178 /* TX Configuration Word - RW */
699 #define E1000_RXCW 0x00180 /* RX Configuration Word - RO */
700 @@ -1282,8 +1278,6 @@ struct iegbe_ffvt_entry {
701 #define E1000_82542_FFMT E1000_FFMT
702 #define E1000_82542_FFVT E1000_FFVT
703 #define E1000_82542_HOST_IF E1000_HOST_IF
704 -// Register conflict with ICP_xxxx hardware, no IAM
705 -// #define E1000_82542_IAM E1000_IAM
706 #define E1000_82542_EEMNGCTL E1000_EEMNGCTL
707 #define E1000_82542_PSRCTL E1000_PSRCTL
708 #define E1000_82542_RAID E1000_RAID
709 @@ -1329,6 +1323,7 @@ struct iegbe_hw_stats {
717 @@ -1363,6 +1358,7 @@ struct iegbe_hw_stats {
725 @@ -1392,19 +1388,6 @@ struct iegbe_hw_stats {
729 -#ifdef IEGBE_GBE_WORKAROUND
731 - u64 tx_next_to_clean;
732 - u64 tx_next_to_use;
738 - u64 num_rx_buf_alloc;
739 - u64 rx_next_to_clean;
740 - u64 rx_next_to_use;
744 /* Structure containing variables used by the shared code (iegbe_hw.c) */
745 @@ -1484,6 +1467,7 @@ struct iegbe_hw {
746 boolean_t ifs_params_forced;
747 boolean_t in_ifs_mode;
748 boolean_t mng_reg_access_disabled;
749 + boolean_t rx_needs_kicking;
750 boolean_t icp_xxxx_is_link_up;
753 @@ -2358,17 +2342,23 @@ struct iegbe_host_command_info {
754 #define E1000_EXTCNF_SIZE_EXT_PHY_LENGTH 0x000000FF
755 #define E1000_EXTCNF_SIZE_EXT_DOCK_LENGTH 0x0000FF00
756 #define E1000_EXTCNF_SIZE_EXT_PCIE_LENGTH 0x00FF0000
757 +#define E1000_EXTCNF_CTRL_LCD_WRITE_ENABLE 0x00000001
758 +#define E1000_EXTCNF_CTRL_SWFLAG 0x00000020
761 +#define E1000_PBA_8K 0x0008 /* 8KB, default Rx allocation */
762 #define E1000_PBA_12K 0x000C /* 12KB, default Rx allocation */
763 #define E1000_PBA_16K 0x0010 /* 16KB, default TX allocation */
764 +#define E1000_PBA_20K 0x0014
765 #define E1000_PBA_22K 0x0016
766 #define E1000_PBA_24K 0x0018
767 #define E1000_PBA_30K 0x001E
768 #define E1000_PBA_32K 0x0020
769 +#define E1000_PBA_34K 0x0022
770 #define E1000_PBA_38K 0x0026
771 #define E1000_PBA_40K 0x0028
772 #define E1000_PBA_48K 0x0030 /* 48KB, default RX allocation */
773 +#define E1000_PBS_16K E1000_PBA_16K
775 /* Flow Control Constants */
776 #define FLOW_CONTROL_ADDRESS_LOW 0x00C28001
777 @@ -2899,7 +2889,7 @@ struct iegbe_host_command_info {
778 #define M88E1000_14_PHY_ID M88E1000_E_PHY_ID
779 #define M88E1011_I_REV_4 0x04
780 #define M88E1111_I_PHY_ID 0x01410CC2
781 -#define M88E1141_E_PHY_ID 0x01410CD4
782 +#define M88E1141_E_PHY_ID 0x01410CD0
783 #define L1LXT971A_PHY_ID 0x001378E0
785 /* Miscellaneous PHY bit definitions. */
786 --- a/Embedded/src/GbE/iegbe_main.c
787 +++ b/Embedded/src/GbE/iegbe_main.c
792 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
793 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
795 This program is free software; you can redistribute it and/or modify
796 it under the terms of version 2 of the GNU General Public License as
797 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
801 - version: Embedded.L.1.0.34
802 + version: Embedded.Release.Patch.L.1.0.7-5
806 @@ -42,103 +42,15 @@ GPL LICENSE SUMMARY
813 - * o iegbe_set_spd_dplx tests for compatible speed/duplex specification
814 - * for fiber adapters
816 - * o Added code to fix register test failure for devices >= 82571
819 - * o Added stats_lock around iegbe_read_phy_reg commands to avoid concurrent
820 - * calls, one from mii_ioctl and other from within update_stats while
821 - * processing MIIREG ioctl.
824 - * o Fixed ethtool diagnostics
825 - * o Enabled flow control to take default eeprom settings
826 - * o Added stats_lock around iegbe_read_phy_reg commands to avoid concurrent
827 - * calls, one from mii_ioctl and other from within update_stats while processing
830 - * o Support for MODULE_VERSION
831 - * o Fix APM setting for 82544 based adapters
833 - * o Added a timer to expire packets that were deferred for cleanup
835 - * o Added stats_lock around iegbe_read_phy_reg commands to avoid concurrent
836 - * calls, one from mii_ioctl and other from within update_stats while
837 - * processing MIIREG ioctl.
839 - * o Added enhanced functionality to the loopback diags to wrap the
841 - * o Added manageability vlan filtering workaround.
844 - * o Added code to handle raw packet based DHCP packets
845 - * o Added code to fix the errata 10 buffer overflow issue
846 - * o Sync up with WR01-05
847 - * o applied Anton's patch to resolve tx hang in hardware
848 - * o iegbe timeouts with early writeback patch
849 - * o Removed Queensport IDs
850 - * o fixed driver panic if MAC receives a bad large packets when packet
852 - * o Applied Andrew Mortons patch - iegbe stops working after resume
854 - * o Bug fix: Endianess issue causing ethtool diags to fail on ppc.
855 - * o Bug fix: Use pdev->irq instead of netdev->irq for MSI support.
856 - * o Report driver message on user override of InterruptThrottleRate module
858 - * o Bug fix: Change I/O address storage from uint32_t to unsigned long.
859 - * o Feature: Added ethtool RINGPARAM support.
860 - * o Feature: Added netpoll support.
861 - * o Bug fix: Race between Tx queue and Tx clean fixed with a spin lock.
862 - * o Bug fix: Allow 1000/Full setting for autoneg param for fiber connections.
863 - * Jon D Mason [jonmason@us.ibm.com].
866 - * o Bug fix: SERDES devices might be connected to a back-plane switch that
867 - * doesn't support auto-neg, so add the capability to force 1000/Full.
868 - * Also, since forcing 1000/Full, sample RxSynchronize bit to detect link
870 - * o Bug fix: Flow control settings for hi/lo watermark didn't consider
871 - * changes in the RX FIFO size, which could occur with Jumbo Frames or with
872 - * the reduced FIFO in 82547.
873 - * o Bug fix: Better propagation of error codes.
874 - * [Janice Girouard (janiceg -a-t- us.ibm.com)]
875 - * o Bug fix: hang under heavy Tx stress when running out of Tx descriptors;
876 - * wasn't clearing context descriptor when backing out of send because of
877 - * no-resource condition.
878 - * o Bug fix: check netif_running in dev->poll so we don't have to hang in
879 - * dev->close until all polls are finished. [Rober Olsson
880 - * (robert.olsson@data.slu.se)].
881 - * o Revert TxDescriptor ring size back to 256 since change to 1024 wasn't
882 - * accepted into the kernel.
887 -#ifdef IEGBE_GBE_WORKAROUND
888 -#define IEGBE_GBE_WORKAROUND_NUM_RX_DESCRIPTORS 1
890 +#include <linux/ipv6.h>
891 +#include <net/ip6_checksum.h>
893 char iegbe_driver_name[] = "iegbe";
894 char iegbe_driver_string[] = "Gigabit Ethernet Controller Driver";
895 -#ifndef CONFIG_E1000_NAPI
898 -#define DRIVERNAPI "-NAPI"
900 -#define DRV_VERSION "0.8.0"DRIVERNAPI
901 +#define DRV_VERSION "1.0.0-K28-NAPI"
902 char iegbe_driver_version[] = DRV_VERSION;
903 -char iegbe_copyright[] = "Copyright (c) 1999-2007 Intel Corporation.";
904 +char iegbe_copyright[] = "Copyright (c) 1999-2009 Intel Corporation.";
906 -#define E1000_FIFO_HDR 0x10
907 -#define E1000_82547_PAD_LEN 0x3E0
908 -#define MINIMUM_DHCP_PACKET_SIZE 282
909 -#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
910 -#define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000
912 /* iegbe_pci_tbl - PCI Device ID Table
914 @@ -148,95 +60,48 @@ char iegbe_copyright[] = "Copyright (c)
915 * {PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
917 static struct pci_device_id iegbe_pci_tbl[] = {
918 -/* INTEL_E1000_ETHERNET_DEVICE(0x1000), */
919 -/* INTEL_E1000_ETHERNET_DEVICE(0x1001), */
920 -/* INTEL_E1000_ETHERNET_DEVICE(0x1004), */
921 -/* INTEL_E1000_ETHERNET_DEVICE(0x1008), */
922 -/* INTEL_E1000_ETHERNET_DEVICE(0x1009), */
923 -/* INTEL_E1000_ETHERNET_DEVICE(0x100C), */
924 -/* INTEL_E1000_ETHERNET_DEVICE(0x100D), */
925 -/* INTEL_E1000_ETHERNET_DEVICE(0x100E), */
926 -/* INTEL_E1000_ETHERNET_DEVICE(0x100F), */
927 -/* INTEL_E1000_ETHERNET_DEVICE(0x1010), */
928 -/* INTEL_E1000_ETHERNET_DEVICE(0x1011), */
929 -/* INTEL_E1000_ETHERNET_DEVICE(0x1012), */
930 -/* INTEL_E1000_ETHERNET_DEVICE(0x1013), */
931 -/* INTEL_E1000_ETHERNET_DEVICE(0x1014), */
932 -/* INTEL_E1000_ETHERNET_DEVICE(0x1015), */
933 -/* INTEL_E1000_ETHERNET_DEVICE(0x1016), */
934 -/* INTEL_E1000_ETHERNET_DEVICE(0x1017), */
935 -/* INTEL_E1000_ETHERNET_DEVICE(0x1018), */
936 -/* INTEL_E1000_ETHERNET_DEVICE(0x1019), */
937 -/* INTEL_E1000_ETHERNET_DEVICE(0x101A), */
938 -/* INTEL_E1000_ETHERNET_DEVICE(0x101D), */
939 -/* INTEL_E1000_ETHERNET_DEVICE(0x101E), */
940 -/* INTEL_E1000_ETHERNET_DEVICE(0x1026), */
941 -/* INTEL_E1000_ETHERNET_DEVICE(0x1027), */
942 -/* INTEL_E1000_ETHERNET_DEVICE(0x1028), */
943 -/* INTEL_E1000_ETHERNET_DEVICE(0x105E), */
944 -/* INTEL_E1000_ETHERNET_DEVICE(0x105F), */
945 -/* INTEL_E1000_ETHERNET_DEVICE(0x1060), */
946 -/* INTEL_E1000_ETHERNET_DEVICE(0x1075), */
947 -/* INTEL_E1000_ETHERNET_DEVICE(0x1076), */
948 -/* INTEL_E1000_ETHERNET_DEVICE(0x1077), */
949 -/* INTEL_E1000_ETHERNET_DEVICE(0x1078), */
950 -/* INTEL_E1000_ETHERNET_DEVICE(0x1079), */
951 -/* INTEL_E1000_ETHERNET_DEVICE(0x107A), */
952 -/* INTEL_E1000_ETHERNET_DEVICE(0x107B), */
953 -/* INTEL_E1000_ETHERNET_DEVICE(0x107C), */
954 -/* INTEL_E1000_ETHERNET_DEVICE(0x107D), */
955 -/* INTEL_E1000_ETHERNET_DEVICE(0x107E), */
956 -/* INTEL_E1000_ETHERNET_DEVICE(0x107F), */
957 -/* INTEL_E1000_ETHERNET_DEVICE(0x108A), */
958 -/* INTEL_E1000_ETHERNET_DEVICE(0x108B), */
959 -/* INTEL_E1000_ETHERNET_DEVICE(0x108C), */
960 -/* INTEL_E1000_ETHERNET_DEVICE(0x109A), */
961 - INTEL_E1000_ETHERNET_DEVICE(0x5040),
962 - INTEL_E1000_ETHERNET_DEVICE(0x5041),
963 - INTEL_E1000_ETHERNET_DEVICE(0x5042),
964 - INTEL_E1000_ETHERNET_DEVICE(0x5043),
965 - INTEL_E1000_ETHERNET_DEVICE(0x5044),
966 - INTEL_E1000_ETHERNET_DEVICE(0x5045),
967 - INTEL_E1000_ETHERNET_DEVICE(0x5046),
968 - INTEL_E1000_ETHERNET_DEVICE(0x5047),
969 - INTEL_E1000_ETHERNET_DEVICE(0x5048),
970 - INTEL_E1000_ETHERNET_DEVICE(0x5049),
971 - INTEL_E1000_ETHERNET_DEVICE(0x504A),
972 - INTEL_E1000_ETHERNET_DEVICE(0x504B),
973 - /* required last entry */
974 + INTEL_E1000_ETHERNET_DEVICE(0x5040),
975 + INTEL_E1000_ETHERNET_DEVICE(0x5041),
976 + INTEL_E1000_ETHERNET_DEVICE(0x5042),
977 + INTEL_E1000_ETHERNET_DEVICE(0x5043),
978 + INTEL_E1000_ETHERNET_DEVICE(0x5044),
979 + INTEL_E1000_ETHERNET_DEVICE(0x5045),
980 + INTEL_E1000_ETHERNET_DEVICE(0x5046),
981 + INTEL_E1000_ETHERNET_DEVICE(0x5047),
982 + INTEL_E1000_ETHERNET_DEVICE(0x5048),
983 + INTEL_E1000_ETHERNET_DEVICE(0x5049),
984 + INTEL_E1000_ETHERNET_DEVICE(0x504A),
985 + INTEL_E1000_ETHERNET_DEVICE(0x504B),
986 + /* required last entry */
990 MODULE_DEVICE_TABLE(pci, iegbe_pci_tbl);
992 -DEFINE_SPINLOCK(print_lock);
994 int iegbe_up(struct iegbe_adapter *adapter);
995 void iegbe_down(struct iegbe_adapter *adapter);
996 +void iegbe_reinit_locked(struct iegbe_adapter *adapter);
997 void iegbe_reset(struct iegbe_adapter *adapter);
998 int iegbe_set_spd_dplx(struct iegbe_adapter *adapter, uint16_t spddplx);
999 int iegbe_setup_all_tx_resources(struct iegbe_adapter *adapter);
1000 int iegbe_setup_all_rx_resources(struct iegbe_adapter *adapter);
1001 void iegbe_free_all_tx_resources(struct iegbe_adapter *adapter);
1002 void iegbe_free_all_rx_resources(struct iegbe_adapter *adapter);
1003 -int iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
1004 +static int iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
1005 struct iegbe_tx_ring *txdr);
1006 -int iegbe_setup_rx_resources(struct iegbe_adapter *adapter,
1007 +static int iegbe_setup_rx_resources(struct iegbe_adapter *adapter,
1008 struct iegbe_rx_ring *rxdr);
1009 -void iegbe_free_tx_resources(struct iegbe_adapter *adapter,
1010 +static void iegbe_free_tx_resources(struct iegbe_adapter *adapter,
1011 struct iegbe_tx_ring *tx_ring);
1012 -void iegbe_free_rx_resources(struct iegbe_adapter *adapter,
1013 +static void iegbe_free_rx_resources(struct iegbe_adapter *adapter,
1014 struct iegbe_rx_ring *rx_ring);
1015 void iegbe_update_stats(struct iegbe_adapter *adapter);
1017 static int iegbe_init_module(void);
1018 static void iegbe_exit_module(void);
1019 static int iegbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
1020 static void __devexit iegbe_remove(struct pci_dev *pdev);
1021 static int iegbe_alloc_queues(struct iegbe_adapter *adapter);
1022 -#ifdef CONFIG_E1000_MQ
1023 -static void iegbe_setup_queue_mapping(struct iegbe_adapter *adapter);
1025 static int iegbe_sw_init(struct iegbe_adapter *adapter);
1026 static int iegbe_open(struct net_device *netdev);
1027 static int iegbe_close(struct net_device *netdev);
1028 @@ -249,7 +114,8 @@ static void iegbe_clean_tx_ring(struct i
1029 struct iegbe_tx_ring *tx_ring);
1030 static void iegbe_clean_rx_ring(struct iegbe_adapter *adapter,
1031 struct iegbe_rx_ring *rx_ring);
1032 -static void iegbe_set_multi(struct net_device *netdev);
1034 +static void iegbe_set_rx_mode(struct net_device *netdev);
1035 static void iegbe_update_phy_info(unsigned long data);
1036 static void iegbe_watchdog(unsigned long data);
1037 static void iegbe_82547_tx_fifo_stall(unsigned long data);
1038 @@ -257,66 +123,46 @@ static int iegbe_xmit_frame(struct sk_bu
1039 static struct net_device_stats * iegbe_get_stats(struct net_device *netdev);
1040 static int iegbe_change_mtu(struct net_device *netdev, int new_mtu);
1041 static int iegbe_set_mac(struct net_device *netdev, void *p);
1042 -static irqreturn_t iegbe_intr(int irq, void *data, struct pt_regs *regs);
1043 +static irqreturn_t iegbe_intr(int irq, void *data);
1045 -void iegbe_tasklet(unsigned long);
1046 +static irqreturn_t iegbe_intr_msi(int irq, void *data);
1048 -#ifndef IEGBE_GBE_WORKAROUND
1049 -static boolean_t iegbe_clean_tx_irq(struct iegbe_adapter *adapter,
1050 +static bool iegbe_clean_tx_irq(struct iegbe_adapter *adapter,
1051 struct iegbe_tx_ring *tx_ring);
1054 -#ifdef CONFIG_E1000_NAPI
1055 -static int iegbe_clean(struct net_device *poll_dev, int *budget);
1056 -static boolean_t iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
1057 +static int iegbe_clean(struct napi_struct *napi, int budget);
1058 +static bool iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
1059 struct iegbe_rx_ring *rx_ring,
1060 int *work_done, int work_to_do);
1061 -static boolean_t iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
1062 +static bool iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
1063 struct iegbe_rx_ring *rx_ring,
1064 int *work_done, int work_to_do);
1066 -static boolean_t iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
1067 - struct iegbe_rx_ring *rx_ring);
1068 -static boolean_t iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
1069 - struct iegbe_rx_ring *rx_ring);
1072 -#ifdef IEGBE_GBE_WORKAROUND
1074 static void iegbe_alloc_rx_buffers(struct iegbe_adapter *adapter,
1075 struct iegbe_rx_ring *rx_ring,
1077 static void iegbe_alloc_rx_buffers_ps(struct iegbe_adapter *adapter,
1078 struct iegbe_rx_ring *rx_ring,
1081 -static void iegbe_alloc_rx_buffers(struct iegbe_adapter *adapter,
1082 - struct iegbe_rx_ring *rx_ring);
1083 -static void iegbe_alloc_rx_buffers_ps(struct iegbe_adapter *adapter,
1084 - struct iegbe_rx_ring *rx_ring);
1088 static int iegbe_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
1090 static int iegbe_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
1094 void set_ethtool_ops(struct net_device *netdev);
1095 extern int ethtool_ioctl(struct ifreq *ifr);
1096 static void iegbe_enter_82542_rst(struct iegbe_adapter *adapter);
1097 static void iegbe_leave_82542_rst(struct iegbe_adapter *adapter);
1098 static void iegbe_tx_timeout(struct net_device *dev);
1099 -static void iegbe_tx_timeout_task(struct net_device *dev);
1100 +static void iegbe_reset_task(struct work_struct *work);
1101 static void iegbe_smartspeed(struct iegbe_adapter *adapter);
1102 static inline int iegbe_82547_fifo_workaround(struct iegbe_adapter *adapter,
1103 - struct sk_buff *skb);
1104 + struct sk_buff *skb);
1106 -#ifdef NETIF_F_HW_VLAN_TX
1107 -static void iegbe_vlan_rx_register(struct net_device *netdev,
1108 - struct vlan_group *grp);
1109 +static void iegbe_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
1110 static void iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
1111 static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
1112 static void iegbe_restore_vlan(struct iegbe_adapter *adapter);
1115 static int iegbe_notify_reboot(struct notifier_block *,
1116 unsigned long event,
1117 @@ -331,15 +177,17 @@ static int iegbe_resume(struct pci_dev *
1118 static void iegbe_netpoll (struct net_device *netdev);
1121 -#ifdef CONFIG_E1000_MQ
1122 -/* for multiple Rx queues */
1123 +#define COPYBREAK_DEFAULT 256
1124 +static unsigned int copybreak __read_mostly = COPYBREAK_DEFAULT;
1125 +module_param(copybreak, uint, 0644);
1126 +MODULE_PARM_DESC(copybreak,
1127 + "Maximum size of packet that is copied to a new buffer on receive");
1128 void iegbe_rx_schedule(void *data);
1131 struct notifier_block iegbe_notifier_reboot = {
1132 - .notifier_call = iegbe_notify_reboot,
1135 + .notifier_call = iegbe_notify_reboot,
1140 /* Exported from other modules */
1141 @@ -347,14 +195,14 @@ struct notifier_block iegbe_notifier_reb
1142 extern void iegbe_check_options(struct iegbe_adapter *adapter);
1144 static struct pci_driver iegbe_driver = {
1145 - .name = iegbe_driver_name,
1146 - .id_table = iegbe_pci_tbl,
1147 - .probe = iegbe_probe,
1148 - .remove = __devexit_p(iegbe_remove),
1149 - /* Power Managment Hooks */
1150 + .name = iegbe_driver_name,
1151 + .id_table = iegbe_pci_tbl,
1152 + .probe = iegbe_probe,
1153 + .remove = __devexit_p(iegbe_remove),
1154 + /* Power Managment Hooks */
1156 - .suspend = iegbe_suspend,
1157 - .resume = iegbe_resume
1158 + .suspend = iegbe_suspend,
1159 + .resume = iegbe_resume
1163 @@ -364,46 +212,17 @@ MODULE_LICENSE("GPL");
1164 MODULE_VERSION(DRV_VERSION);
1166 static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE;
1167 -module_param(debug, int, 0);
1168 +module_param(debug, int, 0x0);
1169 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
1171 -static uint8_t gcu_suspend = 0;
1172 -static uint8_t gcu_resume = 0;
1173 +static uint8_t gcu_suspend = 0x0;
1174 +static uint8_t gcu_resume = 0x0;
1175 struct pci_dev *gcu = NULL;
1177 -unsigned long tasklet_data;
1178 -DECLARE_TASKLET(iegbe_reset_tasklet, iegbe_tasklet, (unsigned long) &tasklet_data);
1181 * iegbe_iegbe_tasklet -*
1183 -void iegbe_tasklet(unsigned long data)
1185 - char* err_msg = "TEST";
1186 - uint32_t *icr = (uint32_t*) data;
1187 - uint32_t gbe = *icr & 0x000000FF;
1188 - if( *icr & E1000_ICR_RX_DESC_FIFO_PAR) { /* 21 */
1189 - err_msg = "DMA Transmit Descriptor 2-bit ECC Error!";
1191 - if( *icr & E1000_ICR_TX_DESC_FIFO_PAR) { /* 20 */
1192 - err_msg = "DMA Receive Descriptor 2-bit ECC Error!";
1194 - if( *icr & E1000_ICR_PB) { /* 23 */
1195 - err_msg = "DMA Packet Buffer 2-bit ECC Error!";
1197 - if( *icr & E1000_ICR_CPP_TARGET) { /* 27 */
1198 - err_msg = "Statistic Register ECC Error!";
1200 - if( *icr & E1000_ICR_CPP_MASTER) {
1201 - err_msg = "CPP Error!";
1203 - spin_lock(&print_lock);
1204 - printk("IEGBE%d: System Reset due to: %s\n", gbe, err_msg);
1206 - spin_unlock(&print_lock);
1211 * iegbe_init_module - Driver Registration Routine
1213 @@ -411,21 +230,24 @@ void iegbe_tasklet(unsigned long data)
1214 * loaded. All it does is register with the PCI subsystem.
1218 -iegbe_init_module(void)
1219 +static int __init iegbe_init_module(void)
1224 printk(KERN_INFO "%s - version %s\n",
1225 - iegbe_driver_string, iegbe_driver_version);
1226 + iegbe_driver_string, iegbe_driver_version);
1228 - printk(KERN_INFO "%s\n", iegbe_copyright);
1229 + printk(KERN_INFO "%s\n", iegbe_copyright);
1231 - ret = pci_module_init(&iegbe_driver);
1233 - register_reboot_notifier(&iegbe_notifier_reboot);
1236 + ret = pci_register_driver(&iegbe_driver);
1237 + if (copybreak != COPYBREAK_DEFAULT) {
1238 + if (copybreak == 0)
1239 + printk(KERN_INFO "iegbe: copybreak disabled\n");
1241 + printk(KERN_INFO "iegbe: copybreak enabled for "
1242 + "packets <= %u bytes\n", copybreak);
1247 module_init(iegbe_init_module);
1248 @@ -437,29 +259,51 @@ module_init(iegbe_init_module);
1253 -iegbe_exit_module(void)
1254 +static void __exit iegbe_exit_module(void)
1257 - unregister_reboot_notifier(&iegbe_notifier_reboot);
1258 - pci_unregister_driver(&iegbe_driver);
1259 + pci_unregister_driver(&iegbe_driver);
1262 module_exit(iegbe_exit_module);
1264 +static int iegbe_request_irq(struct iegbe_adapter *adapter)
1266 + struct net_device *netdev = adapter->netdev;
1267 + irq_handler_t handler = iegbe_intr;
1268 + int irq_flags = IRQF_SHARED;
1270 + adapter->have_msi = !pci_enable_msi(adapter->pdev);
1271 + if (adapter->have_msi) {
1272 + handler = iegbe_intr_msi;
1275 + err = request_irq(adapter->pdev->irq, handler, irq_flags, netdev->name,
1278 + if (adapter->have_msi)
1279 + pci_disable_msi(adapter->pdev);
1280 + DPRINTK(PROBE, ERR,
1281 + "Unable to allocate interrupt Error: %d\n", err);
1285 +static void iegbe_free_irq(struct iegbe_adapter *adapter)
1287 + struct net_device *netdev = adapter->netdev;
1288 + free_irq(adapter->pdev->irq, netdev);
1289 + if (adapter->have_msi)
1290 + pci_disable_msi(adapter->pdev);
1293 * iegbe_irq_disable - Mask off interrupt generation on the NIC
1294 * @adapter: board private structure
1298 -iegbe_irq_disable(struct iegbe_adapter *adapter)
1299 +static void iegbe_irq_disable(struct iegbe_adapter *adapter)
1302 - atomic_inc(&adapter->irq_sem);
1303 - E1000_WRITE_REG(&adapter->hw, IMC, ~0);
1304 - E1000_WRITE_FLUSH(&adapter->hw);
1305 - synchronize_irq(adapter->pdev->irq);
1306 + E1000_WRITE_REG(&adapter->hw, IMC, ~0);
1307 + E1000_WRITE_FLUSH(&adapter->hw);
1308 + synchronize_irq(adapter->pdev->irq);
1312 @@ -470,244 +314,414 @@ iegbe_irq_disable(struct iegbe_adapter *
1314 iegbe_irq_enable(struct iegbe_adapter *adapter)
1317 - if(likely(atomic_dec_and_test(&adapter->irq_sem))) {
1318 - E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
1319 - E1000_WRITE_FLUSH(&adapter->hw);
1321 + E1000_WRITE_REG(&adapter->hw, IMS, IMS_ENABLE_MASK);
1322 + E1000_WRITE_FLUSH(&adapter->hw);
1324 -#ifdef NETIF_F_HW_VLAN_TX
1326 -iegbe_update_mng_vlan(struct iegbe_adapter *adapter)
1328 - struct net_device *netdev = adapter->netdev;
1329 - uint16_t vid = adapter->hw.mng_cookie.vlan_id;
1330 - uint16_t old_vid = adapter->mng_vlan_id;
1332 - if(adapter->vlgrp) {
1333 - if(!adapter->vlgrp->vlan_devices[vid]) {
1334 - if(adapter->hw.mng_cookie.status &
1335 - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
1336 - iegbe_vlan_rx_add_vid(netdev, vid);
1337 - adapter->mng_vlan_id = vid;
1339 - adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
1341 - if((old_vid != (uint16_t)E1000_MNG_VLAN_NONE) &&
1342 - (vid != old_vid) &&
1343 - !adapter->vlgrp->vlan_devices[old_vid]) {
1344 - iegbe_vlan_rx_kill_vid(netdev, old_vid);
1348 +static void iegbe_update_mng_vlan(struct iegbe_adapter *adapter)
1350 + struct iegbe_hw *hw = &adapter->hw;
1351 + struct net_device *netdev = adapter->netdev;
1352 + u16 vid = hw->mng_cookie.vlan_id;
1353 + u16 old_vid = adapter->mng_vlan_id;
1354 + if (adapter->vlgrp) {
1355 + if (!vlan_group_get_device(adapter->vlgrp, vid)) {
1356 + if (hw->mng_cookie.status &
1357 + E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) {
1358 + iegbe_vlan_rx_add_vid(netdev, vid);
1359 + adapter->mng_vlan_id = vid;
1361 + adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
1363 + if ((old_vid != (u16)E1000_MNG_VLAN_NONE) &&
1364 + (vid != old_vid) &&
1365 + !vlan_group_get_device(adapter->vlgrp, old_vid))
1366 + iegbe_vlan_rx_kill_vid(netdev, old_vid);
1368 + adapter->mng_vlan_id = vid;
1374 -iegbe_up(struct iegbe_adapter *adapter)
1376 + * iegbe_configure - configure the hardware for RX and TX
1377 + * @adapter = private board structure
1379 +static void iegbe_configure(struct iegbe_adapter *adapter)
1381 struct net_device *netdev = adapter->netdev;
1385 - /* hardware has been reset, we need to reload some things */
1387 - /* Reset the PHY if it was previously powered down */
1388 - if(adapter->hw.media_type == iegbe_media_type_copper
1389 - || (adapter->hw.media_type == iegbe_media_type_oem
1390 - && iegbe_oem_phy_is_copper(&adapter->hw))) {
1392 - iegbe_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
1393 - if(mii_reg & MII_CR_POWER_DOWN){
1394 - iegbe_phy_reset(&adapter->hw);
1399 - iegbe_set_multi(netdev);
1400 + iegbe_set_rx_mode(netdev);
1402 -#ifdef NETIF_F_HW_VLAN_TX
1403 iegbe_restore_vlan(adapter);
1406 iegbe_configure_tx(adapter);
1407 iegbe_setup_rctl(adapter);
1408 iegbe_configure_rx(adapter);
1409 + /* call E1000_DESC_UNUSED which always leaves
1410 + * at least 1 descriptor unused to make sure
1411 + * next_to_use != next_to_clean */
1412 + for (i = 0; i < adapter->num_rx_queues; i++) {
1413 + struct iegbe_rx_ring *ring = &adapter->rx_ring[i];
1414 + adapter->alloc_rx_buf(adapter, ring,
1415 + E1000_DESC_UNUSED(ring));
1418 -#ifdef IEGBE_GBE_WORKAROUND
1419 - for (i = 0; i < adapter->num_queues; i++)
1420 - adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i],
1421 - IEGBE_GBE_WORKAROUND_NUM_RX_DESCRIPTORS + 1);
1423 - for (i = 0; i < adapter->num_queues; i++)
1424 - adapter->alloc_rx_buf(adapter, &adapter->rx_ring[i]);
1426 + adapter->tx_queue_len = netdev->tx_queue_len;
1429 -#ifdef CONFIG_PCI_MSI
1430 - if(adapter->hw.mac_type > iegbe_82547_rev_2
1431 - || adapter->hw.mac_type == iegbe_icp_xxxx) {
1432 - adapter->have_msi = TRUE;
1433 - if((err = pci_enable_msi(adapter->pdev))) {
1434 - DPRINTK(PROBE, ERR,
1435 - "Unable to allocate MSI interrupt Error: %d\n", err);
1436 - adapter->have_msi = FALSE;
1439 - pci_read_config_word(adapter->pdev, PCI_COMMAND, &pci_cmd);
1440 - pci_write_config_word(adapter->pdev, PCI_COMMAND, pci_cmd | IEGBE_INTD_DISABLE);
1441 +int iegbe_up(struct iegbe_adapter *adapter)
1443 + /* hardware has been reset, we need to reload some things */
1444 + iegbe_configure(adapter);
1447 - if((err = request_irq(adapter->pdev->irq, &iegbe_intr,
1448 - SA_SHIRQ | SA_SAMPLE_RANDOM,
1449 - netdev->name, netdev))) {
1450 - DPRINTK(PROBE, ERR,
1451 - "Unable to allocate interrupt Error: %d\n", err);
1454 + clear_bit(__E1000_DOWN, &adapter->flags);
1456 - mod_timer(&adapter->watchdog_timer, jiffies);
1457 + napi_enable(&adapter->napi);
1459 -#ifdef CONFIG_E1000_NAPI
1460 - netif_poll_enable(netdev);
1462 iegbe_irq_enable(adapter);
1464 + adapter->hw.get_link_status = 0x1;
1469 -iegbe_down(struct iegbe_adapter *adapter)
1471 - struct net_device *netdev = adapter->netdev;
1473 - iegbe_irq_disable(adapter);
1474 -#ifdef CONFIG_E1000_MQ
1475 - while (atomic_read(&adapter->rx_sched_call_data.count) != 0) { };
1477 - free_irq(adapter->pdev->irq, netdev);
1478 -#ifdef CONFIG_PCI_MSI
1479 - if((adapter->hw.mac_type > iegbe_82547_rev_2
1480 - || adapter->hw.mac_type == iegbe_icp_xxxx)
1481 - && adapter->have_msi == TRUE) {
1482 - pci_disable_msi(adapter->pdev);
1485 - del_timer_sync(&adapter->tx_fifo_stall_timer);
1486 - del_timer_sync(&adapter->watchdog_timer);
1487 - del_timer_sync(&adapter->phy_info_timer);
1489 + * iegbe_power_up_phy - restore link in case the phy was powered down
1490 + * @adapter: address of board private structure
1492 + * The phy may be powered down to save power and turn off link when the
1493 + * driver is unloaded and wake on lan is not enabled (among others)
1494 + * *** this routine MUST be followed by a call to iegbe_reset ***
1498 -#ifdef CONFIG_E1000_NAPI
1499 - netif_poll_disable(netdev);
1501 - adapter->link_speed = 0;
1502 - adapter->link_duplex = 0;
1503 - netif_carrier_off(netdev);
1504 - netif_stop_queue(netdev);
1505 +void iegbe_power_up_phy(struct iegbe_adapter *adapter)
1507 + struct iegbe_hw *hw = &adapter->hw;
1510 - iegbe_reset(adapter);
1511 - iegbe_clean_all_tx_rings(adapter);
1512 - iegbe_clean_all_rx_rings(adapter);
1513 + /* Just clear the power down bit to wake the phy back up */
1514 + if (hw->media_type == iegbe_media_type_copper) {
1515 + /* according to the manual, the phy will retain its
1516 + * settings across a power-down/up cycle */
1517 + iegbe_read_phy_reg(hw, PHY_CTRL, &mii_reg);
1518 + mii_reg &= ~MII_CR_POWER_DOWN;
1519 + iegbe_write_phy_reg(hw, PHY_CTRL, mii_reg);
1523 - /* If WoL is not enabled and management mode is not IAMT
1524 - * or if WoL is not enabled and OEM PHY is copper based,
1525 - * power down the PHY so no link is implied when interface is down */
1527 - && ((adapter->hw.mac_type >= iegbe_82540
1528 - && adapter->hw.media_type == iegbe_media_type_copper
1529 - && !iegbe_check_mng_mode(&adapter->hw)
1530 - && !(E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN))
1531 - || (adapter->hw.media_type == iegbe_media_type_oem
1532 - && iegbe_oem_phy_is_copper(&adapter->hw)))){
1533 +static void iegbe_power_down_phy(struct iegbe_adapter *adapter)
1535 + struct iegbe_hw *hw = &adapter->hw;
1538 - iegbe_read_phy_reg(&adapter->hw, PHY_CTRL, &mii_reg);
1539 + /* Power down the PHY so no link is implied when interface is down *
1540 + * The PHY cannot be powered down if any of the following is true *
1541 + * (a) WoL is enabled
1542 + * (b) AMT is active
1543 + * (c) SoL/IDER session is active */
1544 + if (!adapter->wol && hw->mac_type >= iegbe_82540 &&
1545 + hw->media_type == iegbe_media_type_copper) {
1548 + switch (hw->mac_type) {
1551 + case iegbe_82545_rev_3:
1553 + case iegbe_82546_rev_3:
1555 + case iegbe_82541_rev_2:
1557 + case iegbe_82547_rev_2:
1558 + if (E1000_READ_REG(&adapter->hw, MANC) & E1000_MANC_SMBUS_EN)
1564 + if (iegbe_check_mng_mode(hw) ||
1565 + iegbe_check_phy_reset_block(hw))
1571 + iegbe_read_phy_reg(hw, PHY_CTRL, &mii_reg);
1572 mii_reg |= MII_CR_POWER_DOWN;
1573 - iegbe_write_phy_reg(&adapter->hw, PHY_CTRL, mii_reg);
1574 + iegbe_write_phy_reg(hw, PHY_CTRL, mii_reg);
1582 -iegbe_reset(struct iegbe_adapter *adapter)
1583 +void iegbe_down(struct iegbe_adapter *adapter)
1585 - struct net_device *netdev = adapter->netdev;
1586 - uint32_t pba, manc;
1587 - uint16_t fc_high_water_mark = E1000_FC_HIGH_DIFF;
1588 - uint16_t fc_low_water_mark = E1000_FC_LOW_DIFF;
1589 + struct net_device *netdev = adapter->netdev;
1591 + /* signal that we're down so the interrupt handler does not
1592 + * reschedule our watchdog timer */
1593 + set_bit(__E1000_DOWN, &adapter->flags);
1595 - /* Repartition Pba for greater than 9k mtu
1596 - * To take effect CTRL.RST is required.
1598 + napi_disable(&adapter->napi);
1600 - switch (adapter->hw.mac_type) {
1602 - case iegbe_82547_rev_2:
1603 - pba = E1000_PBA_30K;
1607 - pba = E1000_PBA_38K;
1610 - pba = E1000_PBA_12K;
1611 + iegbe_irq_disable(adapter);
1613 + del_timer_sync(&adapter->tx_fifo_stall_timer);
1614 + del_timer_sync(&adapter->watchdog_timer);
1615 + del_timer_sync(&adapter->phy_info_timer);
1617 + netdev->tx_queue_len = adapter->tx_queue_len;
1618 + adapter->link_speed = 0;
1619 + adapter->link_duplex = 0;
1620 + netif_carrier_off(netdev);
1621 + netif_stop_queue(netdev);
1623 + iegbe_reset(adapter);
1624 + iegbe_clean_all_tx_rings(adapter);
1625 + iegbe_clean_all_rx_rings(adapter);
1627 +void iegbe_reinit_locked(struct iegbe_adapter *adapter)
1629 + WARN_ON(in_interrupt());
1630 + while (test_and_set_bit(__E1000_RESETTING, &adapter->flags))
1632 + iegbe_down(adapter);
1633 + iegbe_up(adapter);
1634 + clear_bit(__E1000_RESETTING, &adapter->flags);
1637 +void iegbe_reset(struct iegbe_adapter *adapter)
1639 + struct iegbe_hw *hw = &adapter->hw;
1640 + u32 pba = 0, tx_space, min_tx_space, min_rx_space;
1641 + u16 fc_high_water_mark = E1000_FC_HIGH_DIFF;
1642 + bool legacy_pba_adjust = false;
1644 + /* Repartition Pba for greater than 9k mtu
1645 + * To take effect CTRL.RST is required.
1648 + switch (hw->mac_type) {
1649 + case iegbe_82542_rev2_0:
1650 + case iegbe_82542_rev2_1:
1655 + case iegbe_82541_rev_2:
1656 + case iegbe_icp_xxxx:
1657 + legacy_pba_adjust = true;
1658 + pba = E1000_PBA_48K;
1662 + case iegbe_82545_rev_3:
1664 + case iegbe_82546_rev_3:
1665 pba = E1000_PBA_48K;
1670 + case iegbe_82547_rev_2:
1671 + legacy_pba_adjust = true;
1672 + pba = E1000_PBA_30K;
1676 + case iegbe_undefined:
1677 + case iegbe_num_macs:
1681 + if (legacy_pba_adjust) {
1682 + if (adapter->netdev->mtu > E1000_RXBUFFER_8192)
1683 + pba -= 8; /* allocate more FIFO for Tx */
1684 + /* send an XOFF when there is enough space in the
1685 + * Rx FIFO to hold one extra full size Rx packet
1688 - if((adapter->hw.mac_type != iegbe_82573) &&
1689 - (adapter->rx_buffer_len > E1000_RXBUFFER_8192)) {
1690 - pba -= 0x8; /* allocate more FIFO for Tx */
1691 - /* send an XOFF when there is enough space in the
1692 - * Rx FIFO to hold one extra full size Rx packet
1694 - fc_high_water_mark = netdev->mtu + ENET_HEADER_SIZE +
1695 - ETHERNET_FCS_SIZE + 0x1;
1696 - fc_low_water_mark = fc_high_water_mark + 0x8;
1699 + if (hw->mac_type == iegbe_82547) {
1700 + adapter->tx_fifo_head = 0;
1701 + adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
1702 + adapter->tx_fifo_size =
1703 + (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT;
1704 + atomic_set(&adapter->tx_fifo_stall, 0);
1706 + } else if (hw->max_frame_size > MAXIMUM_ETHERNET_FRAME_SIZE) {
1707 + E1000_WRITE_REG(&adapter->hw, PBA, pba);
1709 + /* To maintain wire speed transmits, the Tx FIFO should be
1710 + * large enough to accomodate two full transmit packets,
1711 + * rounded up to the next 1KB and expressed in KB. Likewise,
1712 + * the Rx FIFO should be large enough to accomodate at least
1713 + * one full receive packet and is similarly rounded up and
1714 + * expressed in KB. */
1715 + pba = E1000_READ_REG(&adapter->hw, PBA);
1716 + /* upper 16 bits has Tx packet buffer allocation size in KB */
1717 + tx_space = pba >> 16;
1718 + /* lower 16 bits has Rx packet buffer allocation size in KB */
1720 + /* don't include ethernet FCS because hardware appends/strips */
1721 + min_rx_space = adapter->netdev->mtu + ENET_HEADER_SIZE +
1723 + min_tx_space = min_rx_space;
1724 + min_tx_space *= 2;
1725 + min_tx_space = ALIGN(min_tx_space, 1024);
1726 + min_tx_space >>= 10;
1727 + min_rx_space = ALIGN(min_rx_space, 1024);
1728 + min_rx_space >>= 10;
1730 + /* If current Tx allocation is less than the min Tx FIFO size,
1731 + * and the min Tx FIFO size is less than the current Rx FIFO
1732 + * allocation, take space away from current Rx allocation */
1733 + if (tx_space < min_tx_space &&
1734 + ((min_tx_space - tx_space) < pba)) {
1735 + pba = pba - (min_tx_space - tx_space);
1737 + /* PCI/PCIx hardware has PBA alignment constraints */
1738 + switch (hw->mac_type) {
1739 + case iegbe_82545 ... iegbe_82546_rev_3:
1740 + pba &= ~(E1000_PBA_8K - 1);
1746 - if(adapter->hw.mac_type == iegbe_82547) {
1747 - adapter->tx_fifo_head = 0;
1748 - adapter->tx_head_addr = pba << E1000_TX_HEAD_ADDR_SHIFT;
1749 - adapter->tx_fifo_size =
1750 - (E1000_PBA_40K - pba) << E1000_PBA_BYTES_SHIFT;
1751 - atomic_set(&adapter->tx_fifo_stall, 0);
1752 + /* if short on rx space, rx wins and must trump tx
1753 + * adjustment or use Early Receive if available */
1754 + if (pba < min_rx_space) {
1755 + switch (hw->mac_type) {
1757 + /* ERT enabled in iegbe_configure_rx */
1760 + pba = min_rx_space;
1767 E1000_WRITE_REG(&adapter->hw, PBA, pba);
1769 /* flow control settings */
1770 - adapter->hw.fc_high_water = (pba << E1000_PBA_BYTES_SHIFT) -
1771 - fc_high_water_mark;
1772 - adapter->hw.fc_low_water = (pba << E1000_PBA_BYTES_SHIFT) -
1773 - fc_low_water_mark;
1774 - adapter->hw.fc_pause_time = E1000_FC_PAUSE_TIME;
1775 - adapter->hw.fc_send_xon = 1;
1776 - adapter->hw.fc = adapter->hw.original_fc;
1777 + /* Set the FC high water mark to 90% of the FIFO size.
1778 + * Required to clear last 3 LSB */
1779 + fc_high_water_mark = ((pba * 9216)/10) & 0xFFF8;
1780 + /* We can't use 90% on small FIFOs because the remainder
1781 + * would be less than 1 full frame. In this case, we size
1782 + * it to allow at least a full frame above the high water
1784 + if (pba < E1000_PBA_16K)
1785 + fc_high_water_mark = (pba * 1024) - 1600;
1787 + hw->fc_high_water = fc_high_water_mark;
1788 + hw->fc_low_water = fc_high_water_mark - 8;
1789 + hw->fc_pause_time = E1000_FC_PAUSE_TIME;
1790 + hw->fc_send_xon = 1;
1791 + hw->fc = hw->original_fc;
1793 /* Allow time for pending master requests to run */
1794 - iegbe_reset_hw(&adapter->hw);
1795 - if(adapter->hw.mac_type >= iegbe_82544){
1796 + iegbe_reset_hw(hw);
1797 + if (hw->mac_type >= iegbe_82544)
1798 E1000_WRITE_REG(&adapter->hw, WUC, 0);
1800 - if(iegbe_init_hw(&adapter->hw)) {
1802 + if (iegbe_init_hw(hw))
1803 DPRINTK(PROBE, ERR, "Hardware Error\n");
1805 -#ifdef NETIF_F_HW_VLAN_TX
1806 iegbe_update_mng_vlan(adapter);
1809 + /* if (adapter->hwflags & HWFLAGS_PHY_PWR_BIT) { */
1810 + if (hw->mac_type >= iegbe_82544 &&
1811 + hw->mac_type <= iegbe_82547_rev_2 &&
1812 + hw->autoneg == 1 &&
1813 + hw->autoneg_advertised == ADVERTISE_1000_FULL) {
1814 + u32 ctrl = E1000_READ_REG(&adapter->hw, CTRL);
1815 + /* clear phy power management bit if we are in gig only mode,
1816 + * which if enabled will attempt negotiation to 100Mb, which
1817 + * can cause a loss of link at power off or driver unload */
1818 + ctrl &= ~E1000_CTRL_SWDPIN3;
1819 + E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
1822 /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */
1823 E1000_WRITE_REG(&adapter->hw, VET, ETHERNET_IEEE_VLAN_TYPE);
1825 - iegbe_reset_adaptive(&adapter->hw);
1826 - iegbe_phy_get_info(&adapter->hw, &adapter->phy_info);
1827 - if(adapter->en_mng_pt) {
1828 - manc = E1000_READ_REG(&adapter->hw, MANC);
1829 - manc |= (E1000_MANC_ARP_EN | E1000_MANC_EN_MNG2HOST);
1830 - E1000_WRITE_REG(&adapter->hw, MANC, manc);
1831 + iegbe_reset_adaptive(hw);
1832 + iegbe_phy_get_info(hw, &adapter->phy_info);
1834 + if (!adapter->smart_power_down &&
1835 + (hw->mac_type == iegbe_82571 ||
1836 + hw->mac_type == iegbe_82572)) {
1838 + /* speed up time to link by disabling smart power down, ignore
1839 + * the return value of this function because there is nothing
1840 + * different we would do if it failed */
1841 + iegbe_read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
1843 + phy_data &= ~IGP02E1000_PM_SPD;
1844 + iegbe_write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
1851 + * Dump the eeprom for users having checksum issues
1853 +static void iegbe_dump_eeprom(struct iegbe_adapter *adapter)
1855 + struct net_device *netdev = adapter->netdev;
1856 + struct ethtool_eeprom eeprom;
1857 + const struct ethtool_ops *ops = netdev->ethtool_ops;
1860 + u16 csum_old, csum_new = 0;
1862 + eeprom.len = ops->get_eeprom_len(netdev);
1863 + eeprom.offset = 0;
1865 + data = kmalloc(eeprom.len, GFP_KERNEL);
1867 + printk(KERN_ERR "Unable to allocate memory to dump EEPROM"
1872 + ops->get_eeprom(netdev, &eeprom, data);
1874 + csum_old = (data[EEPROM_CHECKSUM_REG * 2]) +
1875 + (data[EEPROM_CHECKSUM_REG * 2 + 1] << 8);
1876 + for (i = 0; i < EEPROM_CHECKSUM_REG * 2; i += 2)
1877 + csum_new += data[i] + (data[i + 1] << 8);
1878 + csum_new = EEPROM_SUM - csum_new;
1880 + printk(KERN_ERR "/*********************/\n");
1881 + printk(KERN_ERR "Current EEPROM Checksum : 0x%04x\n", csum_old);
1882 + printk(KERN_ERR "Calculated : 0x%04x\n", csum_new);
1884 + printk(KERN_ERR "Offset Values\n");
1885 + printk(KERN_ERR "======== ======\n");
1886 + print_hex_dump(KERN_ERR, "", DUMP_PREFIX_OFFSET, 16, 1, data, 128, 0);
1888 + printk(KERN_ERR "Include this output when contacting your support "
1890 + printk(KERN_ERR "This is not a software error! Something bad "
1891 + "happened to your hardware or\n");
1892 + printk(KERN_ERR "EEPROM image. Ignoring this "
1893 + "problem could result in further problems,\n");
1894 + printk(KERN_ERR "possibly loss of data, corruption or system hangs!\n");
1895 + printk(KERN_ERR "The MAC Address will be reset to 00:00:00:00:00:00, "
1896 + "which is invalid\n");
1897 + printk(KERN_ERR "and requires you to set the proper MAC "
1898 + "address manually before continuing\n");
1899 + printk(KERN_ERR "to enable this network device.\n");
1900 + printk(KERN_ERR "Please inspect the EEPROM dump and report the issue "
1901 + "to your hardware vendor\n");
1902 + printk(KERN_ERR "or Intel Customer Support.\n");
1903 + printk(KERN_ERR "/*********************/\n");
1909 @@ -721,184 +735,166 @@ iegbe_reset(struct iegbe_adapter *adapte
1910 * The OS initialization, configuring of the adapter private structure,
1911 * and a hardware reset occur.
1914 -static int __devinit
1915 -iegbe_probe(struct pci_dev *pdev,
1916 +static int __devinit iegbe_probe(struct pci_dev *pdev,
1917 const struct pci_device_id *ent)
1919 - struct net_device *netdev;
1920 - struct iegbe_adapter *adapter;
1921 - unsigned long mmio_start, mmio_len;
1922 - uint32_t ctrl_ext;
1924 + struct net_device *netdev;
1925 + struct iegbe_adapter *adapter;
1926 + struct iegbe_hw *hw;
1928 static int cards_found = 0;
1929 + int i, err, pci_using_dac;
1930 + u16 eeprom_data = 0;
1931 + u16 eeprom_apme_mask = E1000_EEPROM_APME;
1933 + DECLARE_MAC_BUF(mac);
1935 - int i, err, pci_using_dac;
1936 - uint16_t eeprom_data = 0;
1937 - uint16_t eeprom_apme_mask = E1000_EEPROM_APME;
1938 + bars = pci_select_bars(pdev, IORESOURCE_MEM);
1939 + err = pci_enable_device(pdev);
1944 - if((err = pci_enable_device(pdev))) {
1947 - if(!(err = pci_set_dma_mask(pdev, PCI_DMA_64BIT))) {
1948 + if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
1949 + !pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
1952 - if((err = pci_set_dma_mask(pdev, PCI_DMA_32BIT))) {
1953 - E1000_ERR("No usable DMA configuration, aborting\n");
1957 + err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
1959 + err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
1961 + E1000_ERR("No usable DMA configuration, "
1969 - if((err = pci_request_regions(pdev, iegbe_driver_name))) {
1972 - pci_set_master(pdev);
1974 - netdev = alloc_etherdev(sizeof(struct iegbe_adapter));
1977 - goto err_alloc_etherdev;
1979 + err = pci_request_selected_regions(pdev, bars, iegbe_driver_name);
1983 + pci_set_master(pdev);
1986 + netdev = alloc_etherdev(sizeof(struct iegbe_adapter));
1988 + goto err_alloc_etherdev;
1990 - SET_MODULE_OWNER(netdev);
1991 SET_NETDEV_DEV(netdev, &pdev->dev);
1993 - pci_set_drvdata(pdev, netdev);
1994 - adapter = netdev_priv(netdev);
1995 - adapter->netdev = netdev;
1996 - adapter->pdev = pdev;
1997 - adapter->hw.back = adapter;
1998 - adapter->msg_enable = (0x1 << debug) - 0x1;
2000 - mmio_start = pci_resource_start(pdev, BAR_0);
2001 - mmio_len = pci_resource_len(pdev, BAR_0);
2003 - adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
2004 - if(!adapter->hw.hw_addr) {
2009 - for(i = BAR_1; i <= BAR_5; i++) {
2010 - if(pci_resource_len(pdev, i) == 0) {
2013 - if(pci_resource_flags(pdev, i) & IORESOURCE_IO) {
2014 - adapter->hw.io_base = pci_resource_start(pdev, i);
2019 - netdev->open = &iegbe_open;
2020 - netdev->stop = &iegbe_close;
2021 - netdev->hard_start_xmit = &iegbe_xmit_frame;
2022 - netdev->get_stats = &iegbe_get_stats;
2023 - netdev->set_multicast_list = &iegbe_set_multi;
2024 + pci_set_drvdata(pdev, netdev);
2025 + adapter = netdev_priv(netdev);
2026 + adapter->netdev = netdev;
2027 + adapter->pdev = pdev;
2028 + adapter->msg_enable = (1 << debug) - 1;
2029 + adapter->bars = bars;
2031 + hw = &adapter->hw;
2032 + hw->back = adapter;
2035 + hw->hw_addr = ioremap(pci_resource_start(pdev, BAR_0),
2036 + pci_resource_len(pdev, BAR_0));
2040 + netdev->open = &iegbe_open;
2041 + netdev->stop = &iegbe_close;
2042 + netdev->hard_start_xmit = &iegbe_xmit_frame;
2043 + netdev->get_stats = &iegbe_get_stats;
2044 + netdev->set_rx_mode = &iegbe_set_rx_mode;
2045 netdev->set_mac_address = &iegbe_set_mac;
2046 - netdev->change_mtu = &iegbe_change_mtu;
2047 - netdev->do_ioctl = &iegbe_ioctl;
2048 + netdev->change_mtu = &iegbe_change_mtu;
2049 + netdev->do_ioctl = &iegbe_ioctl;
2050 set_ethtool_ops(netdev);
2051 -#ifdef HAVE_TX_TIMEOUT
2052 - netdev->tx_timeout = &iegbe_tx_timeout;
2053 - netdev->watchdog_timeo = 0x5 * HZ;
2055 -#ifdef CONFIG_E1000_NAPI
2056 - netdev->poll = &iegbe_clean;
2057 - netdev->weight = 0x40;
2059 -#ifdef NETIF_F_HW_VLAN_TX
2060 - netdev->vlan_rx_register = iegbe_vlan_rx_register;
2061 - netdev->vlan_rx_add_vid = iegbe_vlan_rx_add_vid;
2062 - netdev->vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid;
2064 + netdev->tx_timeout = &iegbe_tx_timeout;
2065 + netdev->watchdog_timeo = 5 * HZ;
2066 + netif_napi_add(netdev, &adapter->napi, iegbe_clean, 64);
2067 + netdev->vlan_rx_register = iegbe_vlan_rx_register;
2068 + netdev->vlan_rx_add_vid = iegbe_vlan_rx_add_vid;
2069 + netdev->vlan_rx_kill_vid = iegbe_vlan_rx_kill_vid;
2070 #ifdef CONFIG_NET_POLL_CONTROLLER
2071 - netdev->poll_controller = iegbe_netpoll;
2072 + netdev->poll_controller = iegbe_netpoll;
2074 - strcpy(netdev->name, pci_name(pdev));
2075 + strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
2077 - netdev->mem_start = mmio_start;
2078 - netdev->mem_end = mmio_start + mmio_len;
2079 - netdev->base_addr = adapter->hw.io_base;
2081 - adapter->bd_number = cards_found;
2082 + adapter->bd_number = cards_found;
2084 - /* setup the private structure */
2085 + /* setup the private structure */
2087 - if((err = iegbe_sw_init(adapter))) {
2090 - if((err = iegbe_check_phy_reset_block(&adapter->hw))) {
2091 - DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
2093 -#ifdef MAX_SKB_FRAGS
2094 - if(adapter->hw.mac_type >= iegbe_82543) {
2095 -#ifdef NETIF_F_HW_VLAN_TX
2096 - netdev->features = NETIF_F_SG |
2098 - NETIF_F_HW_VLAN_TX |
2099 - NETIF_F_HW_VLAN_RX |
2100 - NETIF_F_HW_VLAN_FILTER;
2102 - netdev->features = NETIF_F_SG | NETIF_F_HW_CSUM;
2105 + err = iegbe_sw_init(adapter);
2109 + if (iegbe_check_phy_reset_block(hw))
2110 + DPRINTK(PROBE, INFO, "PHY reset is blocked due to SOL/IDER session.\n");
2113 - if((adapter->hw.mac_type >= iegbe_82544) &&
2114 - (adapter->hw.mac_type != iegbe_82547)) {
2115 - netdev->features |= NETIF_F_TSO;
2117 -#ifdef NETIF_F_TSO_IPV6
2118 - if(adapter->hw.mac_type > iegbe_82547_rev_2) {
2119 - netdev->features |= NETIF_F_TSO_IPV6;
2123 - if(pci_using_dac) {
2124 - netdev->features |= NETIF_F_HIGHDMA;
2125 + if (hw->mac_type >= iegbe_82543) {
2126 + netdev->features = NETIF_F_SG |
2128 + NETIF_F_HW_VLAN_TX |
2129 + NETIF_F_HW_VLAN_RX |
2130 + NETIF_F_HW_VLAN_FILTER;
2133 -#ifdef NETIF_F_LLTX
2134 - netdev->features |= NETIF_F_LLTX;
2137 - adapter->en_mng_pt = iegbe_enable_mng_pass_thru(&adapter->hw);
2138 + if ((hw->mac_type >= iegbe_82544) &&
2139 + (hw->mac_type != iegbe_82547))
2140 + netdev->features |= NETIF_F_TSO;
2142 - /* before reading the EEPROM, reset the controller to
2143 - * put the device in a known good starting state */
2144 + if (hw->mac_type > iegbe_82547_rev_2)
2145 + netdev->features |= NETIF_F_TSO6;
2146 + if (pci_using_dac)
2147 + netdev->features |= NETIF_F_HIGHDMA;
2149 + netdev->features |= NETIF_F_LLTX;
2151 - iegbe_reset_hw(&adapter->hw);
2152 + adapter->en_mng_pt = iegbe_enable_mng_pass_thru(hw);
2154 - /* make sure the EEPROM is good */
2155 - if(iegbe_validate_eeprom_checksum(&adapter->hw) < 0) {
2156 - DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
2158 + /* initialize eeprom parameters */
2160 + if (iegbe_init_eeprom_params(hw)) {
2161 + E1000_ERR("EEPROM initialization failed\n");
2165 - /* copy the MAC address out of the EEPROM */
2166 + /* before reading the EEPROM, reset the controller to
2167 + * put the device in a known good starting state */
2169 - if(iegbe_read_mac_addr(&adapter->hw)) {
2170 - DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
2172 - memcpy(netdev->dev_addr, adapter->hw.mac_addr, netdev->addr_len);
2173 + iegbe_reset_hw(hw);
2175 - if(!is_valid_ether_addr(netdev->dev_addr)) {
2176 - DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
2180 + /* make sure the EEPROM is good */
2181 + if (iegbe_validate_eeprom_checksum(hw) < 0) {
2182 + DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n");
2183 + iegbe_dump_eeprom(adapter);
2185 + * set MAC address to all zeroes to invalidate and temporary
2186 + * disable this device for the user. This blocks regular
2187 + * traffic while still permitting ethtool ioctls from reaching
2188 + * the hardware as well as allowing the user to run the
2189 + * interface after manually setting a hw addr using
2190 + * `ip set address`
2192 + memset(hw->mac_addr, 0, netdev->addr_len);
2194 + /* copy the MAC address out of the EEPROM */
2195 + if (iegbe_read_mac_addr(hw))
2196 + DPRINTK(PROBE, ERR, "EEPROM Read Error\n");
2198 + /* don't block initalization here due to bad MAC address */
2199 + memcpy(netdev->dev_addr, hw->mac_addr, netdev->addr_len);
2200 + memcpy(netdev->perm_addr, hw->mac_addr, netdev->addr_len);
2202 - iegbe_read_part_num(&adapter->hw, &(adapter->part_num));
2203 + if (!is_valid_ether_addr(netdev->perm_addr))
2204 + DPRINTK(PROBE, ERR, "Invalid MAC Address\n");
2206 - iegbe_get_bus_info(&adapter->hw);
2207 + iegbe_get_bus_info(hw);
2209 init_timer(&adapter->tx_fifo_stall_timer);
2210 adapter->tx_fifo_stall_timer.function = &iegbe_82547_tx_fifo_stall;
2211 - adapter->tx_fifo_stall_timer.data = (unsigned long) adapter;
2212 + adapter->tx_fifo_stall_timer.data = (unsigned long)adapter;
2214 init_timer(&adapter->watchdog_timer);
2215 adapter->watchdog_timer.function = &iegbe_watchdog;
2216 @@ -906,75 +902,50 @@ iegbe_probe(struct pci_dev *pdev,
2218 init_timer(&adapter->phy_info_timer);
2219 adapter->phy_info_timer.function = &iegbe_update_phy_info;
2220 - adapter->phy_info_timer.data = (unsigned long) adapter;
2222 - INIT_WORK(&adapter->tx_timeout_task,
2223 - (void (*)(void *))iegbe_tx_timeout_task, netdev);
2224 + adapter->phy_info_timer.data = (unsigned long)adapter;
2226 - /* we're going to reset, so assume we have no link for now */
2228 - netif_carrier_off(netdev);
2229 - netif_stop_queue(netdev);
2230 + INIT_WORK(&adapter->reset_task, iegbe_reset_task);
2232 - iegbe_check_options(adapter);
2233 + iegbe_check_options(adapter);
2235 - /* Initial Wake on LAN setting
2236 - * If APM wake is enabled in the EEPROM,
2237 - * enable the ACPI Magic Packet filter
2239 + /* Initial Wake on LAN setting
2240 + * If APM wake is enabled in the EEPROM,
2241 + * enable the ACPI Magic Packet filter
2244 - switch(adapter->hw.mac_type) {
2245 - case iegbe_82542_rev2_0:
2246 - case iegbe_82542_rev2_1:
2250 - iegbe_read_eeprom(&adapter->hw,
2251 - EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data);
2252 - eeprom_apme_mask = E1000_EEPROM_82544_APM;
2254 + switch(adapter->hw.mac_type) {
2255 + case iegbe_82542_rev2_0:
2256 + case iegbe_82542_rev2_1:
2260 + iegbe_read_eeprom(&adapter->hw,
2261 + EEPROM_INIT_CONTROL2_REG, 1, &eeprom_data);
2262 + eeprom_apme_mask = E1000_EEPROM_82544_APM;
2264 case iegbe_icp_xxxx:
2265 - iegbe_read_eeprom(&adapter->hw,
2266 - EEPROM_INIT_CONTROL3_ICP_xxxx(adapter->bd_number),
2268 - eeprom_apme_mask = EEPROM_CTRL3_APME_ICP_xxxx;
2271 - case iegbe_82546_rev_3:
2272 - if((E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1)
2273 - && (adapter->hw.media_type == iegbe_media_type_copper)) {
2274 - iegbe_read_eeprom(&adapter->hw,
2275 - EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
2278 - /* Fall Through */
2280 - iegbe_read_eeprom(&adapter->hw,
2281 - EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
2284 + iegbe_read_eeprom(&adapter->hw,
2285 + EEPROM_INIT_CONTROL3_ICP_xxxx(adapter->bd_number),
2287 + eeprom_apme_mask = EEPROM_CTRL3_APME_ICP_xxxx;
2290 + case iegbe_82546_rev_3:
2291 + if((E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_FUNC_1)
2292 + && (adapter->hw.media_type == iegbe_media_type_copper)) {
2293 + iegbe_read_eeprom(&adapter->hw,
2294 + EEPROM_INIT_CONTROL3_PORT_B, 1, &eeprom_data);
2297 + /* Fall Through */
2299 + iegbe_read_eeprom(&adapter->hw,
2300 + EEPROM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
2303 if(eeprom_data & eeprom_apme_mask) {
2304 - adapter->wol |= E1000_WUFC_MAG;
2305 + adapter->wol |= E1000_WUFC_MAG;
2307 - /* reset the hardware with the new settings */
2308 - iegbe_reset(adapter);
2310 - /* Let firmware know the driver has taken over */
2311 - switch(adapter->hw.mac_type) {
2314 - ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
2315 - E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
2316 - ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
2319 - swsm = E1000_READ_REG(&adapter->hw, SWSM);
2320 - E1000_WRITE_REG(&adapter->hw, SWSM,
2321 - swsm | E1000_SWSM_DRV_LOAD);
2327 /* The ICP_xxxx device has multiple, duplicate interrupt
2328 * registers, so disable all but the first one
2329 @@ -987,24 +958,40 @@ iegbe_probe(struct pci_dev *pdev,
2330 E1000_WRITE_REG(&adapter->hw, IMC2, ~0UL);
2333 - strcpy(netdev->name, "eth%d");
2334 - if((err = register_netdev(netdev))) {
2335 - goto err_register;
2337 + iegbe_reset(adapter);
2338 + netif_carrier_off(netdev);
2339 + netif_stop_queue(netdev);
2340 + strcpy(netdev->name, "eth%d");
2341 + err = register_netdev(netdev);
2343 + goto err_register;
2345 DPRINTK(PROBE, INFO, "Intel(R) PRO/1000 Network Connection\n");
2355 - iounmap(adapter->hw.hw_addr);
2356 + if (!iegbe_check_phy_reset_block(hw))
2357 + iegbe_phy_hw_reset(hw);
2358 + if (hw->flash_address)
2359 + iounmap(hw->flash_address);
2360 + for (i = 0; i < adapter->num_rx_queues; i++)
2361 + dev_put(&adapter->polling_netdev[i]);
2362 + kfree(adapter->tx_ring);
2363 + kfree(adapter->rx_ring);
2364 + kfree(adapter->polling_netdev);
2366 + iounmap(hw->hw_addr);
2368 - free_netdev(netdev);
2369 + free_netdev(netdev);
2371 - pci_release_regions(pdev);
2373 + pci_release_selected_regions(pdev, bars);
2376 + pci_disable_device(pdev);
2381 @@ -1020,64 +1007,36 @@ err_alloc_etherdev:
2382 static void __devexit
2383 iegbe_remove(struct pci_dev *pdev)
2385 - struct net_device *netdev = pci_get_drvdata(pdev);
2386 - struct iegbe_adapter *adapter = netdev_priv(netdev);
2387 - uint32_t ctrl_ext;
2388 - uint32_t manc, swsm;
2389 -#ifdef CONFIG_E1000_NAPI
2393 - if(adapter->hw.mac_type >= iegbe_82540
2394 - && adapter->hw.mac_type != iegbe_icp_xxxx
2395 - && adapter->hw.media_type == iegbe_media_type_copper) {
2396 - manc = E1000_READ_REG(&adapter->hw, MANC);
2397 - if(manc & E1000_MANC_SMBUS_EN) {
2398 - manc |= E1000_MANC_ARP_EN;
2399 - E1000_WRITE_REG(&adapter->hw, MANC, manc);
2403 - switch(adapter->hw.mac_type) {
2406 - ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
2407 - E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
2408 - ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
2411 - swsm = E1000_READ_REG(&adapter->hw, SWSM);
2412 - E1000_WRITE_REG(&adapter->hw, SWSM,
2413 - swsm & ~E1000_SWSM_DRV_LOAD);
2419 + struct net_device *netdev = pci_get_drvdata(pdev);
2420 + struct iegbe_adapter *adapter = netdev_priv(netdev);
2424 + if(adapter->hw.mac_type >= iegbe_82540
2425 + && adapter->hw.mac_type != iegbe_icp_xxxx
2426 + && adapter->hw.media_type == iegbe_media_type_copper) {
2427 + manc = E1000_READ_REG(&adapter->hw, MANC);
2428 + if(manc & E1000_MANC_SMBUS_EN) {
2429 + manc |= E1000_MANC_ARP_EN;
2430 + E1000_WRITE_REG(&adapter->hw, MANC, manc);
2434 - unregister_netdev(netdev);
2435 -#ifdef CONFIG_E1000_NAPI
2436 - for (i = 0; i < adapter->num_queues; i++)
2437 + unregister_netdev(netdev);
2438 + for (i = 0x0; i < adapter->num_rx_queues; i++)
2439 dev_put(&adapter->polling_netdev[i]);
2442 if(!iegbe_check_phy_reset_block(&adapter->hw)) {
2443 - iegbe_phy_hw_reset(&adapter->hw);
2444 + iegbe_phy_hw_reset(&adapter->hw);
2446 - kfree(adapter->tx_ring);
2447 - kfree(adapter->rx_ring);
2448 -#ifdef CONFIG_E1000_NAPI
2449 - kfree(adapter->polling_netdev);
2451 + kfree(adapter->tx_ring);
2452 + kfree(adapter->rx_ring);
2453 + kfree(adapter->polling_netdev);
2455 - iounmap(adapter->hw.hw_addr);
2456 - pci_release_regions(pdev);
2457 + iounmap(adapter->hw.hw_addr);
2458 + pci_release_regions(pdev);
2460 -#ifdef CONFIG_E1000_MQ
2461 - free_percpu(adapter->cpu_netdev);
2462 - free_percpu(adapter->cpu_tx_ring);
2464 - free_netdev(netdev);
2465 + free_netdev(netdev);
2469 @@ -1092,118 +1051,78 @@ iegbe_remove(struct pci_dev *pdev)
2470 static int __devinit
2471 iegbe_sw_init(struct iegbe_adapter *adapter)
2473 - struct iegbe_hw *hw = &adapter->hw;
2474 - struct net_device *netdev = adapter->netdev;
2475 - struct pci_dev *pdev = adapter->pdev;
2476 -#ifdef CONFIG_E1000_NAPI
2479 + struct iegbe_hw *hw = &adapter->hw;
2480 + struct net_device *netdev = adapter->netdev;
2481 + struct pci_dev *pdev = adapter->pdev;
2484 - /* PCI config space info */
2485 + /* PCI config space info */
2487 - hw->vendor_id = pdev->vendor;
2488 - hw->device_id = pdev->device;
2489 - hw->subsystem_vendor_id = pdev->subsystem_vendor;
2490 - hw->subsystem_id = pdev->subsystem_device;
2491 + hw->vendor_id = pdev->vendor;
2492 + hw->device_id = pdev->device;
2493 + hw->subsystem_vendor_id = pdev->subsystem_vendor;
2494 + hw->subsystem_id = pdev->subsystem_device;
2496 - pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
2497 + pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
2499 - pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
2500 + pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
2502 - adapter->rx_buffer_len = E1000_RXBUFFER_2048;
2503 - adapter->rx_ps_bsize0 = E1000_RXBUFFER_256;
2504 - hw->max_frame_size = netdev->mtu +
2505 - ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
2506 - hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
2507 + adapter->rx_buffer_len = E1000_RXBUFFER_2048;
2508 + adapter->rx_ps_bsize0 = E1000_RXBUFFER_256;
2509 + hw->max_frame_size = netdev->mtu +
2510 + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
2511 + hw->min_frame_size = MINIMUM_ETHERNET_FRAME_SIZE;
2513 - /* identify the MAC */
2514 + /* identify the MAC */
2516 - if(iegbe_set_mac_type(hw)) {
2517 + if (iegbe_set_mac_type(hw)) {
2518 DPRINTK(PROBE, ERR, "Unknown MAC Type\n");
2522 - /* initialize eeprom parameters */
2524 - if(iegbe_init_eeprom_params(hw)) {
2525 - E1000_ERR("EEPROM initialization failed\n");
2529 - switch(hw->mac_type) {
2534 - case iegbe_82541_rev_2:
2535 - case iegbe_82547_rev_2:
2536 - hw->phy_init_script = 0x1;
2540 - iegbe_set_media_type(hw);
2541 + iegbe_set_media_type(hw);
2543 - hw->wait_autoneg_complete = FALSE;
2544 - hw->tbi_compatibility_en = TRUE;
2545 - hw->adaptive_ifs = TRUE;
2546 + hw->wait_autoneg_complete = FALSE;
2547 + hw->tbi_compatibility_en = TRUE;
2548 + hw->adaptive_ifs = TRUE;
2550 - /* Copper options */
2551 + /* Copper options */
2553 - if(hw->media_type == iegbe_media_type_copper
2554 + if(hw->media_type == iegbe_media_type_copper
2555 || (hw->media_type == iegbe_media_type_oem
2556 && iegbe_oem_phy_is_copper(&adapter->hw))) {
2557 - hw->mdix = AUTO_ALL_MODES;
2558 - hw->disable_polarity_correction = FALSE;
2559 - hw->master_slave = E1000_MASTER_SLAVE;
2561 + hw->mdix = AUTO_ALL_MODES;
2562 + hw->disable_polarity_correction = FALSE;
2563 + hw->master_slave = E1000_MASTER_SLAVE;
2566 -#ifdef CONFIG_E1000_MQ
2567 - /* Number of supported queues */
2568 - switch (hw->mac_type) {
2571 - adapter->num_queues = 0x2;
2574 - adapter->num_queues = 0x1;
2577 - adapter->num_queues = min(adapter->num_queues, num_online_cpus());
2579 - adapter->num_queues = 0x1;
2581 + adapter->num_tx_queues = 0x1;
2582 + adapter->num_rx_queues = 0x1;
2584 if (iegbe_alloc_queues(adapter)) {
2585 DPRINTK(PROBE, ERR, "Unable to allocate memory for queues\n");
2589 -#ifdef CONFIG_E1000_NAPI
2590 - for (i = 0; i < adapter->num_queues; i++) {
2591 + for (i = 0; i < adapter->num_rx_queues; i++) {
2592 adapter->polling_netdev[i].priv = adapter;
2593 - adapter->polling_netdev[i].poll = &iegbe_clean;
2594 - adapter->polling_netdev[i].weight = 0x40;
2595 dev_hold(&adapter->polling_netdev[i]);
2596 set_bit(__LINK_STATE_START, &adapter->polling_netdev[i].state);
2600 -#ifdef CONFIG_E1000_MQ
2601 - iegbe_setup_queue_mapping(adapter);
2603 + spin_lock_init(&adapter->tx_queue_lock);
2606 - * for ICP_XXXX style controllers, it is necessary to keep
2607 - * track of the last known state of the link to determine if
2608 - * the link experienced a change in state when iegbe_watchdog
2611 - adapter->hw.icp_xxxx_is_link_up = FALSE;
2612 + * for ICP_XXXX style controllers, it is necessary to keep
2613 + * track of the last known state of the link to determine if
2614 + * the link experienced a change in state when iegbe_watchdog
2617 + adapter->hw.icp_xxxx_is_link_up = FALSE;
2619 - atomic_set(&adapter->irq_sem, 1);
2620 - spin_lock_init(&adapter->stats_lock);
2621 + spin_lock_init(&adapter->stats_lock);
2624 + set_bit(__E1000_DOWN, &adapter->flags);
2629 @@ -1218,71 +1137,31 @@ iegbe_sw_init(struct iegbe_adapter *adap
2630 static int __devinit
2631 iegbe_alloc_queues(struct iegbe_adapter *adapter)
2635 - size = sizeof(struct iegbe_tx_ring) * adapter->num_queues;
2636 - adapter->tx_ring = kmalloc(size, GFP_KERNEL);
2637 - if (!adapter->tx_ring){
2639 + adapter->tx_ring = kcalloc(adapter->num_tx_queues,
2640 + sizeof(struct iegbe_tx_ring), GFP_KERNEL);
2641 + if (!adapter->tx_ring)
2644 - memset(adapter->tx_ring, 0, size);
2646 - size = sizeof(struct iegbe_rx_ring) * adapter->num_queues;
2647 - adapter->rx_ring = kmalloc(size, GFP_KERNEL);
2648 + adapter->rx_ring = kcalloc(adapter->num_rx_queues,
2649 + sizeof(struct iegbe_rx_ring), GFP_KERNEL);
2650 if (!adapter->rx_ring) {
2651 kfree(adapter->tx_ring);
2654 - memset(adapter->rx_ring, 0, size);
2656 -#ifdef CONFIG_E1000_NAPI
2657 - size = sizeof(struct net_device) * adapter->num_queues;
2658 - adapter->polling_netdev = kmalloc(size, GFP_KERNEL);
2659 + adapter->polling_netdev = kcalloc(adapter->num_rx_queues,
2660 + sizeof(struct net_device),
2662 if (!adapter->polling_netdev) {
2663 kfree(adapter->tx_ring);
2664 kfree(adapter->rx_ring);
2667 - memset(adapter->polling_netdev, 0, size);
2670 - return E1000_SUCCESS;
2673 -#ifdef CONFIG_E1000_MQ
2674 -static void __devinit
2675 -iegbe_setup_queue_mapping(struct iegbe_adapter *adapter)
2679 - adapter->rx_sched_call_data.func = iegbe_rx_schedule;
2680 - adapter->rx_sched_call_data.info = adapter->netdev;
2681 - cpus_clear(adapter->rx_sched_call_data.cpumask);
2683 - adapter->cpu_netdev = alloc_percpu(struct net_device *);
2684 - adapter->cpu_tx_ring = alloc_percpu(struct iegbe_tx_ring *);
2686 - lock_cpu_hotplug();
2688 - for_each_online_cpu(cpu) {
2689 - *per_cpu_ptr(adapter->cpu_tx_ring, cpu) =
2690 - &adapter->tx_ring[i % adapter->num_queues];
2691 - /* This is incomplete because we'd like to assign separate
2692 - * physical cpus to these netdev polling structures and
2693 - * avoid saturating a subset of cpus.
2695 - if (i < adapter->num_queues) {
2696 - *per_cpu_ptr(adapter->cpu_netdev, cpu) =
2697 - &adapter->polling_netdev[i];
2698 - adapter->cpu_for_queue[i] = cpu;
2700 - *per_cpu_ptr(adapter->cpu_netdev, cpu) = NULL;
2704 - unlock_cpu_hotplug();
2705 + return E1000_SUCCESS;
2710 * iegbe_open - Called when a network interface is made active
2711 @@ -1300,40 +1179,62 @@ iegbe_setup_queue_mapping(struct iegbe_a
2713 iegbe_open(struct net_device *netdev)
2715 - struct iegbe_adapter *adapter = netdev_priv(netdev);
2717 + struct iegbe_adapter *adapter = netdev_priv(netdev);
2718 + struct iegbe_hw *hw = &adapter->hw;
2722 + /* allocate receive descriptors */
2723 + if (test_bit(__E1000_TESTING, &adapter->flags))
2726 - /* allocate receive descriptors */
2727 + /* allocate transmit descriptors */
2728 + err = iegbe_setup_all_tx_resources(adapter);
2730 + goto err_setup_tx;
2732 - if ((err = iegbe_setup_all_rx_resources(adapter))) {
2733 + err = iegbe_setup_all_rx_resources(adapter);
2737 - /* allocate transmit descriptors */
2738 - if ((err = iegbe_setup_all_tx_resources(adapter))) {
2739 - goto err_setup_tx;
2741 - if ((err = iegbe_up(adapter))) {
2744 -#ifdef NETIF_F_HW_VLAN_TX
2745 - adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
2746 - if ((adapter->hw.mng_cookie.status &
2747 - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
2748 - iegbe_update_mng_vlan(adapter);
2752 - return E1000_SUCCESS;
2753 + iegbe_power_up_phy(adapter);
2754 + adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
2755 + if ((hw->mng_cookie.status &
2756 + E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
2757 + iegbe_update_mng_vlan(adapter);
2760 + /* before we allocate an interrupt, we must be ready to handle it.
2761 + * Setting DEBUG_SHIRQ in the kernel makes it fire an interrupt
2762 + * as soon as we call pci_request_irq, so we have to setup our
2763 + * clean_rx handler before we do so. */
2764 + iegbe_configure(adapter);
2765 + err = iegbe_request_irq(adapter);
2770 - iegbe_free_all_tx_resources(adapter);
2772 - iegbe_free_all_rx_resources(adapter);
2773 + /* From here on the code is the same as iegbe_up() */
2774 + clear_bit(__E1000_DOWN, &adapter->flags);
2776 + napi_enable(&adapter->napi);
2778 + iegbe_irq_enable(adapter);
2780 + netif_start_queue(netdev);
2782 + /* fire a link status change interrupt to start the watchdog */
2784 + return E1000_SUCCESS;
2787 + iegbe_power_down_phy(adapter);
2788 + iegbe_free_all_rx_resources(adapter);
2790 - iegbe_reset(adapter);
2791 + iegbe_free_all_tx_resources(adapter);
2793 + iegbe_reset(adapter);
2800 @@ -1348,22 +1249,25 @@ err_setup_rx:
2801 * hardware, and all transmit and receive resources are freed.
2805 -iegbe_close(struct net_device *netdev)
2806 +static int iegbe_close(struct net_device *netdev)
2808 - struct iegbe_adapter *adapter = netdev_priv(netdev);
2810 - iegbe_down(adapter);
2812 - iegbe_free_all_tx_resources(adapter);
2813 - iegbe_free_all_rx_resources(adapter);
2814 + struct iegbe_adapter *adapter = netdev_priv(netdev);
2815 + struct iegbe_hw *hw = &adapter->hw;
2817 -#ifdef NETIF_F_HW_VLAN_TX
2818 - if((adapter->hw.mng_cookie.status &
2819 - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) {
2820 + WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
2821 + iegbe_down(adapter);
2822 + iegbe_power_down_phy(adapter);
2823 + iegbe_free_irq(adapter);
2825 + iegbe_free_all_tx_resources(adapter);
2826 + iegbe_free_all_rx_resources(adapter);
2828 + if ((hw->mng_cookie.status &
2829 + E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
2830 + !(adapter->vlgrp &&
2831 + vlan_group_get_device(adapter->vlgrp, adapter->mng_vlan_id))) {
2832 iegbe_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
2838 @@ -1375,19 +1279,19 @@ iegbe_close(struct net_device *netdev)
2840 static inline boolean_t
2841 iegbe_check_64k_bound(struct iegbe_adapter *adapter,
2842 - void *start, unsigned long len)
2843 + void *start, unsigned long len)
2845 - unsigned long begin = (unsigned long) start;
2846 - unsigned long end = begin + len;
2847 + unsigned long begin = (unsigned long) start;
2848 + unsigned long end = begin + len;
2850 - /* First rev 82545 and 82546 need to not allow any memory
2851 - * write location to cross 64k boundary due to errata 23 */
2852 - if(adapter->hw.mac_type == iegbe_82545 ||
2853 - adapter->hw.mac_type == iegbe_82546) {
2854 - return ((begin ^ (end - 1)) >> 0x10) != 0 ? FALSE : TRUE;
2856 + /* First rev 82545 and 82546 need to not allow any memory
2857 + * write location to cross 64k boundary due to errata 23 */
2858 + if(adapter->hw.mac_type == iegbe_82545 ||
2859 + adapter->hw.mac_type == iegbe_82546) {
2860 + return ((begin ^ (end - 1)) >> 0x10) != 0x0 ? FALSE : TRUE;
2868 @@ -1398,102 +1302,98 @@ iegbe_check_64k_bound(struct iegbe_adapt
2869 * Return 0 on success, negative on failure
2873 -iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
2874 +static int iegbe_setup_tx_resources(struct iegbe_adapter *adapter,
2875 struct iegbe_tx_ring *txdr)
2877 - struct pci_dev *pdev = adapter->pdev;
2879 + struct pci_dev *pdev = adapter->pdev;
2882 - size = sizeof(struct iegbe_buffer) * txdr->count;
2883 - txdr->buffer_info = vmalloc(size);
2884 - if (!txdr->buffer_info) {
2885 - DPRINTK(PROBE, ERR,
2886 - "Unable to allocate memory for the transmit descriptor ring\n");
2889 + size = sizeof(struct iegbe_buffer) * txdr->count;
2890 + txdr->buffer_info = vmalloc(size);
2891 + if (!txdr->buffer_info) {
2892 + DPRINTK(PROBE, ERR,
2893 + "Unable to allocate memory for the transmit descriptor ring\n");
2896 memset(txdr->buffer_info, 0, size);
2897 - memset(&txdr->previous_buffer_info, 0, sizeof(struct iegbe_buffer));
2899 - /* round up to nearest 4K */
2900 + /* round up to nearest 4K */
2902 - txdr->size = txdr->count * sizeof(struct iegbe_tx_desc);
2903 - E1000_ROUNDUP(txdr->size, 0x1000);
2904 + txdr->size = txdr->count * sizeof(struct iegbe_tx_desc);
2905 + txdr->size = ALIGN(txdr->size, 4096);
2907 - txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
2908 - if (!txdr->desc) {
2909 + txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
2910 + if (!txdr->desc) {
2912 - vfree(txdr->buffer_info);
2913 - DPRINTK(PROBE, ERR,
2914 - "Unable to allocate memory for the transmit descriptor ring\n");
2918 - /* Fix for errata 23, can't cross 64kB boundary */
2919 - if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
2920 - void *olddesc = txdr->desc;
2921 - dma_addr_t olddma = txdr->dma;
2922 - DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes "
2923 - "at %p\n", txdr->size, txdr->desc);
2924 - /* Try again, without freeing the previous */
2925 - txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
2926 - /* Failed allocation, critical failure */
2927 - if (!txdr->desc) {
2928 - pci_free_consistent(pdev, txdr->size, olddesc, olddma);
2929 - goto setup_tx_desc_die;
2931 + vfree(txdr->buffer_info);
2932 + DPRINTK(PROBE, ERR,
2933 + "Unable to allocate memory for the transmit descriptor ring\n");
2937 + /* Fix for errata 23, can't cross 64kB boundary */
2938 + if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
2939 + void *olddesc = txdr->desc;
2940 + dma_addr_t olddma = txdr->dma;
2941 + DPRINTK(TX_ERR, ERR, "txdr align check failed: %u bytes "
2942 + "at %p\n", txdr->size, txdr->desc);
2943 + /* Try again, without freeing the previous */
2944 + txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma);
2945 + /* Failed allocation, critical failure */
2946 + if (!txdr->desc) {
2947 + pci_free_consistent(pdev, txdr->size, olddesc, olddma);
2948 + goto setup_tx_desc_die;
2951 - if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
2953 - pci_free_consistent(pdev, txdr->size, txdr->desc,
2955 - pci_free_consistent(pdev, txdr->size, olddesc, olddma);
2956 - DPRINTK(PROBE, ERR,
2957 - "Unable to allocate aligned memory "
2958 - "for the transmit descriptor ring\n");
2959 - vfree(txdr->buffer_info);
2962 - /* Free old allocation, new allocation was successful */
2963 - pci_free_consistent(pdev, txdr->size, olddesc, olddma);
2966 + if (!iegbe_check_64k_bound(adapter, txdr->desc, txdr->size)) {
2968 + pci_free_consistent(pdev, txdr->size, txdr->desc,
2970 + pci_free_consistent(pdev, txdr->size, olddesc, olddma);
2971 + DPRINTK(PROBE, ERR,
2972 + "Unable to allocate aligned memory "
2973 + "for the transmit descriptor ring\n");
2974 + vfree(txdr->buffer_info);
2977 + /* Free old allocation, new allocation was successful */
2978 + pci_free_consistent(pdev, txdr->size, olddesc, olddma);
2981 memset(txdr->desc, 0, txdr->size);
2983 txdr->next_to_use = 0;
2984 txdr->next_to_clean = 0;
2985 - spin_lock_init(&txdr->tx_lock);
2986 + spin_lock_init(&txdr->tx_lock);
2992 * iegbe_setup_all_tx_resources - wrapper to allocate Tx resources
2993 - * (Descriptors) for all queues
2994 + * (Descriptors) for all queues
2995 * @adapter: board private structure
2997 - * If this function returns with an error, then it's possible one or
2998 - * more of the rings is populated (while the rest are not). It is the
2999 - * callers duty to clean those orphaned rings.
3001 * Return 0 on success, negative on failure
3005 -iegbe_setup_all_tx_resources(struct iegbe_adapter *adapter)
3006 +int iegbe_setup_all_tx_resources(struct iegbe_adapter *adapter)
3010 - for (i = 0; i < adapter->num_queues; i++) {
3011 + for (i = 0; i < adapter->num_tx_queues; i++) {
3012 err = iegbe_setup_tx_resources(adapter, &adapter->tx_ring[i]);
3015 "Allocation for Tx Queue %u failed\n", i);
3016 + for (i-- ; i >= 0; i--)
3017 + iegbe_free_tx_resources(adapter,
3018 + &adapter->tx_ring[i]);
3028 @@ -1512,113 +1412,108 @@ iegbe_configure_tx(struct iegbe_adapter
3030 /* Setup the HW Tx Head and Tail descriptor pointers */
3032 - switch (adapter->num_queues) {
3033 + switch (adapter->num_tx_queues) {
3035 tdba = adapter->tx_ring[0x1].dma;
3036 tdlen = adapter->tx_ring[0x1].count *
3037 - sizeof(struct iegbe_tx_desc);
3038 - E1000_WRITE_REG(hw, TDBAL1, (tdba & 0x00000000ffffffffULL));
3039 + sizeof(struct iegbe_tx_desc);
3040 + E1000_WRITE_REG(hw, TDBAL1, (tdba & 0x00000000ffffffffULL));
3041 E1000_WRITE_REG(hw, TDBAH1, (tdba >> 0x20));
3042 - E1000_WRITE_REG(hw, TDLEN1, tdlen);
3043 - E1000_WRITE_REG(hw, TDH1, 0);
3044 - E1000_WRITE_REG(hw, TDT1, 0);
3045 + E1000_WRITE_REG(hw, TDLEN1, tdlen);
3046 + E1000_WRITE_REG(hw, TDH1, 0x0);
3047 + E1000_WRITE_REG(hw, TDT1, 0x0);
3048 adapter->tx_ring[0x1].tdh = E1000_TDH1;
3049 adapter->tx_ring[0x1].tdt = E1000_TDT1;
3050 - /* Fall Through */
3051 + /* Fall Through */
3054 - tdba = adapter->tx_ring[0].dma;
3055 - tdlen = adapter->tx_ring[0].count *
3056 - sizeof(struct iegbe_tx_desc);
3057 - E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
3059 + tdba = adapter->tx_ring[0x0].dma;
3060 + tdlen = adapter->tx_ring[0x0].count *
3061 + sizeof(struct iegbe_tx_desc);
3062 + E1000_WRITE_REG(hw, TDBAL, (tdba & 0x00000000ffffffffULL));
3063 E1000_WRITE_REG(hw, TDBAH, (tdba >> 0x20));
3064 - E1000_WRITE_REG(hw, TDLEN, tdlen);
3065 - E1000_WRITE_REG(hw, TDH, 0);
3066 - E1000_WRITE_REG(hw, TDT, 0);
3067 - adapter->tx_ring[0].tdh = E1000_TDH;
3068 - adapter->tx_ring[0].tdt = E1000_TDT;
3072 - /* Set the default values for the Tx Inter Packet Gap timer */
3074 - switch (hw->mac_type) {
3075 - case iegbe_82542_rev2_0:
3076 - case iegbe_82542_rev2_1:
3077 - tipg = DEFAULT_82542_TIPG_IPGT;
3078 - tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
3079 - tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
3082 - switch(hw->media_type) {
3083 - case iegbe_media_type_fiber:
3084 - case iegbe_media_type_internal_serdes:
3085 - tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
3087 - case iegbe_media_type_copper:
3088 - tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
3090 - case iegbe_media_type_oem:
3092 + E1000_WRITE_REG(hw, TDLEN, tdlen);
3093 + E1000_WRITE_REG(hw, TDH, 0x0);
3094 + E1000_WRITE_REG(hw, TDT, 0x0);
3095 + adapter->tx_ring[0x0].tdh = E1000_TDH;
3096 + adapter->tx_ring[0x0].tdt = E1000_TDT;
3100 + /* Set the default values for the Tx Inter Packet Gap timer */
3102 + switch (hw->mac_type) {
3103 + case iegbe_82542_rev2_0:
3104 + case iegbe_82542_rev2_1:
3105 + tipg = DEFAULT_82542_TIPG_IPGT;
3106 + tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
3107 + tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
3110 + switch(hw->media_type) {
3111 + case iegbe_media_type_fiber:
3112 + case iegbe_media_type_internal_serdes:
3113 + tipg = DEFAULT_82543_TIPG_IPGT_FIBER;
3115 + case iegbe_media_type_copper:
3116 + tipg = DEFAULT_82543_TIPG_IPGT_COPPER;
3118 + case iegbe_media_type_oem:
3120 tipg = (0xFFFFFFFFUL >> (sizeof(tipg)*0x8 -
3121 E1000_TIPG_IPGR1_SHIFT))
3122 - & iegbe_oem_get_tipg(&adapter->hw);
3125 - tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
3126 - tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
3128 - E1000_WRITE_REG(hw, TIPG, tipg);
3129 + & iegbe_oem_get_tipg(&adapter->hw);
3132 + tipg |= DEFAULT_82543_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT;
3133 + tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT;
3135 + E1000_WRITE_REG(hw, TIPG, tipg);
3137 - /* Set the Tx Interrupt Delay register */
3138 + /* Set the Tx Interrupt Delay register */
3140 - E1000_WRITE_REG(hw, TIDV, adapter->tx_int_delay);
3141 + E1000_WRITE_REG(hw, TIDV, adapter->tx_int_delay);
3142 if (hw->mac_type >= iegbe_82540) {
3143 - E1000_WRITE_REG(hw, TADV, adapter->tx_abs_int_delay);
3144 + E1000_WRITE_REG(hw, TADV, adapter->tx_abs_int_delay);
3146 - /* Program the Transmit Control Register */
3147 + /* Program the Transmit Control Register */
3149 - tctl = E1000_READ_REG(hw, TCTL);
3150 + tctl = E1000_READ_REG(hw, TCTL);
3152 - tctl &= ~E1000_TCTL_CT;
3153 - tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | E1000_TCTL_RTLC |
3154 - (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT);
3155 + tctl &= ~E1000_TCTL_CT;
3156 + tctl |= E1000_TCTL_EN | E1000_TCTL_PSP | E1000_TCTL_RTLC |
3157 + (E1000_COLLISION_THRESHOLD << E1000_CT_SHIFT);
3159 - E1000_WRITE_REG(hw, TCTL, tctl);
3160 + E1000_WRITE_REG(hw, TCTL, tctl);
3162 - if (hw->mac_type == iegbe_82571 || hw->mac_type == iegbe_82572) {
3163 - tarc = E1000_READ_REG(hw, TARC0);
3164 + if (hw->mac_type == iegbe_82571 || hw->mac_type == iegbe_82572) {
3165 + tarc = E1000_READ_REG(hw, TARC0);
3166 tarc |= ((0x1 << 0x19) | (0x1 << 0x15));
3167 - E1000_WRITE_REG(hw, TARC0, tarc);
3168 - tarc = E1000_READ_REG(hw, TARC1);
3169 + E1000_WRITE_REG(hw, TARC0, tarc);
3170 + tarc = E1000_READ_REG(hw, TARC1);
3171 tarc |= (0x1 << 0x19);
3172 if (tctl & E1000_TCTL_MULR) {
3173 tarc &= ~(0x1 << 0x1c);
3175 tarc |= (0x1 << 0x1c);
3177 - E1000_WRITE_REG(hw, TARC1, tarc);
3179 + E1000_WRITE_REG(hw, TARC1, tarc);
3182 - iegbe_config_collision_dist(hw);
3183 + iegbe_config_collision_dist(hw);
3185 - /* Setup Transmit Descriptor Settings for eop descriptor */
3186 - adapter->txd_cmd = E1000_TXD_CMD_IDE | E1000_TXD_CMD_EOP |
3187 - E1000_TXD_CMD_IFCS;
3188 + /* Setup Transmit Descriptor Settings for eop descriptor */
3189 + adapter->txd_cmd = E1000_TXD_CMD_IDE | E1000_TXD_CMD_EOP |
3190 + E1000_TXD_CMD_IFCS;
3192 if (hw->mac_type < iegbe_82543) {
3193 - adapter->txd_cmd |= E1000_TXD_CMD_RPS;
3194 + adapter->txd_cmd |= E1000_TXD_CMD_RPS;
3196 -#ifdef IEGBE_GBE_WORKAROUND
3197 - /* Disable the RS bit in the Tx descriptor */
3198 - adapter->txd_cmd &= ~E1000_TXD_CMD_RS;
3200 - adapter->txd_cmd |= E1000_TXD_CMD_RS;
3202 + adapter->txd_cmd |= E1000_TXD_CMD_RS;
3204 - /* Cache if we're 82544 running in PCI-X because we'll
3205 - * need this to apply a workaround later in the send path. */
3206 - if (hw->mac_type == iegbe_82544 &&
3207 + /* Cache if we're 82544 running in PCI-X because we'll
3208 + * need this to apply a workaround later in the send path. */
3209 + if (hw->mac_type == iegbe_82544 &&
3210 hw->bus_type == iegbe_bus_type_pcix) {
3211 adapter->pcix_82544 = 0x1;
3213 @@ -1632,96 +1527,95 @@ iegbe_configure_tx(struct iegbe_adapter
3214 * Returns 0 on success, negative on failure
3218 -iegbe_setup_rx_resources(struct iegbe_adapter *adapter,
3219 +static int iegbe_setup_rx_resources(struct iegbe_adapter *adapter,
3220 struct iegbe_rx_ring *rxdr)
3222 - struct pci_dev *pdev = adapter->pdev;
3223 - int size, desc_len;
3225 - size = sizeof(struct iegbe_buffer) * rxdr->count;
3226 - rxdr->buffer_info = vmalloc(size);
3227 - if (!rxdr->buffer_info) {
3228 - DPRINTK(PROBE, ERR,
3229 - "Unable to allocate memory for the receive descriptor ring\n");
3232 - memset(rxdr->buffer_info, 0, size);
3234 - size = sizeof(struct iegbe_ps_page) * rxdr->count;
3235 - rxdr->ps_page = kmalloc(size, GFP_KERNEL);
3236 - if (!rxdr->ps_page) {
3237 - vfree(rxdr->buffer_info);
3238 - DPRINTK(PROBE, ERR,
3239 - "Unable to allocate memory for the receive descriptor ring\n");
3242 - memset(rxdr->ps_page, 0, size);
3244 - size = sizeof(struct iegbe_ps_page_dma) * rxdr->count;
3245 - rxdr->ps_page_dma = kmalloc(size, GFP_KERNEL);
3246 - if (!rxdr->ps_page_dma) {
3247 - vfree(rxdr->buffer_info);
3248 - kfree(rxdr->ps_page);
3249 - DPRINTK(PROBE, ERR,
3250 - "Unable to allocate memory for the receive descriptor ring\n");
3253 - memset(rxdr->ps_page_dma, 0, size);
3254 + struct iegbe_hw *hw = &adapter->hw;
3255 + struct pci_dev *pdev = adapter->pdev;
3256 + int size, desc_len;
3258 - if (adapter->hw.mac_type <= iegbe_82547_rev_2) {
3259 - desc_len = sizeof(struct iegbe_rx_desc);
3261 - desc_len = sizeof(union iegbe_rx_desc_packet_split);
3262 + size = sizeof(struct iegbe_buffer) * rxdr->count;
3263 + rxdr->buffer_info = vmalloc(size);
3264 + if (!rxdr->buffer_info) {
3265 + DPRINTK(PROBE, ERR,
3266 + "Unable to allocate memory for the receive descriptor ring\n");
3269 - /* Round up to nearest 4K */
3271 - rxdr->size = rxdr->count * desc_len;
3272 - E1000_ROUNDUP(rxdr->size, 0x1000);
3274 - rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
3275 + memset(rxdr->buffer_info, 0, size);
3277 - if (!rxdr->desc) {
3278 - DPRINTK(PROBE, ERR,
3279 - "Unable to allocate memory for the receive descriptor ring\n");
3280 + rxdr->ps_page = kcalloc(rxdr->count, sizeof(struct iegbe_ps_page),
3282 + if (!rxdr->ps_page) {
3283 + vfree(rxdr->buffer_info);
3284 + DPRINTK(PROBE, ERR,
3285 + "Unable to allocate memory for the receive descriptor ring\n");
3289 + rxdr->ps_page_dma = kcalloc(rxdr->count,
3290 + sizeof(struct iegbe_ps_page_dma),
3292 + if (!rxdr->ps_page_dma) {
3293 + vfree(rxdr->buffer_info);
3294 + kfree(rxdr->ps_page);
3295 + DPRINTK(PROBE, ERR,
3296 + "Unable to allocate memory for the receive descriptor ring\n");
3300 + if (hw->mac_type <= iegbe_82547_rev_2)
3301 + desc_len = sizeof(struct iegbe_rx_desc);
3303 + desc_len = sizeof(union iegbe_rx_desc_packet_split);
3305 + /* Round up to nearest 4K */
3307 + rxdr->size = rxdr->count * desc_len;
3308 + rxdr->size = ALIGN(rxdr->size, 4096);
3310 + rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
3312 + if (!rxdr->desc) {
3313 + DPRINTK(PROBE, ERR,
3314 + "Unable to allocate memory for the receive descriptor ring\n");
3316 - vfree(rxdr->buffer_info);
3317 - kfree(rxdr->ps_page);
3318 - kfree(rxdr->ps_page_dma);
3322 - /* Fix for errata 23, can't cross 64kB boundary */
3323 - if (!iegbe_check_64k_bound(adapter, rxdr->desc, rxdr->size)) {
3324 - void *olddesc = rxdr->desc;
3325 - dma_addr_t olddma = rxdr->dma;
3326 - DPRINTK(RX_ERR, ERR, "rxdr align check failed: %u bytes "
3327 - "at %p\n", rxdr->size, rxdr->desc);
3328 - /* Try again, without freeing the previous */
3329 - rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
3330 - /* Failed allocation, critical failure */
3331 - if (!rxdr->desc) {
3332 - pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
3333 - DPRINTK(PROBE, ERR,
3334 - "Unable to allocate memory "
3335 - "for the receive descriptor ring\n");
3336 - goto setup_rx_desc_die;
3338 + vfree(rxdr->buffer_info);
3339 + kfree(rxdr->ps_page);
3340 + kfree(rxdr->ps_page_dma);
3344 + /* Fix for errata 23, can't cross 64kB boundary */
3345 + if (!iegbe_check_64k_bound(adapter, rxdr->desc, rxdr->size)) {
3346 + void *olddesc = rxdr->desc;
3347 + dma_addr_t olddma = rxdr->dma;
3348 + DPRINTK(RX_ERR, ERR, "rxdr align check failed: %u bytes "
3349 + "at %p\n", rxdr->size, rxdr->desc);
3350 + /* Try again, without freeing the previous */
3351 + rxdr->desc = pci_alloc_consistent(pdev, rxdr->size, &rxdr->dma);
3352 + /* Failed allocation, critical failure */
3353 + if (!rxdr->desc) {
3354 + pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
3355 + DPRINTK(PROBE, ERR,
3356 + "Unable to allocate memory "
3357 + "for the receive descriptor ring\n");
3358 + goto setup_rx_desc_die;
3361 - if (!iegbe_check_64k_bound(adapter, rxdr->desc, rxdr->size)) {
3363 - pci_free_consistent(pdev, rxdr->size, rxdr->desc,
3365 - pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
3366 - DPRINTK(PROBE, ERR,
3367 - "Unable to allocate aligned memory "
3368 - "for the receive descriptor ring\n");
3369 - goto setup_rx_desc_die;
3371 - /* Free old allocation, new allocation was successful */
3372 - pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
3375 + if (!iegbe_check_64k_bound(adapter, rxdr->desc, rxdr->size)) {
3377 + pci_free_consistent(pdev, rxdr->size, rxdr->desc,
3379 + pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
3380 + DPRINTK(PROBE, ERR,
3381 + "Unable to allocate aligned memory "
3382 + "for the receive descriptor ring\n");
3383 + goto setup_rx_desc_die;
3385 + /* Free old allocation, new allocation was successful */
3386 + pci_free_consistent(pdev, rxdr->size, olddesc, olddma);
3389 memset(rxdr->desc, 0, rxdr->size);
3391 rxdr->next_to_clean = 0;
3392 @@ -1732,7 +1626,7 @@ setup_rx_desc_die:
3395 * iegbe_setup_all_rx_resources - wrapper to allocate Rx resources
3396 - * (Descriptors) for all queues
3397 + * (Descriptors) for all queues
3398 * @adapter: board private structure
3400 * If this function returns with an error, then it's possible one or
3401 @@ -1742,21 +1636,23 @@ setup_rx_desc_die:
3402 * Return 0 on success, negative on failure
3406 -iegbe_setup_all_rx_resources(struct iegbe_adapter *adapter)
3407 +int iegbe_setup_all_rx_resources(struct iegbe_adapter *adapter)
3411 - for (i = 0; i < adapter->num_queues; i++) {
3412 + for (i = 0; i < adapter->num_rx_queues; i++) {
3413 err = iegbe_setup_rx_resources(adapter, &adapter->rx_ring[i]);
3416 "Allocation for Rx Queue %u failed\n", i);
3417 + for (i-- ; i >= 0; i--)
3418 + iegbe_free_rx_resources(adapter,
3419 + &adapter->rx_ring[i]);
3429 @@ -1765,105 +1661,104 @@ iegbe_setup_all_rx_resources(struct iegb
3431 #define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \
3432 (((S) & (PAGE_SIZE - 1)) ? 1 : 0))
3434 -iegbe_setup_rctl(struct iegbe_adapter *adapter)
3435 +static void iegbe_setup_rctl(struct iegbe_adapter *adapter)
3437 - uint32_t rctl, rfctl;
3438 - uint32_t psrctl = 0;
3439 -#ifdef CONFIG_E1000_PACKET_SPLIT
3440 - uint32_t pages = 0;
3443 - rctl = E1000_READ_REG(&adapter->hw, RCTL);
3445 - rctl &= ~(0x3 << E1000_RCTL_MO_SHIFT);
3447 - rctl |= E1000_RCTL_EN | E1000_RCTL_BAM |
3448 - E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
3449 - (adapter->hw.mc_filter_type << E1000_RCTL_MO_SHIFT);
3451 - if(adapter->hw.tbi_compatibility_on == 0x1) {
3452 - rctl |= E1000_RCTL_SBP;
3454 - rctl &= ~E1000_RCTL_SBP;
3456 - if(adapter->netdev->mtu <= ETH_DATA_LEN) {
3457 - rctl &= ~E1000_RCTL_LPE;
3459 - rctl |= E1000_RCTL_LPE;
3461 - /* Setup buffer sizes */
3462 - if(adapter->hw.mac_type >= iegbe_82571) {
3463 - /* We can now specify buffers in 1K increments.
3464 - * BSIZE and BSEX are ignored in this case. */
3465 - rctl |= adapter->rx_buffer_len << 0x11;
3467 - rctl &= ~E1000_RCTL_SZ_4096;
3468 - rctl |= E1000_RCTL_BSEX;
3469 - switch (adapter->rx_buffer_len) {
3470 - case E1000_RXBUFFER_2048:
3472 - rctl |= E1000_RCTL_SZ_2048;
3473 + struct iegbe_hw *hw = &adapter->hw;
3476 +#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
3480 + rctl = E1000_READ_REG(&adapter->hw, RCTL);
3482 + rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
3484 + rctl |= E1000_RCTL_EN | E1000_RCTL_BAM |
3485 + E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
3486 + (hw->mc_filter_type << E1000_RCTL_MO_SHIFT);
3488 + if (hw->tbi_compatibility_on == 1)
3489 + rctl |= E1000_RCTL_SBP;
3491 + rctl &= ~E1000_RCTL_SBP;
3493 + if (adapter->netdev->mtu <= ETH_DATA_LEN)
3494 + rctl &= ~E1000_RCTL_LPE;
3496 + rctl |= E1000_RCTL_LPE;
3498 + /* Setup buffer sizes */
3499 + /* We can now specify buffers in 1K increments.
3500 + * BSIZE and BSEX are ignored in this case. */
3501 + rctl &= ~E1000_RCTL_SZ_4096;
3502 + rctl |= E1000_RCTL_BSEX;
3503 + switch (adapter->rx_buffer_len) {
3504 + case E1000_RXBUFFER_256:
3505 + rctl |= E1000_RCTL_SZ_256;
3506 rctl &= ~E1000_RCTL_BSEX;
3508 - case E1000_RXBUFFER_4096:
3509 - rctl |= E1000_RCTL_SZ_4096;
3511 - case E1000_RXBUFFER_8192:
3512 - rctl |= E1000_RCTL_SZ_8192;
3514 - case E1000_RXBUFFER_16384:
3515 - rctl |= E1000_RCTL_SZ_16384;
3519 + case E1000_RXBUFFER_2048:
3521 + rctl |= E1000_RCTL_SZ_2048;
3522 + rctl &= ~E1000_RCTL_BSEX;
3524 + case E1000_RXBUFFER_4096:
3525 + rctl |= E1000_RCTL_SZ_4096;
3527 + case E1000_RXBUFFER_8192:
3528 + rctl |= E1000_RCTL_SZ_8192;
3530 + case E1000_RXBUFFER_16384:
3531 + rctl |= E1000_RCTL_SZ_16384;
3535 -#ifdef CONFIG_E1000_PACKET_SPLIT
3536 - /* 82571 and greater support packet-split where the protocol
3537 - * header is placed in skb->data and the packet data is
3538 - * placed in pages hanging off of skb_shinfo(skb)->nr_frags.
3539 - * In the case of a non-split, skb->data is linearly filled,
3540 - * followed by the page buffers. Therefore, skb->data is
3541 - * sized to hold the largest protocol header.
3543 - pages = PAGE_USE_COUNT(adapter->netdev->mtu);
3544 - if ((adapter->hw.mac_type > iegbe_82547_rev_2) && (pages <= 0x3) &&
3545 - PAGE_SIZE <= 0x4000) {
3546 - adapter->rx_ps_pages = pages;
3548 +#ifndef CONFIG_E1000_DISABLE_PACKET_SPLIT
3549 + /* 82571 and greater support packet-split where the protocol
3550 + * header is placed in skb->data and the packet data is
3551 + * placed in pages hanging off of skb_shinfo(skb)->nr_frags.
3552 + * In the case of a non-split, skb->data is linearly filled,
3553 + * followed by the page buffers. Therefore, skb->data is
3554 + * sized to hold the largest protocol header.
3556 + pages = PAGE_USE_COUNT(adapter->netdev->mtu);
3557 + if ((hw->mac_type >= iegbe_82571) && (pages <= 3) &&
3558 + PAGE_SIZE <= 16384 && (rctl & E1000_RCTL_LPE))
3559 + adapter->rx_ps_pages = pages;
3561 adapter->rx_ps_pages = 0;
3564 - if (adapter->rx_ps_pages) {
3565 - /* Configure extra packet-split registers */
3566 - rfctl = E1000_READ_REG(&adapter->hw, RFCTL);
3567 - rfctl |= E1000_RFCTL_EXTEN;
3568 - /* disable IPv6 packet split support */
3569 - rfctl |= E1000_RFCTL_IPV6_DIS;
3570 - E1000_WRITE_REG(&adapter->hw, RFCTL, rfctl);
3572 - rctl |= E1000_RCTL_DTYP_PS | E1000_RCTL_SECRC;
3574 - psrctl |= adapter->rx_ps_bsize0 >>
3575 - E1000_PSRCTL_BSIZE0_SHIFT;
3577 - switch (adapter->rx_ps_pages) {
3579 - psrctl |= PAGE_SIZE <<
3580 - E1000_PSRCTL_BSIZE3_SHIFT;
3582 - psrctl |= PAGE_SIZE <<
3583 - E1000_PSRCTL_BSIZE2_SHIFT;
3585 - psrctl |= PAGE_SIZE >>
3586 - E1000_PSRCTL_BSIZE1_SHIFT;
3589 + if (adapter->rx_ps_pages) {
3590 + /* Configure extra packet-split registers */
3591 + rfctl = E1000_READ_REG(&adapter->hw, RFCTL);
3592 + rfctl |= E1000_RFCTL_EXTEN;
3593 + /* disable IPv6 packet split support */
3594 + rfctl |= (E1000_RFCTL_IPV6_EX_DIS |
3595 + E1000_RFCTL_NEW_IPV6_EXT_DIS);
3597 + rctl |= E1000_RCTL_DTYP_PS;
3599 + psrctl |= adapter->rx_ps_bsize0 >>
3600 + E1000_PSRCTL_BSIZE0_SHIFT;
3602 + switch (adapter->rx_ps_pages) {
3604 + psrctl |= PAGE_SIZE <<
3605 + E1000_PSRCTL_BSIZE3_SHIFT;
3607 + psrctl |= PAGE_SIZE <<
3608 + E1000_PSRCTL_BSIZE2_SHIFT;
3610 + psrctl |= PAGE_SIZE >>
3611 + E1000_PSRCTL_BSIZE1_SHIFT;
3615 - E1000_WRITE_REG(&adapter->hw, PSRCTL, psrctl);
3617 + E1000_WRITE_REG(&adapter->hw, PSRCTL, psrctl);
3620 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
3621 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
3625 @@ -1873,145 +1768,87 @@ iegbe_setup_rctl(struct iegbe_adapter *a
3626 * Configure the Rx unit of the MAC after a reset.
3630 -iegbe_configure_rx(struct iegbe_adapter *adapter)
3631 +static void iegbe_configure_rx(struct iegbe_adapter *adapter)
3634 - struct iegbe_hw *hw = &adapter->hw;
3635 - uint32_t rdlen, rctl, rxcsum, ctrl_ext;
3636 -#ifdef CONFIG_E1000_MQ
3637 - uint32_t reta, mrqc;
3641 + struct iegbe_hw *hw = &adapter->hw;
3642 + u32 rdlen, rctl, rxcsum, ctrl_ext;
3644 - if (adapter->rx_ps_pages) {
3645 + if (adapter->rx_ps_pages) {
3646 rdlen = adapter->rx_ring[0].count *
3647 - sizeof(union iegbe_rx_desc_packet_split);
3648 - adapter->clean_rx = iegbe_clean_rx_irq_ps;
3649 - adapter->alloc_rx_buf = iegbe_alloc_rx_buffers_ps;
3651 + sizeof(union iegbe_rx_desc_packet_split);
3652 + adapter->clean_rx = iegbe_clean_rx_irq_ps;
3653 + adapter->alloc_rx_buf = iegbe_alloc_rx_buffers_ps;
3655 rdlen = adapter->rx_ring[0].count *
3656 - sizeof(struct iegbe_rx_desc);
3657 - adapter->clean_rx = iegbe_clean_rx_irq;
3658 - adapter->alloc_rx_buf = iegbe_alloc_rx_buffers;
3660 + sizeof(struct iegbe_rx_desc);
3661 + adapter->clean_rx = iegbe_clean_rx_irq;
3662 + adapter->alloc_rx_buf = iegbe_alloc_rx_buffers;
3665 - /* disable receives while setting up the descriptors */
3666 - rctl = E1000_READ_REG(hw, RCTL);
3667 - E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN);
3668 + /* disable receives while setting up the descriptors */
3669 + rctl = E1000_READ_REG(hw, RCTL);
3670 + E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN);
3672 - /* set the Receive Delay Timer Register */
3673 - E1000_WRITE_REG(hw, RDTR, adapter->rx_int_delay);
3674 + /* set the Receive Delay Timer Register */
3675 + E1000_WRITE_REG(hw, RDTR, adapter->rx_int_delay);
3677 - if (hw->mac_type >= iegbe_82540) {
3678 - E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay);
3679 - if(adapter->itr > 0x1) {
3680 - E1000_WRITE_REG(hw, ITR,
3681 - 0x3b9aca00 / (adapter->itr * 0x100));
3682 + if (hw->mac_type >= iegbe_82540) {
3683 + E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay);
3684 + if (adapter->itr_setting != 0)
3685 + E1000_WRITE_REG(&adapter->hw, ITR, 1000000000 / (adapter->itr * 256));
3689 - if (hw->mac_type >= iegbe_82571) {
3690 - /* Reset delay timers after every interrupt */
3691 - ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
3692 - ctrl_ext |= E1000_CTRL_EXT_CANC;
3693 - E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
3694 - E1000_WRITE_FLUSH(hw);
3696 + if (hw->mac_type >= iegbe_82571) {
3697 + /* Reset delay timers after every interrupt */
3698 + ctrl_ext = E1000_READ_REG(hw, CTRL_EXT);
3699 + ctrl_ext |= E1000_CTRL_EXT_CANC;
3700 + E1000_WRITE_REG(hw, CTRL_EXT, ctrl_ext);
3701 + E1000_WRITE_FLUSH(hw);
3704 /* Setup the HW Rx Head and Tail Descriptor Pointers and
3705 * the Base and Length of the Rx Descriptor Ring */
3706 - switch (adapter->num_queues) {
3707 -#ifdef CONFIG_E1000_MQ
3709 - rdba = adapter->rx_ring[0x1].dma;
3710 - E1000_WRITE_REG(hw, RDBAL1, (rdba & 0x00000000ffffffffULL));
3711 - E1000_WRITE_REG(hw, RDBAH1, (rdba >> 0x20));
3712 - E1000_WRITE_REG(hw, RDLEN1, rdlen);
3713 - E1000_WRITE_REG(hw, RDH1, 0);
3714 - E1000_WRITE_REG(hw, RDT1, 0);
3715 - adapter->rx_ring[1].rdh = E1000_RDH1;
3716 - adapter->rx_ring[1].rdt = E1000_RDT1;
3717 - /* Fall Through */
3721 + switch (adapter->num_rx_queues) {
3724 rdba = adapter->rx_ring[0].dma;
3725 - E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
3726 + E1000_WRITE_REG(hw, RDBAL, (rdba & 0x00000000ffffffffULL));
3727 E1000_WRITE_REG(hw, RDBAH, (rdba >> 0x20));
3728 - E1000_WRITE_REG(hw, RDLEN, rdlen);
3729 - E1000_WRITE_REG(hw, RDH, 0);
3730 - E1000_WRITE_REG(hw, RDT, 0);
3731 - adapter->rx_ring[0].rdh = E1000_RDH;
3732 - adapter->rx_ring[0].rdt = E1000_RDT;
3735 + E1000_WRITE_REG(hw, RDLEN, rdlen);
3736 + adapter->rx_ring[0].rdh = ((hw->mac_type >= iegbe_82543) ? E1000_RDH : E1000_82542_RDH);
3737 + adapter->rx_ring[0].rdt = ((hw->mac_type >= iegbe_82543) ? E1000_RDT : E1000_82542_RDT);
3741 -#ifdef CONFIG_E1000_MQ
3742 - if (adapter->num_queues > 0x1) {
3743 - uint32_t random[0xa];
3745 - get_random_bytes(&random[0], FORTY);
3747 - if (hw->mac_type <= iegbe_82572) {
3748 - E1000_WRITE_REG(hw, RSSIR, 0);
3749 - E1000_WRITE_REG(hw, RSSIM, 0);
3752 - switch (adapter->num_queues) {
3755 - reta = 0x00800080;
3756 - mrqc = E1000_MRQC_ENABLE_RSS_2Q;
3760 - /* Fill out redirection table */
3761 - for (i = 0; i < 0x20; i++)
3762 - E1000_WRITE_REG_ARRAY(hw, RETA, i, reta);
3763 - /* Fill out hash function seeds */
3764 - for (i = 0; i < 0xa; i++)
3765 - E1000_WRITE_REG_ARRAY(hw, RSSRK, i, random[i]);
3767 - mrqc |= (E1000_MRQC_RSS_FIELD_IPV4 |
3768 - E1000_MRQC_RSS_FIELD_IPV4_TCP);
3769 - E1000_WRITE_REG(hw, MRQC, mrqc);
3772 - /* Multiqueue and packet checksumming are mutually exclusive. */
3773 - if (hw->mac_type >= iegbe_82571) {
3774 - rxcsum = E1000_READ_REG(hw, RXCSUM);
3775 - rxcsum |= E1000_RXCSUM_PCSD;
3776 - E1000_WRITE_REG(hw, RXCSUM, rxcsum);
3780 + /* Enable 82543 Receive Checksum Offload for TCP and UDP */
3781 + if (hw->mac_type >= iegbe_82543) {
3782 + rxcsum = E1000_READ_REG(hw, RXCSUM);
3783 + if(adapter->rx_csum == TRUE) {
3784 + rxcsum |= E1000_RXCSUM_TUOFL;
3786 + /* Enable 82571 IPv4 payload checksum for UDP fragments
3787 + * Must be used in conjunction with packet-split. */
3788 + if ((hw->mac_type >= iegbe_82571) &&
3789 + (adapter->rx_ps_pages)) {
3790 + rxcsum |= E1000_RXCSUM_IPPCSE;
3793 + rxcsum &= ~E1000_RXCSUM_TUOFL;
3794 + /* don't need to clear IPPCSE as it defaults to 0 */
3796 + E1000_WRITE_REG(hw, RXCSUM, rxcsum);
3799 - /* Enable 82543 Receive Checksum Offload for TCP and UDP */
3800 - if (hw->mac_type >= iegbe_82543) {
3801 - rxcsum = E1000_READ_REG(hw, RXCSUM);
3802 - if(adapter->rx_csum == TRUE) {
3803 - rxcsum |= E1000_RXCSUM_TUOFL;
3805 - /* Enable 82571 IPv4 payload checksum for UDP fragments
3806 - * Must be used in conjunction with packet-split. */
3807 - if ((hw->mac_type >= iegbe_82571) &&
3808 - (adapter->rx_ps_pages)) {
3809 - rxcsum |= E1000_RXCSUM_IPPCSE;
3812 - rxcsum &= ~E1000_RXCSUM_TUOFL;
3813 - /* don't need to clear IPPCSE as it defaults to 0 */
3815 - E1000_WRITE_REG(hw, RXCSUM, rxcsum);
3817 -#endif /* CONFIG_E1000_MQ */
3818 + /* enable early receives on 82573, only takes effect if using > 2048
3819 + * byte total frame size. for example only for jumbo frames */
3820 +#define E1000_ERT_2048 0x100
3821 + if (hw->mac_type == iegbe_82573)
3822 + E1000_WRITE_REG(&adapter->hw, ERT, E1000_ERT_2048);
3824 - if (hw->mac_type == iegbe_82573) {
3825 - E1000_WRITE_REG(hw, ERT, 0x0100);
3827 /* Enable Receives */
3828 - E1000_WRITE_REG(hw, RCTL, rctl);
3829 + E1000_WRITE_REG(hw, RCTL, rctl);
3833 @@ -2022,20 +1859,19 @@ iegbe_configure_rx(struct iegbe_adapter
3834 * Free all transmit software resources
3838 -iegbe_free_tx_resources(struct iegbe_adapter *adapter,
3839 +static void iegbe_free_tx_resources(struct iegbe_adapter *adapter,
3840 struct iegbe_tx_ring *tx_ring)
3842 - struct pci_dev *pdev = adapter->pdev;
3843 + struct pci_dev *pdev = adapter->pdev;
3845 - iegbe_clean_tx_ring(adapter, tx_ring);
3846 + iegbe_clean_tx_ring(adapter, tx_ring);
3848 - vfree(tx_ring->buffer_info);
3849 - tx_ring->buffer_info = NULL;
3850 + vfree(tx_ring->buffer_info);
3851 + tx_ring->buffer_info = NULL;
3853 - pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma);
3854 + pci_free_consistent(pdev, tx_ring->size, tx_ring->desc, tx_ring->dma);
3856 - tx_ring->desc = NULL;
3857 + tx_ring->desc = NULL;
3861 @@ -2048,85 +1884,29 @@ iegbe_free_tx_resources(struct iegbe_ada
3863 iegbe_free_all_tx_resources(struct iegbe_adapter *adapter)
3868 - for (i = 0; i < adapter->num_queues; i++)
3869 + for (i = 0x0; i < adapter->num_tx_queues; i++)
3870 iegbe_free_tx_resources(adapter, &adapter->tx_ring[i]);
3874 iegbe_unmap_and_free_tx_resource(struct iegbe_adapter *adapter,
3875 - struct iegbe_buffer *buffer_info)
3877 - if(buffer_info->dma) {
3878 - pci_unmap_page(adapter->pdev,
3880 - buffer_info->length,
3881 - PCI_DMA_TODEVICE);
3882 - buffer_info->dma = 0;
3884 - if(buffer_info->skb) {
3885 - dev_kfree_skb_any(buffer_info->skb);
3886 - buffer_info->skb = NULL;
3890 -#ifdef IEGBE_GBE_WORKAROUND
3892 - * iegbe_clean_tx_ring_partial - Free Tx Buffers without using the DD
3893 - * bit in the descriptor
3894 - * @adapter: board private structure
3895 - * @tx_ring: ring to be cleaned
3897 -static void iegbe_clean_tx_ring_partial(struct iegbe_adapter *adapter,
3898 - struct iegbe_tx_ring *tx_ring)
3899 + struct iegbe_buffer *buffer_info)
3901 - struct iegbe_buffer *buffer_info;
3902 - struct iegbe_tx_desc *tx_desc;
3903 - struct net_device *netdev = adapter->netdev;
3907 - int cleaned = FALSE;
3909 - tail = readl(adapter->hw.hw_addr + tx_ring->tdt);
3910 - head = readl(adapter->hw.hw_addr + tx_ring->tdh);
3912 - if (head != tail) {
3913 - adapter->stats.tx_hnet++;
3915 - if (head != tx_ring->next_to_use) {
3916 - adapter->stats.tx_hnentu++;
3918 - /* Free all the Tx ring sk_buffs from next_to_clean up until
3919 - * the current head pointer
3921 - i = tx_ring->next_to_clean;
3922 - while(i != head) {
3924 - tx_desc = E1000_TX_DESC(*tx_ring, i);
3926 - buffer_info = &tx_ring->buffer_info[i];
3927 - iegbe_unmap_and_free_tx_resource(adapter, buffer_info);
3929 - tx_desc->upper.data = 0;
3931 - if (unlikely(++i == tx_ring->count)) { i = 0; }
3934 - tx_ring->next_to_clean = head;
3936 - spin_lock(&tx_ring->tx_lock);
3938 - /* Wake up the queue if it's currently stopped */
3939 - if (unlikely(cleaned && netif_queue_stopped(netdev) &&
3940 - netif_carrier_ok(netdev))) {
3941 - netif_wake_queue(netdev);
3942 + if(buffer_info->dma) {
3943 + pci_unmap_page(adapter->pdev,
3945 + buffer_info->length,
3946 + PCI_DMA_TODEVICE);
3947 + buffer_info->dma = 0x0;
3949 + if(buffer_info->skb) {
3950 + dev_kfree_skb_any(buffer_info->skb);
3951 + buffer_info->skb = NULL;
3954 - spin_unlock(&tx_ring->tx_lock);
3960 * iegbe_clean_tx_ring - Free Tx Buffers
3961 @@ -2134,38 +1914,34 @@ static void iegbe_clean_tx_ring_partial(
3962 * @tx_ring: ring to be cleaned
3966 -iegbe_clean_tx_ring(struct iegbe_adapter *adapter,
3967 +static void iegbe_clean_tx_ring(struct iegbe_adapter *adapter,
3968 struct iegbe_tx_ring *tx_ring)
3970 - struct iegbe_buffer *buffer_info;
3971 - unsigned long size;
3974 - /* Free all the Tx ring sk_buffs */
3975 + struct iegbe_hw *hw = &adapter->hw;
3976 + struct iegbe_buffer *buffer_info;
3977 + unsigned long size;
3980 - if (likely(tx_ring->previous_buffer_info.skb != NULL)) {
3981 - iegbe_unmap_and_free_tx_resource(adapter,
3982 - &tx_ring->previous_buffer_info);
3984 + /* Free all the Tx ring sk_buffs */
3986 for (i = 0; i < tx_ring->count; i++) {
3987 - buffer_info = &tx_ring->buffer_info[i];
3988 - iegbe_unmap_and_free_tx_resource(adapter, buffer_info);
3990 + buffer_info = &tx_ring->buffer_info[i];
3991 + iegbe_unmap_and_free_tx_resource(adapter, buffer_info);
3994 - size = sizeof(struct iegbe_buffer) * tx_ring->count;
3995 + size = sizeof(struct iegbe_buffer) * tx_ring->count;
3996 memset(tx_ring->buffer_info, 0, size);
3998 - /* Zero out the descriptor ring */
3999 + /* Zero out the descriptor ring */
4001 memset(tx_ring->desc, 0, tx_ring->size);
4003 tx_ring->next_to_use = 0;
4004 tx_ring->next_to_clean = 0;
4005 + tx_ring->last_tx_tso = 0;
4007 - writel(0, adapter->hw.hw_addr + tx_ring->tdh);
4008 - writel(0, adapter->hw.hw_addr + tx_ring->tdt);
4009 + writel(0, hw->hw_addr + tx_ring->tdh);
4010 + writel(0, hw->hw_addr + tx_ring->tdt);
4014 @@ -2173,12 +1949,11 @@ iegbe_clean_tx_ring(struct iegbe_adapter
4015 * @adapter: board private structure
4019 -iegbe_clean_all_tx_rings(struct iegbe_adapter *adapter)
4020 +static void iegbe_clean_all_tx_rings(struct iegbe_adapter *adapter)
4025 - for (i = 0; i < adapter->num_queues; i++)
4026 + for (i = 0; i < adapter->num_tx_queues; i++)
4027 iegbe_clean_tx_ring(adapter, &adapter->tx_ring[i]);
4030 @@ -2190,24 +1965,23 @@ iegbe_clean_all_tx_rings(struct iegbe_ad
4031 * Free all receive software resources
4035 -iegbe_free_rx_resources(struct iegbe_adapter *adapter,
4036 +static void iegbe_free_rx_resources(struct iegbe_adapter *adapter,
4037 struct iegbe_rx_ring *rx_ring)
4039 - struct pci_dev *pdev = adapter->pdev;
4040 + struct pci_dev *pdev = adapter->pdev;
4042 - iegbe_clean_rx_ring(adapter, rx_ring);
4043 + iegbe_clean_rx_ring(adapter, rx_ring);
4045 - vfree(rx_ring->buffer_info);
4046 - rx_ring->buffer_info = NULL;
4047 - kfree(rx_ring->ps_page);
4048 - rx_ring->ps_page = NULL;
4049 - kfree(rx_ring->ps_page_dma);
4050 - rx_ring->ps_page_dma = NULL;
4051 + vfree(rx_ring->buffer_info);
4052 + rx_ring->buffer_info = NULL;
4053 + kfree(rx_ring->ps_page);
4054 + rx_ring->ps_page = NULL;
4055 + kfree(rx_ring->ps_page_dma);
4056 + rx_ring->ps_page_dma = NULL;
4058 - pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
4059 + pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
4061 - rx_ring->desc = NULL;
4062 + rx_ring->desc = NULL;
4066 @@ -2217,12 +1991,11 @@ iegbe_free_rx_resources(struct iegbe_ada
4067 * Free all receive software resources
4071 -iegbe_free_all_rx_resources(struct iegbe_adapter *adapter)
4072 +void iegbe_free_all_rx_resources(struct iegbe_adapter *adapter)
4077 - for (i = 0; i < adapter->num_queues; i++)
4078 + for (i = 0; i < adapter->num_rx_queues; i++)
4079 iegbe_free_rx_resources(adapter, &adapter->rx_ring[i]);
4082 @@ -2232,60 +2005,59 @@ iegbe_free_all_rx_resources(struct iegbe
4083 * @rx_ring: ring to free buffers from
4087 -iegbe_clean_rx_ring(struct iegbe_adapter *adapter,
4088 +static void iegbe_clean_rx_ring(struct iegbe_adapter *adapter,
4089 struct iegbe_rx_ring *rx_ring)
4091 - struct iegbe_buffer *buffer_info;
4092 - struct iegbe_ps_page *ps_page;
4093 - struct iegbe_ps_page_dma *ps_page_dma;
4094 - struct pci_dev *pdev = adapter->pdev;
4095 - unsigned long size;
4096 - unsigned int i, j;
4098 - /* Free all the Rx ring sk_buffs */
4099 + struct iegbe_hw *hw = &adapter->hw;
4100 + struct iegbe_buffer *buffer_info;
4101 + struct iegbe_ps_page *ps_page;
4102 + struct iegbe_ps_page_dma *ps_page_dma;
4103 + struct pci_dev *pdev = adapter->pdev;
4104 + unsigned long size;
4105 + unsigned int i, j;
4107 + /* Free all the Rx ring sk_buffs */
4109 + for (i = 0; i < rx_ring->count; i++) {
4110 + buffer_info = &rx_ring->buffer_info[i];
4111 + if(buffer_info->skb) {
4112 + pci_unmap_single(pdev,
4114 + buffer_info->length,
4115 + PCI_DMA_FROMDEVICE);
4117 - for(i = 0; i < rx_ring->count; i++) {
4118 - buffer_info = &rx_ring->buffer_info[i];
4119 - if(buffer_info->skb) {
4120 - ps_page = &rx_ring->ps_page[i];
4121 - ps_page_dma = &rx_ring->ps_page_dma[i];
4122 - pci_unmap_single(pdev,
4124 - buffer_info->length,
4125 - PCI_DMA_FROMDEVICE);
4127 - dev_kfree_skb(buffer_info->skb);
4128 - buffer_info->skb = NULL;
4130 - for(j = 0; j < adapter->rx_ps_pages; j++) {
4131 - if(!ps_page->ps_page[j]) { break; }
4132 - pci_unmap_single(pdev,
4133 - ps_page_dma->ps_page_dma[j],
4134 - PAGE_SIZE, PCI_DMA_FROMDEVICE);
4135 - ps_page_dma->ps_page_dma[j] = 0;
4136 - put_page(ps_page->ps_page[j]);
4137 - ps_page->ps_page[j] = NULL;
4139 + dev_kfree_skb(buffer_info->skb);
4140 + buffer_info->skb = NULL;
4143 + ps_page = &rx_ring->ps_page[i];
4144 + ps_page_dma = &rx_ring->ps_page_dma[i];
4145 + for (j = 0; j < adapter->rx_ps_pages; j++) {
4146 + if (!ps_page->ps_page[j]) break;
4147 + pci_unmap_page(pdev,
4148 + ps_page_dma->ps_page_dma[j],
4149 + PAGE_SIZE, PCI_DMA_FROMDEVICE);
4150 + ps_page_dma->ps_page_dma[j] = 0;
4151 + put_page(ps_page->ps_page[j]);
4152 + ps_page->ps_page[j] = NULL;
4156 - size = sizeof(struct iegbe_buffer) * rx_ring->count;
4157 + size = sizeof(struct iegbe_buffer) * rx_ring->count;
4158 memset(rx_ring->buffer_info, 0, size);
4159 - size = sizeof(struct iegbe_ps_page) * rx_ring->count;
4160 + size = sizeof(struct iegbe_ps_page) * rx_ring->count;
4161 memset(rx_ring->ps_page, 0, size);
4162 - size = sizeof(struct iegbe_ps_page_dma) * rx_ring->count;
4163 + size = sizeof(struct iegbe_ps_page_dma) * rx_ring->count;
4164 memset(rx_ring->ps_page_dma, 0, size);
4166 - /* Zero out the descriptor ring */
4167 + /* Zero out the descriptor ring */
4169 memset(rx_ring->desc, 0, rx_ring->size);
4171 rx_ring->next_to_clean = 0;
4172 rx_ring->next_to_use = 0;
4174 - writel(0, adapter->hw.hw_addr + rx_ring->rdh);
4175 - writel(0, adapter->hw.hw_addr + rx_ring->rdt);
4176 + writel(0, hw->hw_addr + rx_ring->rdh);
4177 + writel(0, hw->hw_addr + rx_ring->rdt);
4181 @@ -2293,60 +2065,54 @@ iegbe_clean_rx_ring(struct iegbe_adapter
4182 * @adapter: board private structure
4186 -iegbe_clean_all_rx_rings(struct iegbe_adapter *adapter)
4187 +static void iegbe_clean_all_rx_rings(struct iegbe_adapter *adapter)
4192 - for (i = 0; i < adapter->num_queues; i++)
4193 + for (i = 0; i < adapter->num_rx_queues; i++)
4194 iegbe_clean_rx_ring(adapter, &adapter->rx_ring[i]);
4197 /* The 82542 2.0 (revision 2) needs to have the receive unit in reset
4198 * and memory write and invalidate disabled for certain operations
4201 -iegbe_enter_82542_rst(struct iegbe_adapter *adapter)
4202 +static void iegbe_enter_82542_rst(struct iegbe_adapter *adapter)
4204 - struct net_device *netdev = adapter->netdev;
4206 + struct net_device *netdev = adapter->netdev;
4209 - iegbe_pci_clear_mwi(&adapter->hw);
4210 + iegbe_pci_clear_mwi(&adapter->hw);
4212 - rctl = E1000_READ_REG(&adapter->hw, RCTL);
4213 - rctl |= E1000_RCTL_RST;
4214 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4215 - E1000_WRITE_FLUSH(&adapter->hw);
4216 + rctl = E1000_READ_REG(&adapter->hw, RCTL);
4217 + rctl |= E1000_RCTL_RST;
4218 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4219 + E1000_WRITE_FLUSH(&adapter->hw);
4222 if(netif_running(netdev)) {
4223 - iegbe_clean_all_rx_rings(adapter);
4225 + iegbe_clean_all_rx_rings(adapter);
4230 iegbe_leave_82542_rst(struct iegbe_adapter *adapter)
4232 - struct net_device *netdev = adapter->netdev;
4234 + struct net_device *netdev = adapter->netdev;
4237 - rctl = E1000_READ_REG(&adapter->hw, RCTL);
4238 - rctl &= ~E1000_RCTL_RST;
4239 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4240 - E1000_WRITE_FLUSH(&adapter->hw);
4241 + rctl = E1000_READ_REG(&adapter->hw, RCTL);
4242 + rctl &= ~E1000_RCTL_RST;
4243 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4244 + E1000_WRITE_FLUSH(&adapter->hw);
4247 if(adapter->hw.pci_cmd_word & PCI_COMMAND_INVALIDATE) {
4248 - iegbe_pci_set_mwi(&adapter->hw);
4249 + iegbe_pci_set_mwi(&adapter->hw);
4251 if(netif_running(netdev)) {
4252 + struct iegbe_rx_ring *ring = &adapter->rx_ring[0x0];
4253 iegbe_configure_rx(adapter);
4254 -#ifdef IEGBE_GBE_WORKAROUND
4255 - iegbe_alloc_rx_buffers(adapter, &adapter->rx_ring[0],
4256 - IEGBE_GBE_WORKAROUND_NUM_RX_DESCRIPTORS + 1);
4258 - iegbe_alloc_rx_buffers(adapter, &adapter->rx_ring[0]);
4260 + adapter->alloc_rx_buf(adapter, ring, E1000_DESC_UNUSED(ring));
4264 @@ -2358,133 +2124,153 @@ iegbe_leave_82542_rst(struct iegbe_adapt
4265 * Returns 0 on success, negative on failure
4269 -iegbe_set_mac(struct net_device *netdev, void *p)
4270 +static int iegbe_set_mac(struct net_device *netdev, void *p)
4272 - struct iegbe_adapter *adapter = netdev_priv(netdev);
4273 - struct sockaddr *addr = p;
4274 + struct iegbe_adapter *adapter = netdev_priv(netdev);
4275 + struct sockaddr *addr = p;
4277 if(!is_valid_ether_addr(addr->sa_data)) {
4278 - return -EADDRNOTAVAIL;
4279 + return -EADDRNOTAVAIL;
4281 - /* 82542 2.0 needs to be in reset to write receive address registers */
4282 + /* 82542 2.0 needs to be in reset to write receive address registers */
4284 if(adapter->hw.mac_type == iegbe_82542_rev2_0) {
4285 - iegbe_enter_82542_rst(adapter);
4286 + iegbe_enter_82542_rst(adapter);
4288 - memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
4289 - memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len);
4290 + memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
4291 + memcpy(adapter->hw.mac_addr, addr->sa_data, netdev->addr_len);
4293 - iegbe_rar_set(&adapter->hw, adapter->hw.mac_addr, 0);
4294 + iegbe_rar_set(&adapter->hw, adapter->hw.mac_addr, 0x0);
4296 - /* With 82571 controllers, LAA may be overwritten (with the default)
4297 - * due to controller reset from the other port. */
4298 - if (adapter->hw.mac_type == iegbe_82571) {
4299 - /* activate the work around */
4300 + /* With 82571 controllers, LAA may be overwritten (with the default)
4301 + * due to controller reset from the other port. */
4302 + if (adapter->hw.mac_type == iegbe_82571) {
4303 + /* activate the work around */
4304 adapter->hw.laa_is_present = 0x1;
4306 - /* Hold a copy of the LAA in RAR[14] This is done so that
4307 - * between the time RAR[0] gets clobbered and the time it
4308 - * gets fixed (in iegbe_watchdog), the actual LAA is in one
4309 - * of the RARs and no incoming packets directed to this port
4310 - * are dropped. Eventaully the LAA will be in RAR[0] and
4312 - iegbe_rar_set(&adapter->hw, adapter->hw.mac_addr,
4313 + /* Hold a copy of the LAA in RAR[14] This is done so that
4314 + * between the time RAR[0] gets clobbered and the time it
4315 + * gets fixed (in iegbe_watchdog), the actual LAA is in one
4316 + * of the RARs and no incoming packets directed to this port
4317 + * are dropped. Eventaully the LAA will be in RAR[0] and
4319 + iegbe_rar_set(&adapter->hw, adapter->hw.mac_addr,
4320 E1000_RAR_ENTRIES - 0x1);
4324 if(adapter->hw.mac_type == iegbe_82542_rev2_0) {
4325 - iegbe_leave_82542_rst(adapter);
4326 + iegbe_leave_82542_rst(adapter);
4333 - * iegbe_set_multi - Multicast and Promiscuous mode set
4334 + * iegbe_set_rx_mode - Secondary Unicast, Multicast and Promiscuous mode set
4335 * @netdev: network interface device structure
4337 - * The set_multi entry point is called whenever the multicast address
4338 - * list or the network interface flags are updated. This routine is
4339 - * responsible for configuring the hardware for proper multicast,
4340 + * The set_rx_mode entry point is called whenever the unicast or multicast
4341 + * address lists or the network interface flags are updated. This routine is
4342 + * responsible for configuring the hardware for proper unicast, multicast,
4343 * promiscuous mode, and all-multi behavior.
4347 -iegbe_set_multi(struct net_device *netdev)
4348 +static void iegbe_set_rx_mode(struct net_device *netdev)
4350 struct iegbe_adapter *adapter = netdev_priv(netdev);
4351 struct iegbe_hw *hw = &adapter->hw;
4352 - struct dev_mc_list *mc_ptr;
4354 - uint32_t hash_value;
4355 + struct dev_addr_list *uc_ptr;
4356 + struct dev_addr_list *mc_ptr;
4359 int i, rar_entries = E1000_RAR_ENTRIES;
4360 +int mta_reg_count = E1000_NUM_MTA_REGISTERS;
4362 /* reserve RAR[14] for LAA over-write work-around */
4363 - if (adapter->hw.mac_type == iegbe_82571) {
4364 + if (hw->mac_type == iegbe_82571)
4368 /* Check for Promiscuous and All Multicast modes */
4370 - rctl = E1000_READ_REG(hw, RCTL);
4371 + rctl = E1000_READ_REG(&adapter->hw, RCTL);
4373 if (netdev->flags & IFF_PROMISC) {
4374 rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE);
4375 - } else if (netdev->flags & IFF_ALLMULTI) {
4376 - rctl |= E1000_RCTL_MPE;
4377 - rctl &= ~E1000_RCTL_UPE;
4378 + rctl &= ~E1000_RCTL_VFE;
4380 - rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE);
4381 + if (netdev->flags & IFF_ALLMULTI) {
4382 + rctl |= E1000_RCTL_MPE;
4384 + rctl &= ~E1000_RCTL_MPE;
4389 + if (netdev->uc_count > rar_entries - 1) {
4390 + rctl |= E1000_RCTL_UPE;
4391 + } else if (!(netdev->flags & IFF_PROMISC)) {
4392 + rctl &= ~E1000_RCTL_UPE;
4393 + uc_ptr = netdev->uc_list;
4396 - E1000_WRITE_REG(hw, RCTL, rctl);
4397 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
4399 /* 82542 2.0 needs to be in reset to write receive address registers */
4401 - if (hw->mac_type == iegbe_82542_rev2_0) {
4402 + if (hw->mac_type == iegbe_82542_rev2_0)
4403 iegbe_enter_82542_rst(adapter);
4405 - /* load the first 14 multicast address into the exact filters 1-14
4407 + /* load the first 14 addresses into the exact filters 1-14. Unicast
4408 + * addresses take precedence to avoid disabling unicast filtering
4411 * RAR 0 is used for the station MAC adddress
4412 * if there are not 14 addresses, go ahead and clear the filters
4413 * -- with 82571 controllers only 0-13 entries are filled here
4415 mc_ptr = netdev->mc_list;
4417 - for (i = 0x1; i < rar_entries; i++) {
4419 - iegbe_rar_set(hw, mc_ptr->dmi_addr, i);
4420 + for (i = 1; i < rar_entries; i++) {
4422 + iegbe_rar_set(hw, uc_ptr->da_addr, i);
4423 + uc_ptr = uc_ptr->next;
4424 + } else if (mc_ptr) {
4425 + iegbe_rar_set(hw, mc_ptr->da_addr, i);
4426 mc_ptr = mc_ptr->next;
4428 - E1000_WRITE_REG_ARRAY(hw, RA, i << 0x1, 0);
4429 - E1000_WRITE_REG_ARRAY(hw, RA, (i << 0x1) + 0x1, 0);
4430 + E1000_WRITE_REG_ARRAY(hw, RA, i << 1, 0);
4431 + E1000_WRITE_FLUSH(&adapter->hw);
4432 + E1000_WRITE_REG_ARRAY(hw, RA, (i << 1) + 1, 0);
4433 + E1000_WRITE_FLUSH(&adapter->hw);
4436 + WARN_ON(uc_ptr != NULL);
4438 /* clear the old settings from the multicast hash table */
4440 - for (i = 0; i < E1000_NUM_MTA_REGISTERS; i++)
4441 + for (i = 0; i < mta_reg_count; i++) {
4442 E1000_WRITE_REG_ARRAY(hw, MTA, i, 0);
4443 + E1000_WRITE_FLUSH(&adapter->hw);
4446 /* load any remaining addresses into the hash table */
4448 for (; mc_ptr; mc_ptr = mc_ptr->next) {
4449 - hash_value = iegbe_hash_mc_addr(hw, mc_ptr->dmi_addr);
4450 + hash_value = iegbe_hash_mc_addr(hw, mc_ptr->da_addr);
4451 iegbe_mta_set(hw, hash_value);
4454 - if (hw->mac_type == iegbe_82542_rev2_0) {
4455 + if (hw->mac_type == iegbe_82542_rev2_0)
4456 iegbe_leave_82542_rst(adapter);
4460 /* Need to wait a few seconds after link up to get diagnostic information from
4464 -iegbe_update_phy_info(unsigned long data)
4465 +static void iegbe_update_phy_info(unsigned long data)
4467 - struct iegbe_adapter *adapter = (struct iegbe_adapter *) data;
4468 - iegbe_phy_get_info(&adapter->hw, &adapter->phy_info);
4469 + struct iegbe_adapter *adapter = (struct iegbe_adapter *) data;
4470 + struct iegbe_hw *hw = &adapter->hw;
4471 + iegbe_phy_get_info(hw, &adapter->phy_info);
4475 @@ -2492,54 +2278,54 @@ iegbe_update_phy_info(unsigned long data
4476 * @data: pointer to adapter cast into an unsigned long
4480 -iegbe_82547_tx_fifo_stall(unsigned long data)
4481 +static void iegbe_82547_tx_fifo_stall(unsigned long data)
4483 - struct iegbe_adapter *adapter = (struct iegbe_adapter *) data;
4484 - struct net_device *netdev = adapter->netdev;
4486 + struct iegbe_adapter *adapter = (struct iegbe_adapter *) data;
4487 + struct net_device *netdev = adapter->netdev;
4490 - if(atomic_read(&adapter->tx_fifo_stall)) {
4491 - if((E1000_READ_REG(&adapter->hw, TDT) ==
4492 - E1000_READ_REG(&adapter->hw, TDH)) &&
4493 - (E1000_READ_REG(&adapter->hw, TDFT) ==
4494 - E1000_READ_REG(&adapter->hw, TDFH)) &&
4495 - (E1000_READ_REG(&adapter->hw, TDFTS) ==
4496 - E1000_READ_REG(&adapter->hw, TDFHS))) {
4497 - tctl = E1000_READ_REG(&adapter->hw, TCTL);
4498 - E1000_WRITE_REG(&adapter->hw, TCTL,
4499 - tctl & ~E1000_TCTL_EN);
4500 - E1000_WRITE_REG(&adapter->hw, TDFT,
4501 - adapter->tx_head_addr);
4502 - E1000_WRITE_REG(&adapter->hw, TDFH,
4503 - adapter->tx_head_addr);
4504 - E1000_WRITE_REG(&adapter->hw, TDFTS,
4505 - adapter->tx_head_addr);
4506 - E1000_WRITE_REG(&adapter->hw, TDFHS,
4507 - adapter->tx_head_addr);
4508 - E1000_WRITE_REG(&adapter->hw, TCTL, tctl);
4509 - E1000_WRITE_FLUSH(&adapter->hw);
4511 - adapter->tx_fifo_head = 0;
4512 - atomic_set(&adapter->tx_fifo_stall, 0);
4513 - netif_wake_queue(netdev);
4515 + if(atomic_read(&adapter->tx_fifo_stall)) {
4516 + if((E1000_READ_REG(&adapter->hw, TDT) ==
4517 + E1000_READ_REG(&adapter->hw, TDH)) &&
4518 + (E1000_READ_REG(&adapter->hw, TDFT) ==
4519 + E1000_READ_REG(&adapter->hw, TDFH)) &&
4520 + (E1000_READ_REG(&adapter->hw, TDFTS) ==
4521 + E1000_READ_REG(&adapter->hw, TDFHS))) {
4522 + tctl = E1000_READ_REG(&adapter->hw, TCTL);
4523 + E1000_WRITE_REG(&adapter->hw, TCTL,
4524 + tctl & ~E1000_TCTL_EN);
4525 + E1000_WRITE_REG(&adapter->hw, TDFT,
4526 + adapter->tx_head_addr);
4527 + E1000_WRITE_REG(&adapter->hw, TDFH,
4528 + adapter->tx_head_addr);
4529 + E1000_WRITE_REG(&adapter->hw, TDFTS,
4530 + adapter->tx_head_addr);
4531 + E1000_WRITE_REG(&adapter->hw, TDFHS,
4532 + adapter->tx_head_addr);
4533 + E1000_WRITE_REG(&adapter->hw, TCTL, tctl);
4534 + E1000_WRITE_FLUSH(&adapter->hw);
4536 + adapter->tx_fifo_head = 0x0;
4537 + atomic_set(&adapter->tx_fifo_stall, 0x0);
4538 + netif_wake_queue(netdev);
4540 mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 0x1);
4549 * iegbe_watchdog - Timer Call-back
4550 * @data: pointer to adapter cast into an unsigned long
4553 -iegbe_watchdog(unsigned long data)
4554 +static void iegbe_watchdog(unsigned long data)
4556 - struct iegbe_adapter *adapter = (struct iegbe_adapter *) data;
4557 - struct net_device *netdev = adapter->netdev;
4558 - struct iegbe_tx_ring *txdr = &adapter->tx_ring[0];
4560 + struct iegbe_adapter *adapter = (struct iegbe_adapter *) data;
4561 + struct iegbe_hw *hw = &adapter->hw;
4562 + struct net_device *netdev = adapter->netdev;
4563 + struct iegbe_tx_ring *txdr = adapter->tx_ring;
4567 * Test the PHY for link status on icp_xxxx MACs.
4568 @@ -2547,123 +2333,305 @@ iegbe_watchdog(unsigned long data)
4569 * in the adapter->hw structure, then set hw->get_link_status = 1
4571 if(adapter->hw.mac_type == iegbe_icp_xxxx) {
4576 ret_val = iegbe_oem_phy_is_link_up(&adapter->hw, &isUp);
4577 if(ret_val != E1000_SUCCESS) {
4582 if(isUp != adapter->hw.icp_xxxx_is_link_up) {
4583 adapter->hw.get_link_status = 0x1;
4587 - iegbe_check_for_link(&adapter->hw);
4588 - if (adapter->hw.mac_type == iegbe_82573) {
4589 - iegbe_enable_tx_pkt_filtering(&adapter->hw);
4590 + iegbe_check_for_link(&adapter->hw);
4591 + if (adapter->hw.mac_type == iegbe_82573) {
4592 + iegbe_enable_tx_pkt_filtering(&adapter->hw);
4593 #ifdef NETIF_F_HW_VLAN_TX
4594 if (adapter->mng_vlan_id != adapter->hw.mng_cookie.vlan_id) {
4595 - iegbe_update_mng_vlan(adapter);
4596 + iegbe_update_mng_vlan(adapter);
4602 - if ((adapter->hw.media_type == iegbe_media_type_internal_serdes) &&
4603 - !(E1000_READ_REG(&adapter->hw, TXCW) & E1000_TXCW_ANE)) {
4604 - link = !adapter->hw.serdes_link_down;
4606 + if ((adapter->hw.media_type == iegbe_media_type_internal_serdes) &&
4607 + !(E1000_READ_REG(&adapter->hw, TXCW) & E1000_TXCW_ANE)) {
4608 + link = !adapter->hw.serdes_link_down;
4611 - if(adapter->hw.mac_type != iegbe_icp_xxxx) {
4612 - link = E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU;
4615 + if(adapter->hw.mac_type != iegbe_icp_xxxx) {
4616 + link = E1000_READ_REG(&adapter->hw, STATUS) & E1000_STATUS_LU;
4619 if(iegbe_oem_phy_is_link_up(&adapter->hw, &isUp) != E1000_SUCCESS) {
4631 - if (!netif_carrier_ok(netdev)) {
4632 - iegbe_get_speed_and_duplex(&adapter->hw,
4633 - &adapter->link_speed,
4634 - &adapter->link_duplex);
4636 - DPRINTK(LINK, INFO, "NIC Link is Up %d Mbps %s\n",
4637 - adapter->link_speed,
4638 - adapter->link_duplex == FULL_DUPLEX ?
4639 - "Full Duplex" : "Half Duplex");
4641 + if (!netif_carrier_ok(netdev)) {
4643 + bool txb2b = true;
4644 + iegbe_get_speed_and_duplex(hw,
4645 + &adapter->link_speed,
4646 + &adapter->link_duplex);
4648 - netif_carrier_on(netdev);
4649 - netif_wake_queue(netdev);
4650 - mod_timer(&adapter->phy_info_timer, jiffies + 0x2 * HZ);
4651 + ctrl = E1000_READ_REG(&adapter->hw, CTRL);
4652 + DPRINTK(LINK, INFO, "NIC Link is Up %d Mbps %s, "
4653 + "Flow Control: %s\n",
4654 + adapter->link_speed,
4655 + adapter->link_duplex == FULL_DUPLEX ?
4656 + "Full Duplex" : "Half Duplex",
4657 + ((ctrl & E1000_CTRL_TFCE) && (ctrl &
4658 + E1000_CTRL_RFCE)) ? "RX/TX" : ((ctrl &
4659 + E1000_CTRL_RFCE) ? "RX" : ((ctrl &
4660 + E1000_CTRL_TFCE) ? "TX" : "None" )));
4662 + /* tweak tx_queue_len according to speed/duplex
4663 + * and adjust the timeout factor */
4664 + netdev->tx_queue_len = adapter->tx_queue_len;
4665 + adapter->tx_timeout_factor = 1;
4666 + switch (adapter->link_speed) {
4669 + netdev->tx_queue_len = 10;
4670 + adapter->tx_timeout_factor = 8;
4674 + netdev->tx_queue_len = 100;
4677 + if ((hw->mac_type == iegbe_82571 ||
4678 + hw->mac_type == iegbe_82572) &&
4681 + tarc0 = E1000_READ_REG(&adapter->hw, TARC0);
4682 + tarc0 &= ~(1 << 21);
4683 + E1000_WRITE_REG(&adapter->hw, TARC0, tarc0);
4685 + /* disable TSO for pcie and 10/100 speeds, to avoid
4686 + * some hardware issues */
4687 + if (!adapter->tso_force &&
4688 + hw->bus_type == iegbe_bus_type_pci_express){
4689 + switch (adapter->link_speed) {
4692 + DPRINTK(PROBE,INFO,
4693 + "10/100 speed: disabling TSO\n");
4694 + netdev->features &= ~NETIF_F_TSO;
4695 + netdev->features &= ~NETIF_F_TSO6;
4698 + netdev->features |= NETIF_F_TSO;
4699 + netdev->features |= NETIF_F_TSO6;
4705 + tctl = E1000_READ_REG(&adapter->hw, TCTL);
4706 + tctl |= E1000_TCTL_EN;
4707 + E1000_WRITE_REG(&adapter->hw, TCTL, tctl);
4708 + netif_carrier_on(netdev);
4709 + netif_wake_queue(netdev);
4710 + mod_timer(&adapter->phy_info_timer, round_jiffies(jiffies + 2 * HZ));
4711 adapter->smartspeed = 0;
4713 + if (hw->rx_needs_kicking) {
4714 + u32 rctl = E1000_READ_REG(&adapter->hw, RCTL);
4715 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl | E1000_RCTL_EN);
4719 - if (netif_carrier_ok(netdev)) {
4721 + if (netif_carrier_ok(netdev)) {
4722 adapter->link_speed = 0;
4723 adapter->link_duplex = 0;
4724 - DPRINTK(LINK, INFO, "NIC Link is Down\n");
4725 - netif_carrier_off(netdev);
4726 - netif_stop_queue(netdev);
4727 - mod_timer(&adapter->phy_info_timer, jiffies + 0x2 * HZ);
4729 + DPRINTK(LINK, INFO, "NIC Link is Down\n");
4730 + netif_carrier_off(netdev);
4731 + netif_stop_queue(netdev);
4732 + mod_timer(&adapter->phy_info_timer, round_jiffies(jiffies + 2 * HZ));
4735 - iegbe_smartspeed(adapter);
4737 + iegbe_smartspeed(adapter);
4740 + iegbe_update_stats(adapter);
4742 + hw->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
4743 + adapter->tpt_old = adapter->stats.tpt;
4744 + hw->collision_delta = adapter->stats.colc - adapter->colc_old;
4745 + adapter->colc_old = adapter->stats.colc;
4747 + adapter->gorcl = adapter->stats.gorcl - adapter->gorcl_old;
4748 + adapter->gorcl_old = adapter->stats.gorcl;
4749 + adapter->gotcl = adapter->stats.gotcl - adapter->gotcl_old;
4750 + adapter->gotcl_old = adapter->stats.gotcl;
4752 + iegbe_update_adaptive(hw);
4754 + if (!netif_carrier_ok(netdev)) {
4755 + if (E1000_DESC_UNUSED(txdr) + 1 < txdr->count) {
4756 + /* We've lost link, so the controller stops DMA,
4757 + * but we've got queued Tx work that's never going
4758 + * to get done, so reset controller to flush Tx.
4759 + * (Do the reset outside of interrupt context). */
4760 + adapter->tx_timeout_count++;
4761 + schedule_work(&adapter->reset_task);
4765 + /* Cause software interrupt to ensure rx ring is cleaned */
4766 + E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_RXDMT0);
4768 + /* Force detection of hung controller every watchdog period */
4769 + adapter->detect_tx_hung = TRUE;
4771 + /* With 82571 controllers, LAA may be overwritten due to controller
4772 + * reset from the other port. Set the appropriate LAA in RAR[0] */
4773 + if (adapter->hw.mac_type == iegbe_82571 && adapter->hw.laa_is_present) {
4774 + iegbe_rar_set(&adapter->hw, adapter->hw.mac_addr, 0x0);
4776 + /* Reset the timer */
4777 + mod_timer(&adapter->watchdog_timer, round_jiffies(jiffies + 2 * HZ));
4780 +enum latency_range {
4781 + lowest_latency = 0,
4784 + latency_invalid = 255
4787 - iegbe_update_stats(adapter);
4789 + * iegbe_update_itr - update the dynamic ITR value based on statistics
4790 + * Stores a new ITR value based on packets and byte
4791 + * counts during the last interrupt. The advantage of per interrupt
4792 + * computation is faster updates and more accurate ITR for the current
4793 + * traffic pattern. Constants in this function were computed
4794 + * based on theoretical maximum wire speed and thresholds were set based
4795 + * on testing data as well as attempting to minimize response time
4796 + * while increasing bulk throughput.
4797 + * this functionality is controlled by the InterruptThrottleRate module
4798 + * parameter (see iegbe_param.c)
4799 + * @adapter: pointer to adapter
4800 + * @itr_setting: current adapter->itr
4801 + * @packets: the number of packets during this measurement interval
4802 + * @bytes: the number of bytes during this measurement interval
4804 +static unsigned int iegbe_update_itr(struct iegbe_adapter *adapter,
4805 + u16 itr_setting, int packets, int bytes)
4807 + unsigned int retval = itr_setting;
4808 + struct iegbe_hw *hw = &adapter->hw;
4810 - adapter->hw.tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
4811 - adapter->tpt_old = adapter->stats.tpt;
4812 - adapter->hw.collision_delta = adapter->stats.colc - adapter->colc_old;
4813 - adapter->colc_old = adapter->stats.colc;
4815 - adapter->gorcl = adapter->stats.gorcl - adapter->gorcl_old;
4816 - adapter->gorcl_old = adapter->stats.gorcl;
4817 - adapter->gotcl = adapter->stats.gotcl - adapter->gotcl_old;
4818 - adapter->gotcl_old = adapter->stats.gotcl;
4820 - iegbe_update_adaptive(&adapter->hw);
4822 - if (adapter->num_queues == 0x1 && !netif_carrier_ok(netdev)) {
4823 - if (E1000_DESC_UNUSED(txdr) + 0x1 < txdr->count) {
4824 - /* We've lost link, so the controller stops DMA,
4825 - * but we've got queued Tx work that's never going
4826 - * to get done, so reset controller to flush Tx.
4827 - * (Do the reset outside of interrupt context). */
4828 - schedule_work(&adapter->tx_timeout_task);
4829 + if (unlikely(hw->mac_type < iegbe_82540))
4830 + goto update_itr_done;
4833 + goto update_itr_done;
4835 + switch (itr_setting) {
4836 + case lowest_latency:
4837 + /* jumbo frames get bulk treatment*/
4838 + if (bytes/packets > 8000)
4839 + retval = bulk_latency;
4840 + else if ((packets < 5) && (bytes > 512))
4841 + retval = low_latency;
4843 + case low_latency: /* 50 usec aka 20000 ints/s */
4844 + if (bytes > 10000) {
4845 + /* jumbo frames need bulk latency setting */
4846 + if (bytes/packets > 8000)
4847 + retval = bulk_latency;
4848 + else if ((packets < 10) || ((bytes/packets) > 1200))
4849 + retval = bulk_latency;
4850 + else if ((packets > 35))
4851 + retval = lowest_latency;
4852 + } else if (bytes/packets > 2000)
4853 + retval = bulk_latency;
4854 + else if (packets <= 2 && bytes < 512)
4855 + retval = lowest_latency;
4857 + case bulk_latency: /* 250 usec aka 4000 ints/s */
4858 + if (bytes > 25000) {
4860 + retval = low_latency;
4861 + } else if (bytes < 6000) {
4862 + retval = low_latency;
4867 - /* Dynamic mode for Interrupt Throttle Rate (ITR) */
4868 - if (adapter->hw.mac_type >= iegbe_82540 && adapter->itr == 0x1) {
4869 - /* Symmetric Tx/Rx gets a reduced ITR=2000; Total
4870 - * asymmetrical Tx or Rx gets ITR=8000; everyone
4871 - * else is between 2000-8000. */
4872 - uint32_t goc = (adapter->gotcl + adapter->gorcl) / 0x2710;
4873 - uint32_t dif = (adapter->gotcl > adapter->gorcl ?
4874 - adapter->gotcl - adapter->gorcl :
4875 - adapter->gorcl - adapter->gotcl) / 0x2710;
4876 - uint32_t itr = goc > 0 ? (dif * 0x1770 / goc + 0x7d0) : 0x1f40;
4877 - E1000_WRITE_REG(&adapter->hw, ITR, 0x3b9aca00 / (itr * 0x100));
4883 - /* Cause software interrupt to ensure rx ring is cleaned */
4884 - E1000_WRITE_REG(&adapter->hw, ICS, E1000_ICS_RXDMT0);
4885 +static void iegbe_set_itr(struct iegbe_adapter *adapter)
4887 + struct iegbe_hw *hw = &adapter->hw;
4889 + u32 new_itr = adapter->itr;
4891 - /* Force detection of hung controller every watchdog period */
4892 - adapter->detect_tx_hung = TRUE;
4893 + if (unlikely(hw->mac_type < iegbe_82540))
4896 - /* With 82571 controllers, LAA may be overwritten due to controller
4897 - * reset from the other port. Set the appropriate LAA in RAR[0] */
4898 - if (adapter->hw.mac_type == iegbe_82571 && adapter->hw.laa_is_present) {
4899 - iegbe_rar_set(&adapter->hw, adapter->hw.mac_addr, 0);
4901 - /* Reset the timer */
4902 - mod_timer(&adapter->watchdog_timer, jiffies + 0x2 * HZ);
4903 + /* for non-gigabit speeds, just fix the interrupt rate at 4000 */
4904 + if (unlikely(adapter->link_speed != SPEED_1000)) {
4910 + adapter->tx_itr = iegbe_update_itr(adapter,
4912 + adapter->total_tx_packets,
4913 + adapter->total_tx_bytes);
4914 + /* conservative mode (itr 3) eliminates the lowest_latency setting */
4915 + if (adapter->itr_setting == 3 && adapter->tx_itr == lowest_latency)
4916 + adapter->tx_itr = low_latency;
4918 + adapter->rx_itr = iegbe_update_itr(adapter,
4920 + adapter->total_rx_packets,
4921 + adapter->total_rx_bytes);
4922 + /* conservative mode (itr 3) eliminates the lowest_latency setting */
4923 + if (adapter->itr_setting == 3 && adapter->rx_itr == lowest_latency)
4924 + adapter->rx_itr = low_latency;
4926 + current_itr = max(adapter->rx_itr, adapter->tx_itr);
4928 + switch (current_itr) {
4929 + /* counts and packets in update_itr are dependent on these numbers */
4930 + case lowest_latency:
4934 + new_itr = 20000; /* aka hwitr = ~200 */
4936 + case bulk_latency:
4944 + if (new_itr != adapter->itr) {
4945 + /* this attempts to bias the interrupt rate towards Bulk
4946 + * by adding intermediate steps when interrupt rate is
4948 + new_itr = new_itr > adapter->itr ?
4949 + min(adapter->itr + (new_itr >> 2), new_itr) :
4951 + adapter->itr = new_itr;
4952 + E1000_WRITE_REG(&adapter->hw, ITR, 1000000000 / (new_itr * 256));
4958 #define E1000_TX_FLAGS_CSUM 0x00000001
4959 @@ -2673,55 +2641,48 @@ iegbe_watchdog(unsigned long data)
4960 #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000
4961 #define E1000_TX_FLAGS_VLAN_SHIFT 16
4964 -iegbe_tso(struct iegbe_adapter *adapter, struct iegbe_tx_ring *tx_ring,
4965 - struct sk_buff *skb)
4966 +static int iegbe_tso(struct iegbe_adapter *adapter,
4967 + struct iegbe_tx_ring *tx_ring, struct sk_buff *skb)
4970 struct iegbe_context_desc *context_desc;
4971 + struct iegbe_buffer *buffer_info;
4973 - uint32_t cmd_length = 0;
4974 - uint16_t ipcse = 0, tucse, mss;
4975 - uint8_t ipcss, ipcso, tucss, tucso, hdr_len;
4976 + u32 cmd_length = 0;
4977 + u16 ipcse = 0, tucse, mss;
4978 + u8 ipcss, ipcso, tucss, tucso, hdr_len;
4981 if (skb_is_gso(skb)) {
4982 if (skb_header_cloned(skb)) {
4983 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
4990 - hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 0x2));
4991 + hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
4992 mss = skb_shinfo(skb)->gso_size;
4993 if (skb->protocol == htons(ETH_P_IP)) {
4994 - skb->nh.iph->tot_len = 0;
4995 - skb->nh.iph->check = 0;
4996 - skb->h.th->check =
4997 - ~csum_tcpudp_magic(skb->nh.iph->saddr,
4998 - skb->nh.iph->daddr,
5002 + struct iphdr *iph = ip_hdr(skb);
5005 + tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
5009 cmd_length = E1000_TXD_CMD_IP;
5010 - ipcse = skb->h.raw - skb->data - 0x1;
5011 -#ifdef NETIF_F_TSO_IPV6
5012 - } else if (skb->protocol == ntohs(ETH_P_IPV6)) {
5013 - skb->nh.ipv6h->payload_len = 0;
5014 - skb->h.th->check =
5015 - ~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
5016 - &skb->nh.ipv6h->daddr,
5020 + ipcse = skb_transport_offset(skb) - 1;
5021 + } else if (skb->protocol == htons(ETH_P_IPV6)) {
5022 + ipv6_hdr(skb)->payload_len = 0;
5023 + tcp_hdr(skb)->check =
5024 + ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
5025 + &ipv6_hdr(skb)->daddr,
5026 + 0, IPPROTO_TCP, 0);
5030 - ipcss = skb->nh.raw - skb->data;
5031 - ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data;
5032 - tucss = skb->h.raw - skb->data;
5033 - tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
5034 + ipcss = skb_network_offset(skb);
5035 + ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
5036 + tucss = skb_transport_offset(skb);
5037 + tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data;
5040 cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |
5041 @@ -2729,6 +2690,7 @@ iegbe_tso(struct iegbe_adapter *adapter,
5043 i = tx_ring->next_to_use;
5044 context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
5045 + buffer_info = &tx_ring->buffer_info[i];
5047 context_desc->lower_setup.ip_fields.ipcss = ipcss;
5048 context_desc->lower_setup.ip_fields.ipcso = ipcso;
5049 @@ -2740,205 +2702,218 @@ iegbe_tso(struct iegbe_adapter *adapter,
5050 context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;
5051 context_desc->cmd_and_length = cpu_to_le32(cmd_length);
5053 - if (++i == tx_ring->count) { i = 0; }
5054 + buffer_info->time_stamp = jiffies;
5055 + buffer_info->next_to_watch = i;
5057 + if (++i == tx_ring->count) i = 0;
5058 tx_ring->next_to_use = i;
5069 -static inline boolean_t
5070 -iegbe_tx_csum(struct iegbe_adapter *adapter, struct iegbe_tx_ring *tx_ring,
5071 - struct sk_buff *skb)
5072 +static bool iegbe_tx_csum(struct iegbe_adapter *adapter,
5073 + struct iegbe_tx_ring *tx_ring, struct sk_buff *skb)
5075 struct iegbe_context_desc *context_desc;
5076 + struct iegbe_buffer *buffer_info;
5081 - if (likely(skb->ip_summed == CHECKSUM_HW)) {
5082 - css = skb->h.raw - skb->data;
5083 + if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) {
5084 + css = skb_transport_offset(skb);
5086 - i = tx_ring->next_to_use;
5087 - context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
5088 + i = tx_ring->next_to_use;
5089 + buffer_info = &tx_ring->buffer_info[i];
5090 + context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
5092 + context_desc->lower_setup.ip_config = 0;
5093 context_desc->upper_setup.tcp_fields.tucss = css;
5094 - context_desc->upper_setup.tcp_fields.tucso = css + skb->csum;
5095 + context_desc->upper_setup.tcp_fields.tucso =
5096 + css + skb->csum_offset;
5097 context_desc->upper_setup.tcp_fields.tucse = 0;
5098 context_desc->tcp_seg_setup.data = 0;
5099 context_desc->cmd_and_length = cpu_to_le32(E1000_TXD_CMD_DEXT);
5101 - if (unlikely(++i == tx_ring->count)) { i = 0; }
5102 + buffer_info->time_stamp = jiffies;
5103 + buffer_info->next_to_watch = i;
5105 + if (unlikely(++i == tx_ring->count)) i = 0;
5106 tx_ring->next_to_use = i;
5116 -#define E1000_MAX_TXD_PWR 12
5117 -#define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR)
5118 +#define E1000_MAX_TXD_PWR 12
5119 +#define E1000_MAX_DATA_PER_TXD (1<<E1000_MAX_TXD_PWR)
5122 -iegbe_tx_map(struct iegbe_adapter *adapter, struct iegbe_tx_ring *tx_ring,
5123 - struct sk_buff *skb, unsigned int first, unsigned int max_per_txd,
5124 - unsigned int nr_frags, unsigned int mss)
5125 +static int iegbe_tx_map(struct iegbe_adapter *adapter,
5126 + struct iegbe_tx_ring *tx_ring,
5127 + struct sk_buff *skb, unsigned int first,
5128 + unsigned int max_per_txd, unsigned int nr_frags,
5131 - struct iegbe_buffer *buffer_info;
5132 - unsigned int len = skb->len;
5133 + struct iegbe_hw *hw = &adapter->hw;
5134 + struct iegbe_buffer *buffer_info;
5135 + unsigned int len = skb->len;
5136 unsigned int offset = 0, size, count = 0, i;
5137 -#ifdef MAX_SKB_FRAGS
5139 - len -= skb->data_len;
5142 + len -= skb->data_len;
5144 - i = tx_ring->next_to_use;
5145 + i = tx_ring->next_to_use;
5148 + buffer_info = &tx_ring->buffer_info[i];
5149 + size = min(len, max_per_txd);
5150 + /* Workaround for Controller erratum --
5151 + * descriptor for non-tso packet in a linear SKB that follows a
5152 + * tso gets written back prematurely before the data is fully
5153 + * DMA'd to the controller */
5154 + if (!skb->data_len && tx_ring->last_tx_tso &&
5155 + !skb_is_gso(skb)) {
5156 + tx_ring->last_tx_tso = 0;
5161 - buffer_info = &tx_ring->buffer_info[i];
5162 - size = min(len, max_per_txd);
5164 /* Workaround for premature desc write-backs
5165 * in TSO mode. Append 4-byte sentinel desc */
5166 - if(unlikely(mss && !nr_frags && size == len && size > 0x8)) {
5168 + if (unlikely(mss && !nr_frags && size == len && size > 8))
5170 + /* work-around for errata 10 and it applies
5171 + * to all controllers in PCI-X mode
5172 + * The fix is to make sure that the first descriptor of a
5173 + * packet is smaller than 2048 - 16 - 16 (or 2016) bytes
5175 + if (unlikely((hw->bus_type == iegbe_bus_type_pcix) &&
5176 + (size > 2015) && count == 0))
5179 + /* Workaround for potential 82544 hang in PCI-X. Avoid
5180 + * terminating buffers within evenly-aligned dwords. */
5181 + if(unlikely(adapter->pcix_82544 &&
5182 + !((unsigned long)(skb->data + offset + size - 1) & 4) &&
5186 + buffer_info->length = size;
5187 + buffer_info->dma =
5188 + pci_map_single(adapter->pdev,
5189 + skb->data + offset,
5191 + PCI_DMA_TODEVICE);
5192 + buffer_info->time_stamp = jiffies;
5193 + buffer_info->next_to_watch = i;
5198 + if (unlikely(++i == tx_ring->count)) i = 0;
5201 + for (f = 0; f < nr_frags; f++) {
5202 + struct skb_frag_struct *frag;
5204 + frag = &skb_shinfo(skb)->frags[f];
5206 + offset = frag->page_offset;
5209 + buffer_info = &tx_ring->buffer_info[i];
5210 + size = min(len, max_per_txd);
5211 + /* Workaround for premature desc write-backs
5212 + * in TSO mode. Append 4-byte sentinel desc */
5213 + if (unlikely(mss && f == (nr_frags-1) && size == len && size > 8))
5215 + /* Workaround for potential 82544 hang in PCI-X.
5216 + * Avoid terminating buffers within evenly-aligned
5218 + if(unlikely(adapter->pcix_82544 &&
5219 + !((unsigned long)(frag->page+offset+size-1) & 4) &&
5223 + buffer_info->length = size;
5224 + buffer_info->dma =
5225 + pci_map_page(adapter->pdev,
5229 + PCI_DMA_TODEVICE);
5230 + buffer_info->time_stamp = jiffies;
5231 + buffer_info->next_to_watch = i;
5236 + if (unlikely(++i == tx_ring->count)) i = 0;
5239 - /* work-around for errata 10 and it applies
5240 - * to all controllers in PCI-X mode
5241 - * The fix is to make sure that the first descriptor of a
5242 - * packet is smaller than 2048 - 16 - 16 (or 2016) bytes
5244 - if(unlikely((adapter->hw.bus_type == iegbe_bus_type_pcix) &&
5245 - (size > 0x7df) && count == 0)) {
5248 - /* Workaround for potential 82544 hang in PCI-X. Avoid
5249 - * terminating buffers within evenly-aligned dwords. */
5250 - if(unlikely(adapter->pcix_82544 &&
5251 - !((unsigned long)(skb->data + offset + size - 0x8) & 0x4) &&
5255 - buffer_info->length = size;
5256 - buffer_info->dma =
5257 - pci_map_single(adapter->pdev,
5258 - skb->data + offset,
5260 - PCI_DMA_TODEVICE);
5261 - buffer_info->time_stamp = jiffies;
5266 - if(unlikely(++i == tx_ring->count)) { i = 0; }
5269 -#ifdef MAX_SKB_FRAGS
5270 - for(f = 0; f < nr_frags; f++) {
5271 - struct skb_frag_struct *frag;
5273 - frag = &skb_shinfo(skb)->frags[f];
5275 - offset = frag->page_offset;
5278 - buffer_info = &tx_ring->buffer_info[i];
5279 - size = min(len, max_per_txd);
5281 - /* Workaround for premature desc write-backs
5282 - * in TSO mode. Append 4-byte sentinel desc */
5283 - if(unlikely(mss && f == (nr_frags-0x1) &&
5284 - size == len && size > 0x8)) {
5288 - /* Workaround for potential 82544 hang in PCI-X.
5289 - * Avoid terminating buffers within evenly-aligned
5291 - if(unlikely(adapter->pcix_82544 &&
5292 - !((unsigned long)(frag->page+offset+size-0x1) & 0x4) &&
5296 - buffer_info->length = size;
5297 - buffer_info->dma =
5298 - pci_map_page(adapter->pdev,
5302 - PCI_DMA_TODEVICE);
5303 - buffer_info->time_stamp = jiffies;
5308 - if(unlikely(++i == tx_ring->count)) { i = 0; }
5314 - i = (i == 0) ? tx_ring->count - 0x1 : i - 0x1;
5315 - tx_ring->buffer_info[i].skb = skb;
5316 - tx_ring->buffer_info[first].next_to_watch = i;
5317 + i = (i == 0) ? tx_ring->count - 1 : i - 1;
5318 + tx_ring->buffer_info[i].skb = skb;
5319 + tx_ring->buffer_info[first].next_to_watch = i;
5326 -iegbe_tx_queue(struct iegbe_adapter *adapter, struct iegbe_tx_ring *tx_ring,
5327 - int tx_flags, int count)
5328 +static void iegbe_tx_queue(struct iegbe_adapter *adapter,
5329 + struct iegbe_tx_ring *tx_ring, int tx_flags,
5332 + struct iegbe_hw *hw = &adapter->hw;
5333 struct iegbe_tx_desc *tx_desc = NULL;
5334 struct iegbe_buffer *buffer_info;
5335 - uint32_t txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS;
5336 + u32 txd_upper = 0, txd_lower = E1000_TXD_CMD_IFCS;
5339 - if(likely(tx_flags & E1000_TX_FLAGS_TSO)) {
5340 + if (likely(tx_flags & E1000_TX_FLAGS_TSO)) {
5341 txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D |
5343 - txd_upper |= E1000_TXD_POPTS_TXSM << 0x8;
5344 + txd_upper |= E1000_TXD_POPTS_TXSM << 8;
5346 - if(likely(tx_flags & E1000_TX_FLAGS_IPV4)) {
5347 - txd_upper |= E1000_TXD_POPTS_IXSM << 0x8;
5349 + if (likely(tx_flags & E1000_TX_FLAGS_IPV4))
5350 + txd_upper |= E1000_TXD_POPTS_IXSM << 8;
5353 - if(likely(tx_flags & E1000_TX_FLAGS_CSUM)) {
5354 + if (likely(tx_flags & E1000_TX_FLAGS_CSUM)) {
5355 txd_lower |= E1000_TXD_CMD_DEXT | E1000_TXD_DTYP_D;
5356 - txd_upper |= E1000_TXD_POPTS_TXSM << 0x8;
5359 - if(unlikely(tx_flags & E1000_TX_FLAGS_VLAN)) {
5360 - txd_lower |= E1000_TXD_CMD_VLE;
5361 - txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK);
5362 + txd_upper |= E1000_TXD_POPTS_TXSM << 8;
5365 - i = tx_ring->next_to_use;
5366 + if(unlikely(tx_flags & E1000_TX_FLAGS_VLAN)) {
5367 + txd_lower |= E1000_TXD_CMD_VLE;
5368 + txd_upper |= (tx_flags & E1000_TX_FLAGS_VLAN_MASK);
5372 - buffer_info = &tx_ring->buffer_info[i];
5373 - tx_desc = E1000_TX_DESC(*tx_ring, i);
5374 - tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
5375 - tx_desc->lower.data =
5376 - cpu_to_le32(txd_lower | buffer_info->length);
5377 - tx_desc->upper.data = cpu_to_le32(txd_upper);
5378 - if(unlikely(++i == tx_ring->count)) { i = 0; }
5380 - if(tx_desc != NULL) {
5381 - tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd);
5383 - /* Force memory writes to complete before letting h/w
5384 - * know there are new descriptors to fetch. (Only
5385 - * applicable for weak-ordered memory model archs,
5386 - * such as IA-64). */
5388 + i = tx_ring->next_to_use;
5390 - tx_ring->next_to_use = i;
5391 - writel(i, adapter->hw.hw_addr + tx_ring->tdt);
5393 + buffer_info = &tx_ring->buffer_info[i];
5394 + tx_desc = E1000_TX_DESC(*tx_ring, i);
5395 + tx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
5396 + tx_desc->lower.data =
5397 + cpu_to_le32(txd_lower | buffer_info->length);
5398 + tx_desc->upper.data = cpu_to_le32(txd_upper);
5399 + if (unlikely(++i == tx_ring->count)) i = 0;
5402 + tx_desc->lower.data |= cpu_to_le32(adapter->txd_cmd);
5404 + /* Force memory writes to complete before letting h/w
5405 + * know there are new descriptors to fetch. (Only
5406 + * applicable for weak-ordered memory model archs,
5407 + * such as IA-64). */
5410 + tx_ring->next_to_use = i;
5411 + writel(i, hw->hw_addr + tx_ring->tdt);
5412 + /* we need this if more than one processor can write to our tail
5413 + * at a time, it syncronizes IO on IA64/Altix systems */
5418 @@ -2950,113 +2925,132 @@ iegbe_tx_queue(struct iegbe_adapter *ada
5419 * to the beginning of the Tx FIFO.
5423 -iegbe_82547_fifo_workaround(struct iegbe_adapter *adapter, struct sk_buff *skb)
5424 +#define E1000_FIFO_HDR 0x10
5425 +#define E1000_82547_PAD_LEN 0x3E0
5426 +static int iegbe_82547_fifo_workaround(struct iegbe_adapter *adapter,
5427 + struct sk_buff *skb)
5429 - uint32_t fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head;
5430 - uint32_t skb_fifo_len = skb->len + E1000_FIFO_HDR;
5431 + u32 fifo_space = adapter->tx_fifo_size - adapter->tx_fifo_head;
5432 + u32 skb_fifo_len = skb->len + E1000_FIFO_HDR;
5434 - E1000_ROUNDUP(skb_fifo_len, E1000_FIFO_HDR);
5435 + skb_fifo_len = ALIGN(skb_fifo_len, E1000_FIFO_HDR);
5437 - if(adapter->link_duplex != HALF_DUPLEX) {
5438 - goto no_fifo_stall_required;
5440 - if(atomic_read(&adapter->tx_fifo_stall)) {
5442 + if (adapter->link_duplex != HALF_DUPLEX)
5443 + goto no_fifo_stall_required;
5445 + if (atomic_read(&adapter->tx_fifo_stall))
5448 + if(skb_fifo_len >= (E1000_82547_PAD_LEN + fifo_space)) {
5449 + atomic_set(&adapter->tx_fifo_stall, 1);
5452 - if(skb_fifo_len >= (E1000_82547_PAD_LEN + fifo_space)) {
5453 - atomic_set(&adapter->tx_fifo_stall, 0x1);
5457 no_fifo_stall_required:
5458 - adapter->tx_fifo_head += skb_fifo_len;
5459 - if(adapter->tx_fifo_head >= adapter->tx_fifo_size) {
5460 - adapter->tx_fifo_head -= adapter->tx_fifo_size;
5462 + adapter->tx_fifo_head += skb_fifo_len;
5463 + if (adapter->tx_fifo_head >= adapter->tx_fifo_size)
5464 + adapter->tx_fifo_head -= adapter->tx_fifo_size;
5469 -iegbe_transfer_dhcp_info(struct iegbe_adapter *adapter, struct sk_buff *skb)
5470 +#define MINIMUM_DHCP_PACKET_SIZE 282
5471 +static int iegbe_transfer_dhcp_info(struct iegbe_adapter *adapter,
5472 + struct sk_buff *skb)
5474 struct iegbe_hw *hw = &adapter->hw;
5475 - uint16_t length, offset;
5476 -#ifdef NETIF_F_HW_VLAN_TX
5477 - if(vlan_tx_tag_present(skb)) {
5478 - if(!((vlan_tx_tag_get(skb) == adapter->hw.mng_cookie.vlan_id) &&
5479 - ( adapter->hw.mng_cookie.status &
5480 - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) ) {
5481 + u16 length, offset;
5482 + if (vlan_tx_tag_present(skb)) {
5483 + if (!((vlan_tx_tag_get(skb) == hw->mng_cookie.vlan_id) &&
5484 + ( hw->mng_cookie.status &
5485 + E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT)) )
5490 - if(htons(ETH_P_IP) == skb->protocol) {
5491 - const struct iphdr *ip = skb->nh.iph;
5492 - if(IPPROTO_UDP == ip->protocol) {
5493 - struct udphdr *udp = (struct udphdr *)(skb->h.uh);
5494 - if(ntohs(udp->dest) == 0x43) { /* 0x43 = 67 */
5495 - offset = (uint8_t *)udp + 0x8 - skb->data;
5496 - length = skb->len - offset;
5498 - return iegbe_mng_write_dhcp_info(hw,
5499 - (uint8_t *)udp + 0x8, length);
5502 - } else if((skb->len > MINIMUM_DHCP_PACKET_SIZE) && (!skb->protocol)) {
5503 - struct ethhdr *eth = (struct ethhdr *) skb->data;
5504 - if((htons(ETH_P_IP) == eth->h_proto)) {
5505 + if (skb->len > MINIMUM_DHCP_PACKET_SIZE) {
5506 + struct ethhdr *eth = (struct ethhdr *)skb->data;
5507 + if ((htons(ETH_P_IP) == eth->h_proto)) {
5508 const struct iphdr *ip =
5509 - (struct iphdr *)((uint8_t *)skb->data+0xe);
5510 - if(IPPROTO_UDP == ip->protocol) {
5511 + (struct iphdr *)((u8 *)skb->data+14);
5512 + if (IPPROTO_UDP == ip->protocol) {
5513 struct udphdr *udp =
5514 - (struct udphdr *)((uint8_t *)ip +
5515 - (ip->ihl << 0x2));
5516 - if(ntohs(udp->dest) == 0x43) {
5517 - offset = (uint8_t *)udp + 0x8 - skb->data;
5518 + (struct udphdr *)((u8 *)ip +
5520 + if (ntohs(udp->dest) == 67) {
5521 + offset = (u8 *)udp + 8 - skb->data;
5522 length = skb->len - offset;
5524 return iegbe_mng_write_dhcp_info(hw,
5525 - (uint8_t *)udp + 0x8,
5537 -iegbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
5538 +static int __iegbe_maybe_stop_tx(struct net_device *netdev, int size)
5540 + struct iegbe_adapter *adapter = netdev_priv(netdev);
5541 + struct iegbe_tx_ring *tx_ring = adapter->tx_ring;
5543 + netif_stop_queue(netdev);
5544 + /* Herbert's original patch had:
5545 + * smp_mb__after_netif_stop_queue();
5546 + * but since that doesn't exist yet, just open code it. */
5549 + /* We need to check again in a case another CPU has just
5550 + * made room available. */
5551 + if (likely(E1000_DESC_UNUSED(tx_ring) < size))
5555 + netif_start_queue(netdev);
5556 + ++adapter->restart_queue;
5560 +static int iegbe_maybe_stop_tx(struct net_device *netdev,
5561 + struct iegbe_tx_ring *tx_ring, int size)
5563 + if (likely(E1000_DESC_UNUSED(tx_ring) >= size))
5565 + return __iegbe_maybe_stop_tx(netdev, size);
5568 +#define TXD_USE_COUNT(S, X) (((S) >> (X)) + 1 )
5569 +static int iegbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
5571 struct iegbe_adapter *adapter = netdev_priv(netdev);
5572 + struct iegbe_hw *hw = &adapter->hw;
5573 struct iegbe_tx_ring *tx_ring;
5574 unsigned int first, max_per_txd = E1000_MAX_DATA_PER_TXD;
5575 unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
5576 unsigned int tx_flags = 0;
5577 - unsigned int len = skb->len;
5578 + unsigned int len = skb->len - skb->data_len;
5579 unsigned long flags = 0;
5580 - unsigned int nr_frags = 0;
5581 - unsigned int mss = 0;
5582 + unsigned int nr_frags;
5586 -#ifdef MAX_SKB_FRAGS
5589 - len -= skb->data_len;
5592 -#ifdef CONFIG_E1000_MQ
5593 - tx_ring = *per_cpu_ptr(adapter->cpu_tx_ring, smp_processor_id());
5595 + /* This goes back to the question of how to logically map a tx queue
5596 + * to a flow. Right now, performance is impacted slightly negatively
5597 + * if using multiple tx queues. If the stack breaks away from a
5598 + * single qdisc implementation, we can look at this again. */
5599 tx_ring = adapter->tx_ring;
5602 if (unlikely(skb->len <= 0)) {
5603 dev_kfree_skb_any(skb);
5604 return NETDEV_TX_OK;
5608 + /* 82571 and newer doesn't need the workaround that limited descriptor
5609 + * length to 4kB */
5610 + if (hw->mac_type >= iegbe_82571)
5611 + max_per_txd = 8192;
5613 mss = skb_shinfo(skb)->gso_size;
5614 /* The controller does a simple calculation to
5615 * make sure there is enough room in the FIFO before
5616 @@ -3064,164 +3058,150 @@ iegbe_xmit_frame(struct sk_buff *skb, st
5617 * 4 = ceil(buffer len/mss). To make sure we don't
5618 * overrun the FIFO, adjust the max buffer len if mss
5621 - max_per_txd = min(mss << 0x2, max_per_txd);
5622 - max_txd_pwr = fls(max_per_txd) - 0x1;
5625 + max_per_txd = min(mss << 2, max_per_txd);
5626 + max_txd_pwr = fls(max_per_txd) - 1;
5628 + /* TSO Workaround for 82571/2/3 Controllers -- if skb->data
5629 + * points to just header, pull a few bytes of payload from
5630 + * frags into skb->data */
5631 + hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
5632 + if (skb->data_len && hdr_len == len) {
5633 + switch (hw->mac_type) {
5635 + /* Make sure we have room to chop off 4 bytes,
5636 + * and that the end alignment will work out to
5637 + * this hardware's requirements
5638 + * NOTE: this is a TSO only workaround
5639 + * if end byte alignment not correct move us
5640 + * into the next dword */
5642 + /* fall through */
5654 - if((mss) || (skb->ip_summed == CHECKSUM_HW)) {
5655 + /* reserve a descriptor for the offload context */
5656 + if ((mss) || (skb->ip_summed == CHECKSUM_PARTIAL))
5661 - if(skb->ip_summed == CHECKSUM_HW) {
5663 + /* Controller Erratum workaround */
5664 + if (!skb->data_len && tx_ring->last_tx_tso && !skb_is_gso(skb))
5669 count += TXD_USE_COUNT(len, max_txd_pwr);
5671 - if(adapter->pcix_82544) {
5672 + if (adapter->pcix_82544)
5676 /* work-around for errata 10 and it applies to all controllers
5677 * in PCI-X mode, so add one more descriptor to the count
5679 - if(unlikely((adapter->hw.bus_type == iegbe_bus_type_pcix) &&
5681 + if (unlikely((hw->bus_type == iegbe_bus_type_pcix) &&
5685 -#ifdef MAX_SKB_FRAGS
5687 nr_frags = skb_shinfo(skb)->nr_frags;
5688 - for(f = 0; f < nr_frags; f++)
5689 + for (f = 0; f < nr_frags; f++)
5690 count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size,
5692 - if(adapter->pcix_82544) {
5693 + if (adapter->pcix_82544)
5697 - /* TSO Workaround for 82571/2 Controllers -- if skb->data
5698 - * points to just header, pull a few bytes of payload from
5699 - * frags into skb->data */
5700 - if (skb_is_gso(skb)) {
5702 - hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 0x2));
5703 - if (skb->data_len && (hdr_len < (skb->len - skb->data_len)) &&
5704 - (adapter->hw.mac_type == iegbe_82571 ||
5705 - adapter->hw.mac_type == iegbe_82572)) {
5706 - unsigned int pull_size;
5707 - pull_size = min((unsigned int)0x4, skb->data_len);
5708 - if (!__pskb_pull_tail(skb, pull_size)) {
5709 - printk(KERN_ERR "__pskb_pull_tail failed.\n");
5710 - dev_kfree_skb_any(skb);
5718 - if(adapter->hw.tx_pkt_filtering && (adapter->hw.mac_type == iegbe_82573) ) {
5720 + if (hw->tx_pkt_filtering &&
5721 + (hw->mac_type == iegbe_82573))
5722 iegbe_transfer_dhcp_info(adapter, skb);
5724 -#ifdef NETIF_F_LLTX
5725 - local_irq_save(flags);
5726 - if (!spin_trylock(&tx_ring->tx_lock)) {
5728 + if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags))
5729 /* Collision - tell upper layer to requeue */
5730 - local_irq_restore(flags);
5731 return NETDEV_TX_LOCKED;
5734 - spin_lock_irqsave(&tx_ring->tx_lock, flags);
5737 /* need: count + 2 desc gap to keep tail from touching
5738 * head, otherwise try next time */
5739 - if (unlikely(E1000_DESC_UNUSED(tx_ring) < count + 0x2)) {
5740 - netif_stop_queue(netdev);
5741 + if (unlikely(iegbe_maybe_stop_tx(netdev, tx_ring, count + 2))) {
5742 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
5743 return NETDEV_TX_BUSY;
5746 - if(unlikely(adapter->hw.mac_type == iegbe_82547)) {
5747 - if(unlikely(iegbe_82547_fifo_workaround(adapter, skb))) {
5748 + if (unlikely(hw->mac_type == iegbe_82547)) {
5749 + if (unlikely(iegbe_82547_fifo_workaround(adapter, skb))) {
5750 netif_stop_queue(netdev);
5751 - mod_timer(&adapter->tx_fifo_stall_timer, jiffies);
5752 + mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 1);
5753 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
5754 return NETDEV_TX_BUSY;
5758 -#ifndef NETIF_F_LLTX
5759 - spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
5762 -#ifdef NETIF_F_HW_VLAN_TX
5763 - if(unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
5764 + if (unlikely(adapter->vlgrp && vlan_tx_tag_present(skb))) {
5765 tx_flags |= E1000_TX_FLAGS_VLAN;
5766 tx_flags |= (vlan_tx_tag_get(skb) << E1000_TX_FLAGS_VLAN_SHIFT);
5770 first = tx_ring->next_to_use;
5772 tso = iegbe_tso(adapter, tx_ring, skb);
5774 dev_kfree_skb_any(skb);
5775 -#ifdef NETIF_F_LLTX
5776 spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
5778 return NETDEV_TX_OK;
5781 - if (likely(tso)) {
5782 + if (likely(tso)) {
5783 + tx_ring->last_tx_tso = 1;
5784 tx_flags |= E1000_TX_FLAGS_TSO;
5785 - } else if (likely(iegbe_tx_csum(adapter, tx_ring, skb))) {
5786 + } else if (likely(iegbe_tx_csum(adapter, tx_ring, skb)))
5787 tx_flags |= E1000_TX_FLAGS_CSUM;
5790 /* Old method was to assume IPv4 packet by default if TSO was enabled.
5791 * 82571 hardware supports TSO capabilities for IPv6 as well...
5792 * no longer assume, we must. */
5793 - if (likely(skb->protocol == ntohs(ETH_P_IP))) {
5794 + if (likely(skb->protocol == htons(ETH_P_IP)))
5795 tx_flags |= E1000_TX_FLAGS_IPV4;
5798 iegbe_tx_queue(adapter, tx_ring, tx_flags,
5799 iegbe_tx_map(adapter, tx_ring, skb, first,
5800 max_per_txd, nr_frags, mss));
5802 netdev->trans_start = jiffies;
5804 -#ifdef NETIF_F_LLTX
5805 /* Make sure there is space in the ring for the next send. */
5806 - if (unlikely(E1000_DESC_UNUSED(tx_ring) < MAX_SKB_FRAGS + 0x2)) {
5807 - netif_stop_queue(netdev);
5809 - spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
5811 + iegbe_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2);
5813 + spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
5814 return NETDEV_TX_OK;
5819 * iegbe_tx_timeout - Respond to a Tx Hang
5820 * @netdev: network interface device structure
5824 -iegbe_tx_timeout(struct net_device *netdev)
5825 +static void iegbe_tx_timeout(struct net_device *netdev)
5827 - struct iegbe_adapter *adapter = netdev_priv(netdev);
5828 + struct iegbe_adapter *adapter = netdev_priv(netdev);
5830 - /* Do the reset outside of interrupt context */
5831 - schedule_work(&adapter->tx_timeout_task);
5832 + /* Do the reset outside of interrupt context */
5833 + adapter->tx_timeout_count++;
5834 + schedule_work(&adapter->reset_task);
5838 -iegbe_tx_timeout_task(struct net_device *netdev)
5839 +static void iegbe_reset_task(struct work_struct *work)
5841 - struct iegbe_adapter *adapter = netdev_priv(netdev);
5842 + struct iegbe_adapter *adapter =
5843 + container_of(work, struct iegbe_adapter, reset_task);
5845 - iegbe_down(adapter);
5846 - iegbe_up(adapter);
5847 + iegbe_reinit_locked(adapter);
5851 @@ -3232,13 +3212,12 @@ iegbe_tx_timeout_task(struct net_device
5852 * The statistics are actually updated from the timer callback.
5855 -static struct net_device_stats *
5856 -iegbe_get_stats(struct net_device *netdev)
5857 +static struct net_device_stats *iegbe_get_stats(struct net_device *netdev)
5859 - struct iegbe_adapter *adapter = netdev_priv(netdev);
5860 + struct iegbe_adapter *adapter = netdev_priv(netdev);
5862 - iegbe_update_stats(adapter);
5863 - return &adapter->net_stats;
5864 + /* only return the current stats */
5865 + return &adapter->net_stats;
5869 @@ -3249,67 +3228,55 @@ iegbe_get_stats(struct net_device *netde
5870 * Returns 0 on success, negative on failure
5874 -iegbe_change_mtu(struct net_device *netdev, int new_mtu)
5875 +static int iegbe_change_mtu(struct net_device *netdev, int new_mtu)
5877 - struct iegbe_adapter *adapter = netdev_priv(netdev);
5878 - int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
5879 + struct iegbe_adapter *adapter = netdev_priv(netdev);
5880 + struct iegbe_hw *hw = &adapter->hw;
5881 + int max_frame = new_mtu + ENET_HEADER_SIZE + ETHERNET_FCS_SIZE;
5883 - if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
5884 - (max_frame > MAX_JUMBO_FRAME_SIZE)) {
5885 - DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
5888 + if((max_frame < MINIMUM_ETHERNET_FRAME_SIZE) ||
5889 + (max_frame > MAX_JUMBO_FRAME_SIZE)) {
5890 + DPRINTK(PROBE, ERR, "Invalid MTU setting\n");
5894 + /* Adapter-specific max frame size limits. */
5895 + switch (hw->mac_type) {
5896 + case iegbe_undefined ... iegbe_82542_rev2_1:
5897 + if (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) {
5898 + DPRINTK(PROBE, ERR, "Jumbo Frames not supported.\n");
5904 #define MAX_STD_JUMBO_FRAME_SIZE 9234
5905 - /* might want this to be bigger enum check... */
5906 - /* 82571 controllers limit jumbo frame size to 10500 bytes */
5907 - if ((adapter->hw.mac_type == iegbe_82571 ||
5908 - adapter->hw.mac_type == iegbe_82572) &&
5909 - max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
5910 - DPRINTK(PROBE, ERR, "MTU > 9216 bytes not supported "
5911 - "on 82571 and 82572 controllers.\n");
5915 - if(adapter->hw.mac_type == iegbe_82573 &&
5916 - max_frame > MAXIMUM_ETHERNET_FRAME_SIZE) {
5917 - DPRINTK(PROBE, ERR, "Jumbo Frames not supported "
5922 - if(adapter->hw.mac_type > iegbe_82547_rev_2) {
5923 - adapter->rx_buffer_len = max_frame;
5924 - E1000_ROUNDUP(adapter->rx_buffer_len, 0x1024);
5926 - if(unlikely((adapter->hw.mac_type < iegbe_82543) &&
5927 - (max_frame > MAXIMUM_ETHERNET_FRAME_SIZE))) {
5928 - DPRINTK(PROBE, ERR, "Jumbo Frames not supported "
5933 - if(max_frame <= E1000_RXBUFFER_2048) {
5934 - adapter->rx_buffer_len = E1000_RXBUFFER_2048;
5935 - } else if(max_frame <= E1000_RXBUFFER_4096) {
5936 - adapter->rx_buffer_len = E1000_RXBUFFER_4096;
5937 - } else if(max_frame <= E1000_RXBUFFER_8192) {
5938 - adapter->rx_buffer_len = E1000_RXBUFFER_8192;
5939 - } else if(max_frame <= E1000_RXBUFFER_16384) {
5940 - adapter->rx_buffer_len = E1000_RXBUFFER_16384;
5942 + if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
5943 + DPRINTK(PROBE, ERR, "MTU > 9216 not supported.\n");
5950 + if (max_frame <= E1000_RXBUFFER_256)
5951 + adapter->rx_buffer_len = E1000_RXBUFFER_256;
5952 + else if (max_frame <= E1000_RXBUFFER_2048)
5953 + adapter->rx_buffer_len = E1000_RXBUFFER_2048;
5954 + else if (max_frame <= E1000_RXBUFFER_4096)
5955 + adapter->rx_buffer_len = E1000_RXBUFFER_4096;
5956 + else if (max_frame <= E1000_RXBUFFER_8192)
5957 + adapter->rx_buffer_len = E1000_RXBUFFER_8192;
5958 + else if (max_frame <= E1000_RXBUFFER_16384)
5959 + adapter->rx_buffer_len = E1000_RXBUFFER_16384;
5961 - netdev->mtu = new_mtu;
5962 + /* adjust allocation if LPE protects us, and we aren't using SBP */
5964 - if(netif_running(netdev)) {
5965 - iegbe_down(adapter);
5966 - iegbe_up(adapter);
5968 + netdev->mtu = new_mtu;
5969 + hw->max_frame_size = max_frame;
5971 - adapter->hw.max_frame_size = max_frame;
5972 + if (netif_running(netdev))
5973 + iegbe_reinit_locked(adapter);
5977 @@ -3319,224 +3286,189 @@ iegbe_change_mtu(struct net_device *netd
5978 * @adapter: board private structure
5982 -iegbe_update_stats(struct iegbe_adapter *adapter)
5983 +void iegbe_update_stats(struct iegbe_adapter *adapter)
5985 - struct iegbe_hw *hw = &adapter->hw;
5986 - unsigned long flags = 0;
5988 + struct iegbe_hw *hw = &adapter->hw;
5989 + unsigned long flags = 0x0;
5992 #define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
5994 - spin_lock_irqsave(&adapter->stats_lock, flags);
5995 + spin_lock_irqsave(&adapter->stats_lock, flags);
5997 - /* these counters are modified from iegbe_adjust_tbi_stats,
5998 - * called from the interrupt context, so they must only
5999 - * be written while holding adapter->stats_lock
6001 + /* these counters are modified from iegbe_adjust_tbi_stats,
6002 + * called from the interrupt context, so they must only
6003 + * be written while holding adapter->stats_lock
6006 - adapter->stats.crcerrs += E1000_READ_REG(hw, CRCERRS);
6007 - adapter->stats.gprc += E1000_READ_REG(hw, GPRC);
6008 - adapter->stats.gorcl += E1000_READ_REG(hw, GORCL);
6009 - adapter->stats.gorch += E1000_READ_REG(hw, GORCH);
6010 - adapter->stats.bprc += E1000_READ_REG(hw, BPRC);
6011 - adapter->stats.mprc += E1000_READ_REG(hw, MPRC);
6012 - adapter->stats.roc += E1000_READ_REG(hw, ROC);
6013 - adapter->stats.prc64 += E1000_READ_REG(hw, PRC64);
6014 - adapter->stats.prc127 += E1000_READ_REG(hw, PRC127);
6015 - adapter->stats.prc255 += E1000_READ_REG(hw, PRC255);
6016 - adapter->stats.prc511 += E1000_READ_REG(hw, PRC511);
6017 - adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023);
6018 - adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522);
6020 - adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS);
6021 - adapter->stats.mpc += E1000_READ_REG(hw, MPC);
6022 - adapter->stats.scc += E1000_READ_REG(hw, SCC);
6023 - adapter->stats.ecol += E1000_READ_REG(hw, ECOL);
6024 - adapter->stats.mcc += E1000_READ_REG(hw, MCC);
6025 - adapter->stats.latecol += E1000_READ_REG(hw, LATECOL);
6026 - adapter->stats.dc += E1000_READ_REG(hw, DC);
6027 - adapter->stats.sec += E1000_READ_REG(hw, SEC);
6028 - adapter->stats.rlec += E1000_READ_REG(hw, RLEC);
6029 - adapter->stats.xonrxc += E1000_READ_REG(hw, XONRXC);
6030 - adapter->stats.xontxc += E1000_READ_REG(hw, XONTXC);
6031 - adapter->stats.xoffrxc += E1000_READ_REG(hw, XOFFRXC);
6032 - adapter->stats.xofftxc += E1000_READ_REG(hw, XOFFTXC);
6033 - adapter->stats.fcruc += E1000_READ_REG(hw, FCRUC);
6034 - adapter->stats.gptc += E1000_READ_REG(hw, GPTC);
6035 - adapter->stats.gotcl += E1000_READ_REG(hw, GOTCL);
6036 - adapter->stats.gotch += E1000_READ_REG(hw, GOTCH);
6037 - adapter->stats.rnbc += E1000_READ_REG(hw, RNBC);
6038 - adapter->stats.ruc += E1000_READ_REG(hw, RUC);
6039 - adapter->stats.rfc += E1000_READ_REG(hw, RFC);
6040 - adapter->stats.rjc += E1000_READ_REG(hw, RJC);
6041 - adapter->stats.torl += E1000_READ_REG(hw, TORL);
6042 - adapter->stats.torh += E1000_READ_REG(hw, TORH);
6043 - adapter->stats.totl += E1000_READ_REG(hw, TOTL);
6044 - adapter->stats.toth += E1000_READ_REG(hw, TOTH);
6045 - adapter->stats.tpr += E1000_READ_REG(hw, TPR);
6046 - adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64);
6047 - adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127);
6048 - adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255);
6049 - adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511);
6050 - adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023);
6051 - adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522);
6052 - adapter->stats.mptc += E1000_READ_REG(hw, MPTC);
6053 - adapter->stats.bptc += E1000_READ_REG(hw, BPTC);
6055 - /* used for adaptive IFS */
6057 - hw->tx_packet_delta = E1000_READ_REG(hw, TPT);
6058 - adapter->stats.tpt += hw->tx_packet_delta;
6059 - hw->collision_delta = E1000_READ_REG(hw, COLC);
6060 - adapter->stats.colc += hw->collision_delta;
6062 - if(hw->mac_type >= iegbe_82543) {
6063 - adapter->stats.algnerrc += E1000_READ_REG(hw, ALGNERRC);
6064 - adapter->stats.rxerrc += E1000_READ_REG(hw, RXERRC);
6065 - adapter->stats.tncrs += E1000_READ_REG(hw, TNCRS);
6066 - adapter->stats.cexterr += E1000_READ_REG(hw, CEXTERR);
6067 - adapter->stats.tsctc += E1000_READ_REG(hw, TSCTC);
6068 - adapter->stats.tsctfc += E1000_READ_REG(hw, TSCTFC);
6070 - if(hw->mac_type > iegbe_82547_rev_2) {
6071 - adapter->stats.iac += E1000_READ_REG(hw, IAC);
6072 - adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC);
6073 - adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC);
6074 - adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC);
6075 - adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC);
6076 - adapter->stats.ictxatc += E1000_READ_REG(hw, ICTXATC);
6077 - adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC);
6078 - adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC);
6079 - adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC);
6082 - /* Fill out the OS statistics structure */
6084 - adapter->net_stats.rx_packets = adapter->stats.gprc;
6085 - adapter->net_stats.tx_packets = adapter->stats.gptc;
6086 - adapter->net_stats.rx_bytes = adapter->stats.gorcl;
6087 - adapter->net_stats.tx_bytes = adapter->stats.gotcl;
6088 - adapter->net_stats.multicast = adapter->stats.mprc;
6089 - adapter->net_stats.collisions = adapter->stats.colc;
6093 - adapter->net_stats.rx_errors = adapter->stats.rxerrc +
6094 - adapter->stats.crcerrs + adapter->stats.algnerrc +
6095 - adapter->stats.rlec + adapter->stats.mpc +
6096 - adapter->stats.cexterr;
6097 - adapter->net_stats.rx_dropped = adapter->stats.mpc;
6098 - adapter->net_stats.rx_length_errors = adapter->stats.rlec;
6099 - adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
6100 - adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc;
6101 - adapter->net_stats.rx_fifo_errors = adapter->stats.mpc;
6102 - adapter->net_stats.rx_missed_errors = adapter->stats.mpc;
6106 - adapter->net_stats.tx_errors = adapter->stats.ecol +
6107 - adapter->stats.latecol;
6108 - adapter->net_stats.tx_aborted_errors = adapter->stats.ecol;
6109 - adapter->net_stats.tx_window_errors = adapter->stats.latecol;
6110 - adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
6111 + adapter->stats.crcerrs += E1000_READ_REG(hw, CRCERRS);
6112 + adapter->stats.gprc += E1000_READ_REG(hw, GPRC);
6113 + adapter->stats.gorcl += E1000_READ_REG(hw, GORCL);
6114 + adapter->stats.gorch += E1000_READ_REG(hw, GORCH);
6115 + adapter->stats.bprc += E1000_READ_REG(hw, BPRC);
6116 + adapter->stats.mprc += E1000_READ_REG(hw, MPRC);
6117 + adapter->stats.roc += E1000_READ_REG(hw, ROC);
6118 + adapter->stats.prc64 += E1000_READ_REG(hw, PRC64);
6119 + adapter->stats.prc127 += E1000_READ_REG(hw, PRC127);
6120 + adapter->stats.prc255 += E1000_READ_REG(hw, PRC255);
6121 + adapter->stats.prc511 += E1000_READ_REG(hw, PRC511);
6122 + adapter->stats.prc1023 += E1000_READ_REG(hw, PRC1023);
6123 + adapter->stats.prc1522 += E1000_READ_REG(hw, PRC1522);
6125 + adapter->stats.symerrs += E1000_READ_REG(hw, SYMERRS);
6126 + adapter->stats.mpc += E1000_READ_REG(hw, MPC);
6127 + adapter->stats.scc += E1000_READ_REG(hw, SCC);
6128 + adapter->stats.ecol += E1000_READ_REG(hw, ECOL);
6129 + adapter->stats.mcc += E1000_READ_REG(hw, MCC);
6130 + adapter->stats.latecol += E1000_READ_REG(hw, LATECOL);
6131 + adapter->stats.dc += E1000_READ_REG(hw, DC);
6132 + adapter->stats.sec += E1000_READ_REG(hw, SEC);
6133 + adapter->stats.rlec += E1000_READ_REG(hw, RLEC);
6134 + adapter->stats.xonrxc += E1000_READ_REG(hw, XONRXC);
6135 + adapter->stats.xontxc += E1000_READ_REG(hw, XONTXC);
6136 + adapter->stats.xoffrxc += E1000_READ_REG(hw, XOFFRXC);
6137 + adapter->stats.xofftxc += E1000_READ_REG(hw, XOFFTXC);
6138 + adapter->stats.fcruc += E1000_READ_REG(hw, FCRUC);
6139 + adapter->stats.gptc += E1000_READ_REG(hw, GPTC);
6140 + adapter->stats.gotcl += E1000_READ_REG(hw, GOTCL);
6141 + adapter->stats.gotch += E1000_READ_REG(hw, GOTCH);
6142 + adapter->stats.rnbc += E1000_READ_REG(hw, RNBC);
6143 + adapter->stats.ruc += E1000_READ_REG(hw, RUC);
6144 + adapter->stats.rfc += E1000_READ_REG(hw, RFC);
6145 + adapter->stats.rjc += E1000_READ_REG(hw, RJC);
6146 + adapter->stats.torl += E1000_READ_REG(hw, TORL);
6147 + adapter->stats.torh += E1000_READ_REG(hw, TORH);
6148 + adapter->stats.totl += E1000_READ_REG(hw, TOTL);
6149 + adapter->stats.toth += E1000_READ_REG(hw, TOTH);
6150 + adapter->stats.tpr += E1000_READ_REG(hw, TPR);
6151 + adapter->stats.ptc64 += E1000_READ_REG(hw, PTC64);
6152 + adapter->stats.ptc127 += E1000_READ_REG(hw, PTC127);
6153 + adapter->stats.ptc255 += E1000_READ_REG(hw, PTC255);
6154 + adapter->stats.ptc511 += E1000_READ_REG(hw, PTC511);
6155 + adapter->stats.ptc1023 += E1000_READ_REG(hw, PTC1023);
6156 + adapter->stats.ptc1522 += E1000_READ_REG(hw, PTC1522);
6157 + adapter->stats.mptc += E1000_READ_REG(hw, MPTC);
6158 + adapter->stats.bptc += E1000_READ_REG(hw, BPTC);
6160 + /* used for adaptive IFS */
6162 + hw->tx_packet_delta = E1000_READ_REG(hw, TPT);
6163 + adapter->stats.tpt += hw->tx_packet_delta;
6164 + hw->collision_delta = E1000_READ_REG(hw, COLC);
6165 + adapter->stats.colc += hw->collision_delta;
6167 + if(hw->mac_type >= iegbe_82543) {
6168 + adapter->stats.algnerrc += E1000_READ_REG(hw, ALGNERRC);
6169 + adapter->stats.rxerrc += E1000_READ_REG(hw, RXERRC);
6170 + adapter->stats.tncrs += E1000_READ_REG(hw, TNCRS);
6171 + adapter->stats.cexterr += E1000_READ_REG(hw, CEXTERR);
6172 + adapter->stats.tsctc += E1000_READ_REG(hw, TSCTC);
6173 + adapter->stats.tsctfc += E1000_READ_REG(hw, TSCTFC);
6175 + if(hw->mac_type > iegbe_82547_rev_2) {
6176 + adapter->stats.iac += E1000_READ_REG(hw, IAC);
6177 + adapter->stats.icrxoc += E1000_READ_REG(hw, ICRXOC);
6178 + adapter->stats.icrxptc += E1000_READ_REG(hw, ICRXPTC);
6179 + adapter->stats.icrxatc += E1000_READ_REG(hw, ICRXATC);
6180 + adapter->stats.ictxptc += E1000_READ_REG(hw, ICTXPTC);
6181 + adapter->stats.ictxatc += E1000_READ_REG(hw, ICTXATC);
6182 + adapter->stats.ictxqec += E1000_READ_REG(hw, ICTXQEC);
6183 + adapter->stats.ictxqmtc += E1000_READ_REG(hw, ICTXQMTC);
6184 + adapter->stats.icrxdmtc += E1000_READ_REG(hw, ICRXDMTC);
6187 + /* Fill out the OS statistics structure */
6189 + adapter->net_stats.rx_packets = adapter->stats.gprc;
6190 + adapter->net_stats.tx_packets = adapter->stats.gptc;
6191 + adapter->net_stats.rx_bytes = adapter->stats.gorcl;
6192 + adapter->net_stats.tx_bytes = adapter->stats.gotcl;
6193 + adapter->net_stats.multicast = adapter->stats.mprc;
6194 + adapter->net_stats.collisions = adapter->stats.colc;
6198 + adapter->net_stats.rx_errors = adapter->stats.rxerrc +
6199 + adapter->stats.crcerrs + adapter->stats.algnerrc +
6200 + adapter->stats.rlec + adapter->stats.mpc +
6201 + adapter->stats.cexterr;
6202 + adapter->net_stats.rx_dropped = adapter->stats.mpc;
6203 + adapter->net_stats.rx_length_errors = adapter->stats.rlec;
6204 + adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
6205 + adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc;
6206 + adapter->net_stats.rx_fifo_errors = adapter->stats.mpc;
6207 + adapter->net_stats.rx_missed_errors = adapter->stats.mpc;
6211 + adapter->net_stats.tx_errors = adapter->stats.ecol +
6212 + adapter->stats.latecol;
6213 + adapter->net_stats.tx_aborted_errors = adapter->stats.ecol;
6214 + adapter->net_stats.tx_window_errors = adapter->stats.latecol;
6215 + adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
6217 - /* Tx Dropped needs to be maintained elsewhere */
6218 + /* Tx Dropped needs to be maintained elsewhere */
6223 - if(hw->media_type == iegbe_media_type_copper
6224 + if(hw->media_type == iegbe_media_type_copper
6225 || (hw->media_type == iegbe_media_type_oem
6226 && iegbe_oem_phy_is_copper(&adapter->hw))) {
6227 - if((adapter->link_speed == SPEED_1000) &&
6228 - (!iegbe_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) {
6229 - phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
6230 - adapter->phy_stats.idle_errors += phy_tmp;
6232 + if((adapter->link_speed == SPEED_1000) &&
6233 + (!iegbe_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) {
6234 + phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
6235 + adapter->phy_stats.idle_errors += phy_tmp;
6238 - if((hw->mac_type <= iegbe_82546) &&
6239 - (hw->phy_type == iegbe_phy_m88) &&
6240 + if((hw->mac_type <= iegbe_82546) &&
6241 + (hw->phy_type == iegbe_phy_m88) &&
6242 !iegbe_read_phy_reg(hw, M88E1000_RX_ERR_CNTR, &phy_tmp)) {
6243 - adapter->phy_stats.receive_errors += phy_tmp;
6245 + adapter->phy_stats.receive_errors += phy_tmp;
6249 - spin_unlock_irqrestore(&adapter->stats_lock, flags);
6250 + spin_unlock_irqrestore(&adapter->stats_lock, flags);
6253 -#ifdef CONFIG_E1000_MQ
6255 -iegbe_rx_schedule(void *data)
6257 + * iegbe_intr_msi - Interrupt Handler
6258 + * @irq: interrupt number
6259 + * @data: pointer to a network interface device structure
6262 +static irqreturn_t iegbe_intr_msi(int irq, void *data)
6264 - struct net_device *poll_dev, *netdev = data;
6265 - struct iegbe_adapter *adapter = netdev->priv;
6266 - int this_cpu = get_cpu();
6268 - poll_dev = *per_cpu_ptr(adapter->cpu_netdev, this_cpu);
6269 - if (poll_dev == NULL) {
6272 + struct net_device *netdev = data;
6273 + struct iegbe_adapter *adapter = netdev_priv(netdev);
6274 + struct iegbe_hw *hw = &adapter->hw;
6275 + u32 icr = E1000_READ_REG(&adapter->hw, ICR);
6276 + if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
6277 + hw->get_link_status = 1;
6278 + if (!test_bit(__E1000_DOWN, &adapter->flags))
6279 + mod_timer(&adapter->watchdog_timer, jiffies + 1);
6282 - if (likely(netif_rx_schedule_prep(poll_dev))) {
6283 - __netif_rx_schedule(poll_dev);
6285 - iegbe_irq_enable(adapter);
6291 -#ifdef IEGBE_GBE_WORKAROUND
6293 - * Check for tx hang condition. This is the condition where a
6294 - * decsriptor is in the hardware and hasn't been processed for a
6295 - * while. This code is similar to the check in iegbe_clean_rx_irq()
6298 -iegbe_tx_hang_check(struct iegbe_adapter *adapter,
6299 - struct iegbe_tx_ring *tx_ring)
6301 - struct net_device *netdev = adapter->netdev;
6303 + if(unlikely(icr & (E1000_ICR_RX_DESC_FIFO_PAR
6304 + | E1000_ICR_TX_DESC_FIFO_PAR
6306 + | E1000_ICR_CPP_TARGET
6307 + | E1000_ICR_CPP_MASTER ))) {
6309 - /* Check for a hang condition using the buffer currently at the Tx
6311 - i = readl(adapter->hw.hw_addr + tx_ring->tdh);
6313 - if (adapter->detect_tx_hung) {
6314 - /* Detect a transmit hang in hardware, this serializes the
6315 - * check with the clearing of time_stamp and movement of i */
6316 - adapter->detect_tx_hung = FALSE;
6318 - if (tx_ring->buffer_info[i].dma &&
6319 - time_after(jiffies, tx_ring->buffer_info[i].time_stamp + HZ)
6320 - && !(E1000_READ_REG(&adapter->hw, STATUS) &
6321 - E1000_STATUS_TXOFF)) {
6323 - /* detected Tx unit hang */
6324 - DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
6327 - " next_to_use <%x>\n"
6328 - " next_to_clean <%x>\n"
6329 - "buffer_info[tdh]\n"
6331 - " time_stamp <%lx>\n"
6332 - " jiffies <%lx>\n",
6333 - readl(adapter->hw.hw_addr + tx_ring->tdh),
6334 - readl(adapter->hw.hw_addr + tx_ring->tdt),
6335 - tx_ring->next_to_use,
6336 - tx_ring->next_to_clean,
6337 - (size_t)tx_ring->buffer_info[i].dma,
6338 - tx_ring->buffer_info[i].time_stamp,
6340 - netif_stop_queue(netdev);
6342 + iegbe_irq_disable(adapter);
6343 + printk("Critical error! ICR = 0x%x\n", icr);
6344 + return IRQ_HANDLED;
6347 + if (likely(netif_rx_schedule_prep(netdev, &adapter->napi))) {
6348 + adapter->total_tx_bytes = 0;
6349 + adapter->total_tx_packets = 0;
6350 + adapter->total_rx_bytes = 0;
6351 + adapter->total_rx_packets = 0;
6352 + __netif_rx_schedule(netdev, &adapter->napi);
6354 + iegbe_irq_enable(adapter);
6357 + return IRQ_HANDLED;
6361 * iegbe_intr - Interrupt Handler
6362 @@ -3546,364 +3478,208 @@ iegbe_tx_hang_check(struct iegbe_adapter
6366 -iegbe_intr(int irq, void *data, struct pt_regs *regs)
6367 +iegbe_intr(int irq, void *data)
6369 - struct net_device *netdev = data;
6370 - struct iegbe_adapter *adapter = netdev_priv(netdev);
6371 - struct iegbe_hw *hw = &adapter->hw;
6372 - uint32_t rctl, tctl;
6373 - uint32_t icr = E1000_READ_REG(hw, ICR);
6374 -#ifndef CONFIG_E1000_NAPI
6376 -#ifdef IEGBE_GBE_WORKAROUND
6380 + struct net_device *netdev = data;
6381 + struct iegbe_adapter *adapter = netdev_priv(netdev);
6382 + struct iegbe_hw *hw = &adapter->hw;
6383 + u32 icr = E1000_READ_REG(&adapter->hw, ICR);
6385 - if(unlikely(!icr)) {
6386 + if (unlikely(!icr))
6387 return IRQ_NONE; /* Not our interrupt */
6390 + /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
6391 + * not set, then the adapter didn't send an interrupt */
6392 + if (unlikely(hw->mac_type >= iegbe_82571 &&
6393 + !(icr & E1000_ICR_INT_ASSERTED)))
6397 if(unlikely(icr & (E1000_ICR_RX_DESC_FIFO_PAR
6398 - | E1000_ICR_TX_DESC_FIFO_PAR
6400 - | E1000_ICR_CPP_TARGET
6401 - | E1000_ICR_CPP_MASTER ))) {
6402 + | E1000_ICR_TX_DESC_FIFO_PAR
6404 + | E1000_ICR_CPP_TARGET
6405 + | E1000_ICR_CPP_MASTER ))) {
6407 iegbe_irq_disable(adapter);
6408 - tctl = E1000_READ_REG(&adapter->hw, TCTL);
6409 - rctl = E1000_READ_REG(&adapter->hw, RCTL);
6410 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl & ~E1000_TCTL_EN);
6411 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl & ~E1000_RCTL_EN);
6413 - tasklet_data = (unsigned long) (icr + adapter->bd_number);
6414 - tasklet_schedule(&iegbe_reset_tasklet);
6416 - return IRQ_HANDLED;
6419 -#ifdef CONFIG_E1000_NAPI
6420 - atomic_inc(&adapter->irq_sem);
6421 -#ifdef IEGBE_GBE_WORKAROUND
6422 - /* Ensure that the TXQE interrupt is enabled in NAPI mode */
6423 - E1000_WRITE_REG(hw, IMC, ~E1000_IMS_TXQE);
6425 - E1000_WRITE_REG(hw, IMC, ~0);
6427 - E1000_WRITE_FLUSH(hw);
6428 -#ifdef CONFIG_E1000_MQ
6429 - if (atomic_read(&adapter->rx_sched_call_data.count) == 0) {
6430 - cpu_set(adapter->cpu_for_queue[0],
6431 - adapter->rx_sched_call_data.cpumask);
6432 - for (i = 1; i < adapter->num_queues; i++) {
6433 - cpu_set(adapter->cpu_for_queue[i],
6434 - adapter->rx_sched_call_data.cpumask);
6435 - atomic_inc(&adapter->irq_sem);
6437 - atomic_set(&adapter->rx_sched_call_data.count, i);
6438 - smp_call_async_mask(&adapter->rx_sched_call_data);
6440 - DEBUGOUT("call_data.count == %u\n",
6441 - atomic_read(&adapter->rx_sched_call_data.count));
6442 + printk("Critical error! ICR = 0x%x\n", icr);
6443 + return IRQ_HANDLED;
6446 - if (likely(netif_rx_schedule_prep(&adapter->polling_netdev[0]))) {
6447 - __netif_rx_schedule(&adapter->polling_netdev[0]);
6449 - iegbe_irq_enable(adapter);
6453 -#ifdef IEGBE_GBE_WORKAROUND
6454 - /* Clean the Tx ring */
6455 - for (i = 0; i < E1000_MAX_INTR; i++) {
6456 - adapter->stats.rx_next_to_clean = adapter->rx_ring->next_to_clean;
6457 - adapter->stats.rx_next_to_use = adapter->rx_ring->next_to_use;
6459 - adapter->stats.tx_next_to_clean = adapter->tx_ring->next_to_clean;
6460 - adapter->stats.tx_next_to_use = adapter->tx_ring->next_to_use;
6462 - /* Only clean Tx descriptors for a TXQE interrupt */
6463 - if(icr & E1000_ICR_TXQE) {
6464 - adapter->stats.txqec++;
6465 - iegbe_clean_tx_ring_partial(adapter, adapter->tx_ring);
6468 - iegbe_tx_hang_check(adapter, adapter->tx_ring);
6472 -#endif /*IEGBE_GBE_WORKAROUND */
6475 - /* Writing IMC and IMS is needed for 82547.
6476 - * Due to Hub Link bus being occupied, an interrupt
6477 - * de-assertion message is not able to be sent.
6478 - * When an interrupt assertion message is generated later,
6479 - * two messages are re-ordered and sent out.
6480 - * That causes APIC to think 82547 is in de-assertion
6481 - * state, while 82547 is in assertion state, resulting
6482 - * in dead lock. Writing IMC forces 82547 into
6483 - * de-assertion state.
6485 - if (hw->mac_type == iegbe_82547 || hw->mac_type == iegbe_82547_rev_2) {
6486 - atomic_inc(&adapter->irq_sem);
6487 - E1000_WRITE_REG(hw, IMC, ~0);
6490 -#ifdef IEGBE_GBE_WORKAROUND
6492 - for (i = 0; i < E1000_MAX_INTR; i++) {
6493 - rx_cleaned = adapter->clean_rx(adapter, adapter->rx_ring);
6494 - adapter->stats.rx_next_to_clean = adapter->rx_ring->next_to_clean;
6495 - adapter->stats.rx_next_to_use = adapter->rx_ring->next_to_use;
6497 - adapter->stats.tx_next_to_clean = adapter->tx_ring->next_to_clean;
6498 - adapter->stats.tx_next_to_use = adapter->tx_ring->next_to_use;
6500 - /* Only clean Tx descriptors for a TXQE interrupt */
6501 - if(icr & E1000_ICR_TXQE) {
6502 - adapter->stats.txqec++;
6503 - iegbe_clean_tx_ring_partial(adapter, adapter->tx_ring);
6506 - iegbe_tx_hang_check(adapter, adapter->tx_ring);
6511 + /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked. No
6512 + * need for the IMC write */
6513 + if (unlikely(icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC))) {
6514 + hw->get_link_status = 1;
6515 + /* guard against interrupt when we're going down */
6516 + if (!test_bit(__E1000_DOWN, &adapter->flags))
6517 + mod_timer(&adapter->watchdog_timer, jiffies + 1);
6522 - for (i = 0; i < E1000_MAX_INTR; i++)
6523 - if(unlikely(!adapter->clean_rx(adapter, adapter->rx_ring) &
6524 - !iegbe_clean_tx_irq(adapter, adapter->tx_ring))) {
6529 - if (hw->mac_type == iegbe_82547 || hw->mac_type == iegbe_82547_rev_2) {
6530 - iegbe_irq_enable(adapter);
6533 -#ifdef E1000_COUNT_ICR
6534 - adapter->icr_txdw += icr & 0x01UL;
6536 - adapter->icr_txqe += icr & 0x01UL;
6538 - adapter->icr_lsc += icr & 0x01UL;
6540 - adapter->icr_rxseq += icr & 0x01UL;
6542 - adapter->icr_rxdmt += icr & 0x01UL;
6544 - adapter->icr_rxo += icr & 0x01UL;
6546 - adapter->icr_rxt += icr & 0x01UL;
6547 - if(hw->mac_type != iegbe_icp_xxxx) {
6549 - adapter->icr_mdac += icr & 0x01UL;
6551 - adapter->icr_rxcfg += icr & 0x01UL;
6553 - adapter->icr_gpi += icr & 0x01UL;
6557 - if(hw->mac_type == iegbe_icp_xxxx) {
6559 - adapter->icr_pb += icr & 0x01UL;
6561 - adapter->icr_intmem_icp_xxxx += icr & 0x01UL;
6563 - adapter->icr_cpp_target += icr & 0x01UL;
6565 - adapter->icr_cpp_master += icr & 0x01UL;
6567 - adapter->icr_stat += icr & 0x01UL;
6568 + if (unlikely(hw->mac_type < iegbe_82571)) {
6569 + E1000_WRITE_REG(&adapter->hw, IMC, ~0);
6570 + E1000_WRITE_FLUSH(&adapter->hw);
6573 + if (likely(netif_rx_schedule_prep(netdev, &adapter->napi))) {
6574 + adapter->total_tx_bytes = 0;
6575 + adapter->total_tx_packets = 0;
6576 + adapter->total_rx_bytes = 0;
6577 + adapter->total_rx_packets = 0;
6578 + __netif_rx_schedule(netdev, &adapter->napi);
6580 + /* this really should not happen! if it does it is basically a
6581 + * bug, but not a hard error, so enable ints and continue */
6582 + iegbe_irq_enable(adapter);
6587 -#ifdef CONFIG_E1000_NAPI
6589 * iegbe_clean - NAPI Rx polling callback
6590 * @adapter: board private structure
6594 -iegbe_clean(struct net_device *poll_dev, int *budget)
6595 +static int iegbe_clean(struct napi_struct *napi, int budget)
6597 - struct iegbe_adapter *adapter;
6598 - int work_to_do = min(*budget, poll_dev->quota);
6599 - int tx_cleaned, i = 0, work_done = 0;
6600 + struct iegbe_adapter *adapter = container_of(napi, struct iegbe_adapter, napi);
6601 + struct net_device *poll_dev = adapter->netdev;
6602 + int tx_cleaned = 0, work_done = 0;
6604 /* Must NOT use netdev_priv macro here. */
6605 adapter = poll_dev->priv;
6607 - /* Keep link state information with original netdev */
6608 - if (!netif_carrier_ok(adapter->netdev)) {
6609 - goto quit_polling;
6611 - while (poll_dev != &adapter->polling_netdev[i]) {
6613 - if (unlikely(i == adapter->num_queues)) {
6618 -#ifdef IEGBE_GBE_WORKAROUND
6619 - /* Tx descriptors are cleaned in iegbe_intr(). No need to clean
6621 - tx_cleaned = FALSE;
6623 - tx_cleaned = iegbe_clean_tx_irq(adapter, &adapter->tx_ring[i]);
6625 - adapter->clean_rx(adapter, &adapter->rx_ring[i],
6626 - &work_done, work_to_do);
6628 - *budget -= work_done;
6629 - poll_dev->quota -= work_done;
6631 - /* If no Tx and not enough Rx work done, exit the polling mode */
6632 - if((!tx_cleaned && (work_done == 0)) ||
6633 - !netif_running(adapter->netdev)) {
6635 - netif_rx_complete(poll_dev);
6636 + /* iegbe_clean is called per-cpu. This lock protects
6637 + * tx_ring[0] from being cleaned by multiple cpus
6638 + * simultaneously. A failure obtaining the lock means
6639 + * tx_ring[0] is currently being cleaned anyway. */
6640 + if (spin_trylock(&adapter->tx_queue_lock)) {
6641 + tx_cleaned = iegbe_clean_tx_irq(adapter,
6642 + &adapter->tx_ring[0]);
6643 + spin_unlock(&adapter->tx_queue_lock);
6646 + adapter->clean_rx(adapter, &adapter->rx_ring[0],
6647 + &work_done, budget);
6650 + work_done = budget;
6652 + /* If budget not fully consumed, exit the polling mode */
6653 + if (work_done < budget) {
6654 + if (likely(adapter->itr_setting & 3))
6655 + iegbe_set_itr(adapter);
6656 + netif_rx_complete(poll_dev, napi);
6657 iegbe_irq_enable(adapter);
6668 -#ifndef IEGBE_GBE_WORKAROUND
6670 * iegbe_clean_tx_irq - Reclaim resources after transmit completes
6671 * @adapter: board private structure
6675 -iegbe_clean_tx_irq(struct iegbe_adapter *adapter,
6676 +static bool iegbe_clean_tx_irq(struct iegbe_adapter *adapter,
6677 struct iegbe_tx_ring *tx_ring)
6679 - struct net_device *netdev = adapter->netdev;
6680 - struct iegbe_tx_desc *tx_desc, *eop_desc;
6681 - struct iegbe_buffer *buffer_info;
6682 - unsigned int i, eop;
6683 - boolean_t cleaned = FALSE;
6684 + struct iegbe_hw *hw = &adapter->hw;
6685 + struct net_device *netdev = adapter->netdev;
6686 + struct iegbe_tx_desc *tx_desc, *eop_desc;
6687 + struct iegbe_buffer *buffer_info;
6688 + unsigned int i, eop;
6689 + unsigned int count = 0;
6690 + bool cleaned = false;
6691 + unsigned int total_tx_bytes=0, total_tx_packets=0;
6693 - i = tx_ring->next_to_clean;
6694 - eop = tx_ring->buffer_info[i].next_to_watch;
6695 - eop_desc = E1000_TX_DESC(*tx_ring, eop);
6696 + i = tx_ring->next_to_clean;
6697 + eop = tx_ring->buffer_info[i].next_to_watch;
6698 + eop_desc = E1000_TX_DESC(*tx_ring, eop);
6700 while (eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) {
6701 - /* Premature writeback of Tx descriptors clear (free buffers
6702 - * and unmap pci_mapping) previous_buffer_info */
6703 - if (likely(tx_ring->previous_buffer_info.skb != NULL)) {
6704 - iegbe_unmap_and_free_tx_resource(adapter,
6705 - &tx_ring->previous_buffer_info);
6708 - for (cleaned = FALSE; !cleaned; ) {
6709 - tx_desc = E1000_TX_DESC(*tx_ring, i);
6710 - buffer_info = &tx_ring->buffer_info[i];
6711 - cleaned = (i == eop);
6714 - if (!(netdev->features & NETIF_F_TSO)) {
6716 - iegbe_unmap_and_free_tx_resource(adapter,
6721 - memcpy(&tx_ring->previous_buffer_info,
6723 - sizeof(struct iegbe_buffer));
6724 - memset(buffer_info, 0,
6725 - sizeof(struct iegbe_buffer));
6727 - iegbe_unmap_and_free_tx_resource(
6728 - adapter, buffer_info);
6733 - tx_desc->buffer_addr = 0;
6734 - tx_desc->lower.data = 0;
6735 + for (cleaned = false; !cleaned; ) {
6736 + tx_desc = E1000_TX_DESC(*tx_ring, i);
6737 + buffer_info = &tx_ring->buffer_info[i];
6738 + cleaned = (i == eop);
6741 + struct sk_buff *skb = buffer_info->skb;
6742 + unsigned int segs = 0, bytecount;
6743 + segs = skb_shinfo(skb)->gso_segs ?: 1;
6744 + bytecount = ((segs - 1) * skb_headlen(skb)) +
6746 + total_tx_packets += segs;
6747 + total_tx_bytes += bytecount;
6749 + iegbe_unmap_and_free_tx_resource(adapter, buffer_info);
6750 tx_desc->upper.data = 0;
6752 - if (unlikely(++i == tx_ring->count)) { i = 0; }
6756 + if (unlikely(++i == tx_ring->count)) i = 0;
6759 - eop = tx_ring->buffer_info[i].next_to_watch;
6760 - eop_desc = E1000_TX_DESC(*tx_ring, eop);
6762 + eop = tx_ring->buffer_info[i].next_to_watch;
6763 + eop_desc = E1000_TX_DESC(*tx_ring, eop);
6764 +#define E1000_TX_WEIGHT 64
6765 + /* weight of a sort for tx, to avoid endless transmit cleanup */
6766 + if (count++ == E1000_TX_WEIGHT)
6770 tx_ring->next_to_clean = i;
6772 - spin_lock(&tx_ring->tx_lock);
6773 +#define TX_WAKE_THRESHOLD 32
6775 - if (unlikely(cleaned && netif_queue_stopped(netdev) &&
6776 - netif_carrier_ok(netdev))) {
6777 - netif_wake_queue(netdev);
6779 - spin_unlock(&tx_ring->tx_lock);
6781 - if (adapter->detect_tx_hung) {
6782 - /* Detect a transmit hang in hardware, this serializes the
6783 - * check with the clearing of time_stamp and movement of i */
6784 - adapter->detect_tx_hung = FALSE;
6786 - if (tx_ring->buffer_info[i].dma &&
6787 - time_after(jiffies, tx_ring->buffer_info[i].time_stamp + HZ)
6788 - && !(E1000_READ_REG(&adapter->hw, STATUS) &
6789 - E1000_STATUS_TXOFF)) {
6791 - /* detected Tx unit hang */
6792 - i = tx_ring->next_to_clean;
6793 - eop = tx_ring->buffer_info[i].next_to_watch;
6794 - eop_desc = E1000_TX_DESC(*tx_ring, eop);
6795 - DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
6798 - " next_to_use <%x>\n"
6799 - " next_to_clean <%x>\n"
6800 - "buffer_info[next_to_clean]\n"
6802 - " time_stamp <%lx>\n"
6803 - " next_to_watch <%x>\n"
6804 - " jiffies <%lx>\n"
6805 - " next_to_watch.status <%x>\n",
6806 - readl(adapter->hw.hw_addr + tx_ring->tdh),
6807 - readl(adapter->hw.hw_addr + tx_ring->tdt),
6808 - tx_ring->next_to_use,
6810 - (size_t)tx_ring->buffer_info[i].dma,
6811 - tx_ring->buffer_info[i].time_stamp,
6814 - eop_desc->upper.fields.status);
6815 - netif_stop_queue(netdev);
6816 + if (unlikely(cleaned && netif_carrier_ok(netdev) &&
6817 + E1000_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD)) {
6818 + /* Make sure that anybody stopping the queue after this
6819 + * sees the new next_to_clean.
6822 + if (netif_queue_stopped(netdev)) {
6823 + netif_wake_queue(netdev);
6824 + ++adapter->restart_queue;
6828 - if (unlikely(!(eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
6829 - time_after(jiffies, tx_ring->previous_buffer_info.time_stamp + HZ))) {
6830 - iegbe_unmap_and_free_tx_resource(
6831 - adapter, &tx_ring->previous_buffer_info);
6833 + if (adapter->detect_tx_hung) {
6834 + /* Detect a transmit hang in hardware, this serializes the
6835 + * check with the clearing of time_stamp and movement of i */
6836 + adapter->detect_tx_hung = false;
6838 + if (tx_ring->buffer_info[eop].dma &&
6839 + time_after(jiffies, tx_ring->buffer_info[eop].time_stamp +
6840 + (adapter->tx_timeout_factor * HZ))
6841 + && !(E1000_READ_REG(hw, STATUS) & E1000_STATUS_TXOFF)) {
6843 + /* detected Tx unit hang */
6844 + DPRINTK(DRV, ERR, "Detected Tx Unit Hang\n"
6845 + " Tx Queue <%lu>\n"
6848 + " next_to_use <%x>\n"
6849 + " next_to_clean <%x>\n"
6850 + "buffer_info[next_to_clean]\n"
6851 + " time_stamp <%lx>\n"
6852 + " next_to_watch <%x>\n"
6853 + " jiffies <%lx>\n"
6854 + " next_to_watch.status <%x>\n",
6855 + (unsigned long)((tx_ring - adapter->tx_ring) /
6856 + sizeof(struct iegbe_tx_ring)),
6857 + readl(hw->hw_addr + tx_ring->tdh),
6858 + readl(hw->hw_addr + tx_ring->tdt),
6859 + tx_ring->next_to_use,
6860 + tx_ring->next_to_clean,
6861 + tx_ring->buffer_info[eop].time_stamp,
6864 + eop_desc->upper.fields.status);
6865 + netif_stop_queue(netdev);
6870 + adapter->total_tx_bytes += total_tx_bytes;
6871 + adapter->total_tx_packets += total_tx_packets;
6872 + adapter->net_stats.tx_bytes += total_tx_bytes;
6873 + adapter->net_stats.tx_packets += total_tx_packets;
6879 * iegbe_rx_checksum - Receive Checksum Offload for 82543
6880 @@ -3913,192 +3689,193 @@ iegbe_clean_tx_irq(struct iegbe_adapter
6881 * @sk_buff: socket buffer with received data
6885 -iegbe_rx_checksum(struct iegbe_adapter *adapter,
6886 - uint32_t status_err, uint32_t csum,
6887 - struct sk_buff *skb)
6888 +static void iegbe_rx_checksum(struct iegbe_adapter *adapter, u32 status_err,
6889 + u32 csum, struct sk_buff *skb)
6891 - uint16_t status = (uint16_t)status_err;
6892 - uint8_t errors = (uint8_t)(status_err >> 0x18);
6893 + struct iegbe_hw *hw = &adapter->hw;
6894 + u16 status = (u16)status_err;
6895 + u8 errors = (u8)(status_err >> 24);
6896 skb->ip_summed = CHECKSUM_NONE;
6898 - /* 82543 or newer only */
6899 - if(unlikely(adapter->hw.mac_type < iegbe_82543)) { return; }
6900 - /* Ignore Checksum bit is set */
6901 - if(unlikely(status & E1000_RXD_STAT_IXSM)) { return; }
6902 - /* TCP/UDP checksum error bit is set */
6903 - if(unlikely(errors & E1000_RXD_ERR_TCPE)) {
6904 - /* let the stack verify checksum errors */
6905 - adapter->hw_csum_err++;
6908 - /* TCP/UDP Checksum has not been calculated */
6909 - if(adapter->hw.mac_type <= iegbe_82547_rev_2) {
6910 - if(!(status & E1000_RXD_STAT_TCPCS)) {
6912 + /* 82543 or newer only */
6913 + if (unlikely(hw->mac_type < iegbe_82543)) return;
6914 + /* Ignore Checksum bit is set */
6915 + if (unlikely(status & E1000_RXD_STAT_IXSM)) return;
6916 + /* TCP/UDP checksum error bit is set */
6917 + if(unlikely(errors & E1000_RXD_ERR_TCPE)) {
6918 + /* let the stack verify checksum errors */
6919 + adapter->hw_csum_err++;
6922 + /* TCP/UDP Checksum has not been calculated */
6923 + if (hw->mac_type <= iegbe_82547_rev_2) {
6924 + if (!(status & E1000_RXD_STAT_TCPCS))
6927 + if (!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)))
6931 - if(!(status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS))) {
6934 + /* It must be a TCP or UDP packet with a valid checksum */
6935 + if(likely(status & E1000_RXD_STAT_TCPCS)) {
6936 + /* TCP checksum is good */
6937 + skb->ip_summed = CHECKSUM_UNNECESSARY;
6938 + } else if (hw->mac_type > iegbe_82547_rev_2) {
6939 + /* IP fragment with UDP payload */
6940 + /* Hardware complements the payload checksum, so we undo it
6941 + * and then put the value in host order for further stack use.
6943 + __sum16 sum = (__force __sum16)htons(csum);
6944 + skb->csum = csum_unfold(~sum);
6945 + skb->ip_summed = CHECKSUM_COMPLETE;
6947 - /* It must be a TCP or UDP packet with a valid checksum */
6948 - if(likely(status & E1000_RXD_STAT_TCPCS)) {
6949 - /* TCP checksum is good */
6950 - skb->ip_summed = CHECKSUM_UNNECESSARY;
6951 - } else if(adapter->hw.mac_type > iegbe_82547_rev_2) {
6952 - /* IP fragment with UDP payload */
6953 - /* Hardware complements the payload checksum, so we undo it
6954 - * and then put the value in host order for further stack use.
6956 - csum = ntohl(csum ^ 0xFFFF);
6958 - skb->ip_summed = CHECKSUM_HW;
6960 - adapter->hw_csum_good++;
6961 + adapter->hw_csum_good++;
6965 * iegbe_clean_rx_irq - Send received data up the network stack; legacy
6966 * @adapter: board private structure
6970 -#ifdef CONFIG_E1000_NAPI
6971 -iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
6972 +static bool iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
6973 struct iegbe_rx_ring *rx_ring,
6974 int *work_done, int work_to_do)
6976 -iegbe_clean_rx_irq(struct iegbe_adapter *adapter,
6977 - struct iegbe_rx_ring *rx_ring)
6980 - struct net_device *netdev = adapter->netdev;
6981 - struct pci_dev *pdev = adapter->pdev;
6982 - struct iegbe_rx_desc *rx_desc;
6983 - struct iegbe_buffer *buffer_info;
6984 - struct sk_buff *skb;
6985 - unsigned long flags = 0;
6987 - uint8_t last_byte;
6989 - boolean_t cleaned = FALSE;
6991 -#ifdef IEGBE_GBE_WORKAROUND
6992 - /* Need to keep track of the amount of Rx descriptors that we
6993 - cleaned to ensure that we don't supply too many back to the
6995 - int cleaned_count = 0;
6998 - i = rx_ring->next_to_clean;
6999 - rx_desc = E1000_RX_DESC(*rx_ring, i);
7001 - while(rx_desc->status & E1000_RXD_STAT_DD) {
7002 - buffer_info = &rx_ring->buffer_info[i];
7003 -#ifdef CONFIG_E1000_NAPI
7004 - if(*work_done >= work_to_do) {
7010 + struct iegbe_hw *hw = &adapter->hw;
7011 + struct net_device *netdev = adapter->netdev;
7012 + struct pci_dev *pdev = adapter->pdev;
7013 + struct iegbe_rx_desc *rx_desc, *next_rxd;
7014 + struct iegbe_buffer *buffer_info, *next_buffer;
7015 + unsigned long flags;
7019 + int cleaned_count = 0;
7020 + bool cleaned = false;
7021 + unsigned int total_rx_bytes=0, total_rx_packets=0;
7023 -#ifdef IEGBE_GBE_WORKAROUND
7026 + i = rx_ring->next_to_clean;
7027 + rx_desc = E1000_RX_DESC(*rx_ring, i);
7028 + buffer_info = &rx_ring->buffer_info[i];
7030 - pci_unmap_single(pdev,
7032 - buffer_info->length,
7033 - PCI_DMA_FROMDEVICE);
7034 + while(rx_desc->status & E1000_RXD_STAT_DD) {
7035 + struct sk_buff *skb;
7037 + if (*work_done >= work_to_do)
7041 + status = rx_desc->status;
7042 skb = buffer_info->skb;
7043 - length = le16_to_cpu(rx_desc->length);
7044 + buffer_info->skb = NULL;
7045 + prefetch(skb->data - NET_IP_ALIGN);
7046 + if (++i == rx_ring->count) i = 0;
7047 + next_rxd = E1000_RX_DESC(*rx_ring, i);
7048 + prefetch(next_rxd);
7049 + next_buffer = &rx_ring->buffer_info[i];
7052 + pci_unmap_single(pdev,
7054 + buffer_info->length,
7055 + PCI_DMA_FROMDEVICE);
7057 + length = le16_to_cpu(rx_desc->length);
7059 + if (unlikely(!(status & E1000_RXD_STAT_EOP))) {
7060 + /* All receives must fit into a single buffer */
7061 + E1000_DBG("%s: Receive packet consumed multiple"
7062 + " buffers\n", netdev->name);
7063 + buffer_info->skb = skb;
7067 - if(unlikely(!(rx_desc->status & E1000_RXD_STAT_EOP))) {
7068 - /* All receives must fit into a single buffer */
7069 - E1000_DBG("%s: Receive packet consumed multiple"
7070 - " buffers\n", netdev->name);
7071 - dev_kfree_skb_irq(skb);
7074 + if(unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) {
7075 + last_byte = *(skb->data + length - 1);
7076 + if (TBI_ACCEPT(hw, status, rx_desc->errors, length,
7078 + spin_lock_irqsave(&adapter->stats_lock, flags);
7079 + iegbe_tbi_adjust_stats(hw, &adapter->stats,
7080 + length, skb->data);
7081 + spin_unlock_irqrestore(&adapter->stats_lock,
7085 + buffer_info->skb = skb;
7090 - if(unlikely(rx_desc->errors & E1000_RXD_ERR_FRAME_ERR_MASK)) {
7091 - last_byte = *(skb->data + length - 0x1);
7092 - if(TBI_ACCEPT(&adapter->hw, rx_desc->status,
7093 - rx_desc->errors, length, last_byte)) {
7094 - spin_lock_irqsave(&adapter->stats_lock, flags);
7095 - iegbe_tbi_adjust_stats(&adapter->hw,
7097 - length, skb->data);
7098 - spin_unlock_irqrestore(&adapter->stats_lock,
7102 - dev_kfree_skb_irq(skb);
7104 + /* adjust length to remove Ethernet CRC, this must be
7105 + * done after the TBI_ACCEPT workaround above */
7108 + /* probably a little skewed due to removing CRC */
7109 + total_rx_bytes += length;
7110 + total_rx_packets++;
7112 + /* code added for copybreak, this should improve
7113 + * performance for small packets with large amounts
7114 + * of reassembly being done in the stack */
7115 + if (length < copybreak) {
7116 + struct sk_buff *new_skb =
7117 + netdev_alloc_skb(netdev, length + NET_IP_ALIGN);
7119 + skb_reserve(new_skb, NET_IP_ALIGN);
7120 + skb_copy_to_linear_data_offset(new_skb,
7126 + /* save the skb in buffer_info as good */
7127 + buffer_info->skb = skb;
7130 + /* else just continue with the old one */
7133 - /* Good Receive */
7134 - skb_put(skb, length - ETHERNET_FCS_SIZE);
7135 + /* Good Receive */
7136 + skb_put(skb, length);
7138 /* Receive Checksum Offload */
7139 iegbe_rx_checksum(adapter,
7140 - (uint32_t)(rx_desc->status) |
7141 - ((uint32_t)(rx_desc->errors) << 0x18),
7142 - rx_desc->csum, skb);
7144 + ((u32)(rx_desc->errors) << 24),
7145 + le16_to_cpu(rx_desc->csum), skb);
7147 skb->protocol = eth_type_trans(skb, netdev);
7148 -#ifdef CONFIG_E1000_NAPI
7149 -#ifdef NETIF_F_HW_VLAN_TX
7150 - if(unlikely(adapter->vlgrp &&
7151 - (rx_desc->status & E1000_RXD_STAT_VP))) {
7153 + if (unlikely(adapter->vlgrp &&
7154 + (status & E1000_RXD_STAT_VP))) {
7155 vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
7156 - le16_to_cpu(rx_desc->special) &
7157 - E1000_RXD_SPC_VLAN_MASK);
7158 + le16_to_cpu(rx_desc->special));
7160 netif_receive_skb(skb);
7163 - netif_receive_skb(skb);
7165 -#else /* CONFIG_E1000_NAPI */
7166 -#ifdef NETIF_F_HW_VLAN_TX
7167 - if(unlikely(adapter->vlgrp &&
7168 - (rx_desc->status & E1000_RXD_STAT_VP))) {
7169 - vlan_hwaccel_rx(skb, adapter->vlgrp,
7170 - le16_to_cpu(rx_desc->special) &
7171 - E1000_RXD_SPC_VLAN_MASK);
7178 -#endif /* CONFIG_E1000_NAPI */
7180 netdev->last_rx = jiffies;
7184 rx_desc->status = 0;
7185 - buffer_info->skb = NULL;
7186 - if(unlikely(++i == rx_ring->count)) { i = 0; }
7188 - rx_desc = E1000_RX_DESC(*rx_ring, i);
7189 + /* return some buffers to hardware, one at a time is too slow */
7190 + if (unlikely(cleaned_count >= E1000_RX_BUFFER_WRITE)) {
7191 + adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
7192 + cleaned_count = 0;
7195 + /* use prefetched values */
7196 + rx_desc = next_rxd;
7197 + buffer_info = next_buffer;
7199 rx_ring->next_to_clean = i;
7201 -#ifdef IEGBE_GBE_WORKAROUND
7202 - /* Only allocate the number of buffers that we have actually
7204 - if (cleaned_count) {
7205 - adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
7208 - adapter->alloc_rx_buf(adapter, rx_ring);
7211 + cleaned_count = E1000_DESC_UNUSED(rx_ring);
7212 + if (cleaned_count)
7213 + adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
7215 + adapter->total_rx_packets += total_rx_packets;
7216 + adapter->total_rx_bytes += total_rx_bytes;
7217 + adapter->net_stats.rx_bytes += total_rx_bytes;
7218 + adapter->net_stats.rx_packets += total_rx_packets;
7222 @@ -4107,161 +3884,153 @@ next_desc:
7223 * @adapter: board private structure
7227 -#ifdef CONFIG_E1000_NAPI
7228 -iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
7229 +static bool iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
7230 struct iegbe_rx_ring *rx_ring,
7231 int *work_done, int work_to_do)
7233 -iegbe_clean_rx_irq_ps(struct iegbe_adapter *adapter,
7234 - struct iegbe_rx_ring *rx_ring)
7237 - union iegbe_rx_desc_packet_split *rx_desc;
7238 - struct net_device *netdev = adapter->netdev;
7239 - struct pci_dev *pdev = adapter->pdev;
7240 - struct iegbe_buffer *buffer_info;
7241 - struct iegbe_ps_page *ps_page;
7242 - struct iegbe_ps_page_dma *ps_page_dma;
7243 - struct sk_buff *skb;
7244 - unsigned int i, j;
7245 - uint32_t length, staterr;
7246 - boolean_t cleaned = FALSE;
7248 -#ifdef IEGBE_GBE_WORKAROUND
7249 - /* Need to keep track of the amount of Rx descriptors that we
7250 - cleaned to ensure that we don't supply too many back to the
7252 - int cleaned_count = 0;
7255 - i = rx_ring->next_to_clean;
7256 - rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
7257 - staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
7259 - while(staterr & E1000_RXD_STAT_DD) {
7260 - buffer_info = &rx_ring->buffer_info[i];
7261 - ps_page = &rx_ring->ps_page[i];
7262 - ps_page_dma = &rx_ring->ps_page_dma[i];
7263 -#ifdef CONFIG_E1000_NAPI
7264 - if(unlikely(*work_done >= work_to_do)) {
7271 -#ifdef IEGBE_GBE_WORKAROUND
7274 + union iegbe_rx_desc_packet_split *rx_desc, *next_rxd;
7275 + struct net_device *netdev = adapter->netdev;
7276 + struct pci_dev *pdev = adapter->pdev;
7277 + struct iegbe_buffer *buffer_info, *next_buffer;
7278 + struct iegbe_ps_page *ps_page;
7279 + struct iegbe_ps_page_dma *ps_page_dma;
7280 + struct sk_buff *skb;
7281 + unsigned int i, j;
7282 + u32 length, staterr;
7283 + int cleaned_count = 0;
7284 + bool cleaned = false;
7285 + unsigned int total_rx_bytes=0, total_rx_packets=0;
7287 + i = rx_ring->next_to_clean;
7288 + rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
7289 + staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
7290 + buffer_info = &rx_ring->buffer_info[i];
7292 - pci_unmap_single(pdev, buffer_info->dma,
7293 - buffer_info->length,
7294 - PCI_DMA_FROMDEVICE);
7295 + while(staterr & E1000_RXD_STAT_DD) {
7296 + ps_page = &rx_ring->ps_page[i];
7297 + ps_page_dma = &rx_ring->ps_page_dma[i];
7299 + if (unlikely(*work_done >= work_to_do))
7303 skb = buffer_info->skb;
7304 + prefetch(skb->data - NET_IP_ALIGN);
7305 + if (++i == rx_ring->count) i = 0;
7306 + next_rxd = E1000_RX_DESC_PS(*rx_ring, i);
7307 + prefetch(next_rxd);
7308 + next_buffer = &rx_ring->buffer_info[i];
7311 + pci_unmap_single(pdev, buffer_info->dma,
7312 + buffer_info->length,
7313 + PCI_DMA_FROMDEVICE);
7315 + if(unlikely(!(staterr & E1000_RXD_STAT_EOP))) {
7316 + E1000_DBG("%s: Packet Split buffers didn't pick up"
7317 + " the full packet\n", netdev->name);
7318 + dev_kfree_skb_irq(skb);
7322 - if(unlikely(!(staterr & E1000_RXD_STAT_EOP))) {
7323 - E1000_DBG("%s: Packet Split buffers didn't pick up"
7324 - " the full packet\n", netdev->name);
7325 - dev_kfree_skb_irq(skb);
7329 - if(unlikely(staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK)) {
7330 - dev_kfree_skb_irq(skb);
7334 - length = le16_to_cpu(rx_desc->wb.middle.length0);
7335 + if(unlikely(staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK)) {
7336 + dev_kfree_skb_irq(skb);
7340 - if(unlikely(!length)) {
7341 - E1000_DBG("%s: Last part of the packet spanning"
7342 - " multiple descriptors\n", netdev->name);
7343 - dev_kfree_skb_irq(skb);
7346 + length = le16_to_cpu(rx_desc->wb.middle.length0);
7348 - /* Good Receive */
7349 - skb_put(skb, length);
7351 - for(j = 0; j < adapter->rx_ps_pages; j++) {
7352 - if(!(length = le16_to_cpu(rx_desc->wb.upper.length[j]))) {
7355 - pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
7356 - PAGE_SIZE, PCI_DMA_FROMDEVICE);
7357 - ps_page_dma->ps_page_dma[j] = 0;
7358 - skb_shinfo(skb)->frags[j].page =
7359 - ps_page->ps_page[j];
7360 - ps_page->ps_page[j] = NULL;
7361 - skb_shinfo(skb)->frags[j].page_offset = 0;
7362 - skb_shinfo(skb)->frags[j].size = length;
7363 - skb_shinfo(skb)->nr_frags++;
7364 - skb->len += length;
7365 - skb->data_len += length;
7367 + if(unlikely(!length)) {
7368 + E1000_DBG("%s: Last part of the packet spanning"
7369 + " multiple descriptors\n", netdev->name);
7370 + dev_kfree_skb_irq(skb);
7374 - iegbe_rx_checksum(adapter, staterr,
7375 - rx_desc->wb.lower.hi_dword.csum_ip.csum, skb);
7376 - skb->protocol = eth_type_trans(skb, netdev);
7377 + /* Good Receive */
7378 + skb_put(skb, length);
7380 - if(likely(rx_desc->wb.upper.header_status &
7381 - E1000_RXDPS_HDRSTAT_HDRSP)) {
7382 - adapter->rx_hdr_split++;
7383 -#ifdef HAVE_RX_ZERO_COPY
7384 - skb_shinfo(skb)->zero_copy = TRUE;
7387 -#ifdef CONFIG_E1000_NAPI
7388 -#ifdef NETIF_F_HW_VLAN_TX
7389 - if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
7390 - vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
7391 - le16_to_cpu(rx_desc->wb.middle.vlan) &
7392 - E1000_RXD_SPC_VLAN_MASK);
7394 - netif_receive_skb(skb);
7397 - netif_receive_skb(skb);
7399 -#else /* CONFIG_E1000_NAPI */
7400 -#ifdef NETIF_F_HW_VLAN_TX
7401 - if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
7402 - vlan_hwaccel_rx(skb, adapter->vlgrp,
7403 - le16_to_cpu(rx_desc->wb.middle.vlan) &
7404 - E1000_RXD_SPC_VLAN_MASK);
7411 -#endif /* CONFIG_E1000_NAPI */
7412 - netdev->last_rx = jiffies;
7415 + int l1 = le16_to_cpu(rx_desc->wb.upper.length[0]);
7416 + if (l1 && (l1 <= copybreak) && ((length + l1) <= adapter->rx_ps_bsize0)) {
7418 + pci_dma_sync_single_for_cpu(pdev,
7419 + ps_page_dma->ps_page_dma[0],
7421 + PCI_DMA_FROMDEVICE);
7422 + vaddr = kmap_atomic(ps_page->ps_page[0],
7423 + KM_SKB_DATA_SOFTIRQ);
7424 + memcpy(skb_tail_pointer(skb), vaddr, l1);
7425 + kunmap_atomic(vaddr, KM_SKB_DATA_SOFTIRQ);
7426 + pci_dma_sync_single_for_device(pdev,
7427 + ps_page_dma->ps_page_dma[0],
7428 + PAGE_SIZE, PCI_DMA_FROMDEVICE);
7434 + for (j = 0; j < adapter->rx_ps_pages; j++) {
7435 + length = le16_to_cpu(rx_desc->wb.upper.length[j]);
7438 + pci_unmap_page(pdev, ps_page_dma->ps_page_dma[j],
7439 + PAGE_SIZE, PCI_DMA_FROMDEVICE);
7440 + ps_page_dma->ps_page_dma[j] = 0;
7441 + skb_fill_page_desc(skb, j, ps_page->ps_page[j], 0,
7443 + ps_page->ps_page[j] = NULL;
7444 + skb->len += length;
7445 + skb->data_len += length;
7446 + skb->truesize += length;
7450 - rx_desc->wb.middle.status_error &= ~0xFF;
7451 - buffer_info->skb = NULL;
7452 - if(unlikely(++i == rx_ring->count)) { i = 0; }
7453 + pskb_trim(skb, skb->len - 4);
7455 + total_rx_bytes += skb->len;
7456 + total_rx_packets++;
7457 + iegbe_rx_checksum(adapter, staterr,
7458 + le16_to_cpu(rx_desc->wb.lower.hi_dword.csum_ip.csum), skb);
7459 + skb->protocol = eth_type_trans(skb, netdev);
7461 + if(likely(rx_desc->wb.upper.header_status &
7462 + cpu_to_le16(E1000_RXDPS_HDRSTAT_HDRSP)))
7463 + adapter->rx_hdr_split++;
7465 + if(unlikely(adapter->vlgrp && (staterr & E1000_RXD_STAT_VP))) {
7466 + vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
7467 + le16_to_cpu(rx_desc->wb.middle.vlan));
7469 + netif_receive_skb(skb);
7472 - rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
7473 - staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
7475 - rx_ring->next_to_clean = i;
7476 + netdev->last_rx = jiffies;
7478 -#ifdef IEGBE_GBE_WORKAROUND
7479 - /* Only allocate the number of buffers that we have actually
7481 - if (cleaned_count) {
7482 - adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
7485 - adapter->alloc_rx_buf(adapter, rx_ring);
7488 + rx_desc->wb.middle.status_error &= cpu_to_le32(~0xFF);
7489 + buffer_info->skb = NULL;
7492 + if (unlikely(cleaned_count >= E1000_RX_BUFFER_WRITE)) {
7493 + adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
7494 + cleaned_count = 0;
7497 + /* use prefetched values */
7498 + rx_desc = next_rxd;
7499 + buffer_info = next_buffer;
7500 + staterr = le32_to_cpu(rx_desc->wb.middle.status_error);
7502 + rx_ring->next_to_clean = i;
7504 + cleaned_count = E1000_DESC_UNUSED(rx_ring);
7505 + if (cleaned_count)
7506 + adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
7508 + adapter->total_rx_packets += total_rx_packets;
7509 + adapter->total_rx_bytes += total_rx_bytes;
7510 + adapter->net_stats.rx_bytes += total_rx_bytes;
7511 + adapter->net_stats.rx_packets += total_rx_packets;
7516 @@ -4269,142 +4038,115 @@ next_desc:
7517 * @adapter: address of board private structure
7520 -#ifdef IEGBE_GBE_WORKAROUND
7522 -iegbe_alloc_rx_buffers(struct iegbe_adapter *adapter,
7524 +static void iegbe_alloc_rx_buffers(struct iegbe_adapter *adapter,
7525 struct iegbe_rx_ring *rx_ring,
7529 -iegbe_alloc_rx_buffers(struct iegbe_adapter *adapter,
7530 - struct iegbe_rx_ring *rx_ring)
7533 - struct net_device *netdev = adapter->netdev;
7534 - struct pci_dev *pdev = adapter->pdev;
7535 - struct iegbe_rx_desc *rx_desc;
7536 - struct iegbe_buffer *buffer_info;
7537 - struct sk_buff *skb;
7539 - unsigned int bufsz = adapter->rx_buffer_len + NET_IP_ALIGN;
7541 - i = rx_ring->next_to_use;
7542 - buffer_info = &rx_ring->buffer_info[i];
7543 + struct iegbe_hw *hw = &adapter->hw;
7544 + struct net_device *netdev = adapter->netdev;
7545 + struct pci_dev *pdev = adapter->pdev;
7546 + struct iegbe_rx_desc *rx_desc;
7547 + struct iegbe_buffer *buffer_info;
7548 + struct sk_buff *skb;
7550 + unsigned int bufsz = adapter->rx_buffer_len + NET_IP_ALIGN;
7552 -#ifdef IEGBE_GBE_WORKAROUND
7553 - if (cleaned_count > IEGBE_GBE_WORKAROUND_NUM_RX_DESCRIPTORS) {
7554 - adapter->stats.cc_gt_num_rx++;
7556 - while(cleaned_count-- && !buffer_info->skb) {
7558 - while(!buffer_info->skb) {
7560 - skb = dev_alloc_skb(bufsz);
7561 + i = rx_ring->next_to_use;
7562 + buffer_info = &rx_ring->buffer_info[i];
7564 - if(unlikely(!skb)) {
7565 - /* Better luck next round */
7568 + while (cleaned_count--) {
7569 + skb = buffer_info->skb;
7574 + skb = netdev_alloc_skb(netdev, bufsz);
7576 + if(unlikely(!skb)) {
7577 + /* Better luck next round */
7578 + adapter->alloc_rx_buff_failed++;
7582 - /* Fix for errata 23, can't cross 64kB boundary */
7583 - if(!iegbe_check_64k_bound(adapter, skb->data, bufsz)) {
7584 - struct sk_buff *oldskb = skb;
7585 - DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes "
7586 - "at %p\n", bufsz, skb->data);
7587 - /* Try again, without freeing the previous */
7588 - skb = dev_alloc_skb(bufsz);
7589 - /* Failed allocation, critical failure */
7591 - dev_kfree_skb(oldskb);
7594 + /* Fix for errata 23, can't cross 64kB boundary */
7595 + if(!iegbe_check_64k_bound(adapter, skb->data, bufsz)) {
7596 + struct sk_buff *oldskb = skb;
7597 + DPRINTK(RX_ERR, ERR, "skb align check failed: %u bytes "
7598 + "at %p\n", bufsz, skb->data);
7599 + /* Try again, without freeing the previous */
7600 + skb = netdev_alloc_skb(netdev, bufsz);
7601 + /* Failed allocation, critical failure */
7603 + dev_kfree_skb(oldskb);
7607 - if(!iegbe_check_64k_bound(adapter, skb->data, bufsz)) {
7609 - dev_kfree_skb(skb);
7610 - dev_kfree_skb(oldskb);
7611 - break; /* while !buffer_info->skb */
7613 - /* Use new allocation */
7614 - dev_kfree_skb(oldskb);
7615 + if(!iegbe_check_64k_bound(adapter, skb->data, bufsz)) {
7617 + dev_kfree_skb(skb);
7618 + dev_kfree_skb(oldskb);
7619 + break; /* while !buffer_info->skb */
7622 - /* Make buffer alignment 2 beyond a 16 byte boundary
7623 - * this will result in a 16 byte aligned IP header after
7624 - * the 14 byte MAC header is removed
7626 - skb_reserve(skb, NET_IP_ALIGN);
7628 - skb->dev = netdev;
7630 - buffer_info->skb = skb;
7631 - buffer_info->length = adapter->rx_buffer_len;
7632 - buffer_info->dma = pci_map_single(pdev,
7634 - adapter->rx_buffer_len,
7635 - PCI_DMA_FROMDEVICE);
7637 - /* Fix for errata 23, can't cross 64kB boundary */
7638 - if(!iegbe_check_64k_bound(adapter,
7639 - (void *)(unsigned long)buffer_info->dma,
7640 - adapter->rx_buffer_len)) {
7641 - DPRINTK(RX_ERR, ERR,
7642 - "dma align check failed: %u bytes at %p\n",
7643 - adapter->rx_buffer_len,
7644 - (void *)(unsigned long)buffer_info->dma);
7645 - dev_kfree_skb(skb);
7646 - buffer_info->skb = NULL;
7648 - pci_unmap_single(pdev, buffer_info->dma,
7649 - adapter->rx_buffer_len,
7650 - PCI_DMA_FROMDEVICE);
7652 - break; /* while !buffer_info->skb */
7654 - rx_desc = E1000_RX_DESC(*rx_ring, i);
7655 - rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
7657 -#ifdef IEGBE_GBE_WORKAROUND_DISABLED
7658 - adapter->stats.num_rx_buf_alloc++;
7659 + /* Use new allocation */
7660 + dev_kfree_skb(oldskb);
7662 + /* Make buffer alignment 2 beyond a 16 byte boundary
7663 + * this will result in a 16 byte aligned IP header after
7664 + * the 14 byte MAC header is removed
7666 + skb_reserve(skb, NET_IP_ALIGN);
7669 + buffer_info->skb = skb;
7670 + buffer_info->length = adapter->rx_buffer_len;
7672 + buffer_info->dma = pci_map_single(pdev,
7674 + adapter->rx_buffer_len,
7675 + PCI_DMA_FROMDEVICE);
7677 + /* Fix for errata 23, can't cross 64kB boundary */
7678 + if(!iegbe_check_64k_bound(adapter,
7679 + (void *)(unsigned long)buffer_info->dma,
7680 + adapter->rx_buffer_len)) {
7681 + DPRINTK(RX_ERR, ERR,
7682 + "dma align check failed: %u bytes at %p\n",
7683 + adapter->rx_buffer_len,
7684 + (void *)(unsigned long)buffer_info->dma);
7685 + dev_kfree_skb(skb);
7686 + buffer_info->skb = NULL;
7688 + pci_unmap_single(pdev, buffer_info->dma,
7689 + adapter->rx_buffer_len,
7690 + PCI_DMA_FROMDEVICE);
7692 - /* Force memory writes to complete before letting h/w
7693 - * know there are new descriptors to fetch. (Only
7694 - * applicable for weak-ordered memory model archs,
7695 - * such as IA-64). */
7697 - writel(i, adapter->hw.hw_addr + rx_ring->rdt);
7698 + break; /* while !buffer_info->skb */
7700 + rx_desc = E1000_RX_DESC(*rx_ring, i);
7701 + rx_desc->buffer_addr = cpu_to_le64(buffer_info->dma);
7704 -#ifndef IEGBE_GBE_WORKAROUND
7705 - if(unlikely((i & ~(E1000_RX_BUFFER_WRITE - 0x1)) == i)) {
7706 - /* Force memory writes to complete before letting h/w
7707 - * know there are new descriptors to fetch. (Only
7708 - * applicable for weak-ordered memory model archs,
7709 - * such as IA-64). */
7711 - writel(i, adapter->hw.hw_addr + rx_ring->rdt);
7714 - if(unlikely(++i == rx_ring->count)) { i = 0; }
7715 - buffer_info = &rx_ring->buffer_info[i];
7717 + /* Force memory writes to complete before letting h/w
7718 + * know there are new descriptors to fetch. (Only
7719 + * applicable for weak-ordered memory model archs,
7720 + * such as IA-64). */
7721 + if (unlikely(++i == rx_ring->count))
7723 + buffer_info = &rx_ring->buffer_info[i];
7726 -#ifdef IEGBE_GBE_WORKAROUND
7727 if (likely(rx_ring->next_to_use != i)) {
7728 - rx_ring->next_to_use = i;
7729 - if (unlikely(i-- == 0)) {
7730 - i = (rx_ring->count - 0x1);
7732 + rx_ring->next_to_use = i;
7733 + if (unlikely(i-- == 0))
7734 + i = (rx_ring->count - 1);
7736 /* Force memory writes to complete before letting h/w
7737 * know there are new descriptors to fetch. (Only
7738 * applicable for weak-ordered memory model archs,
7739 * such as IA-64). */
7741 - writel(i, adapter->hw.hw_addr + rx_ring->rdt);
7742 + writel(i, hw->hw_addr + rx_ring->rdt);
7745 - rx_ring->next_to_use = i;
7750 @@ -4412,49 +4154,41 @@ iegbe_alloc_rx_buffers(struct iegbe_adap
7751 * @adapter: address of board private structure
7754 -#ifdef IEGBE_GBE_WORKAROUND
7756 -iegbe_alloc_rx_buffers_ps(struct iegbe_adapter *adapter,
7758 +static void iegbe_alloc_rx_buffers_ps(struct iegbe_adapter *adapter,
7759 struct iegbe_rx_ring *rx_ring,
7763 -iegbe_alloc_rx_buffers_ps(struct iegbe_adapter *adapter,
7764 - struct iegbe_rx_ring *rx_ring)
7767 - struct net_device *netdev = adapter->netdev;
7768 - struct pci_dev *pdev = adapter->pdev;
7769 - union iegbe_rx_desc_packet_split *rx_desc;
7770 - struct iegbe_buffer *buffer_info;
7771 - struct iegbe_ps_page *ps_page;
7772 - struct iegbe_ps_page_dma *ps_page_dma;
7773 - struct sk_buff *skb;
7774 - unsigned int i, j;
7776 - i = rx_ring->next_to_use;
7777 - buffer_info = &rx_ring->buffer_info[i];
7778 - ps_page = &rx_ring->ps_page[i];
7779 - ps_page_dma = &rx_ring->ps_page_dma[i];
7780 + struct iegbe_hw *hw = &adapter->hw;
7781 + struct net_device *netdev = adapter->netdev;
7782 + struct pci_dev *pdev = adapter->pdev;
7783 + union iegbe_rx_desc_packet_split *rx_desc;
7784 + struct iegbe_buffer *buffer_info;
7785 + struct iegbe_ps_page *ps_page;
7786 + struct iegbe_ps_page_dma *ps_page_dma;
7787 + struct sk_buff *skb;
7788 + unsigned int i, j;
7790 + i = rx_ring->next_to_use;
7791 + buffer_info = &rx_ring->buffer_info[i];
7792 + ps_page = &rx_ring->ps_page[i];
7793 + ps_page_dma = &rx_ring->ps_page_dma[i];
7795 -#ifdef IEGBE_GBE_WORKAROUND
7796 - while(cleaned_count-- && !buffer_info->skb) {
7798 - while(!buffer_info->skb) {
7800 - rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
7801 + while (cleaned_count--) {
7802 + rx_desc = E1000_RX_DESC_PS(*rx_ring, i);
7804 for (j = 0; j < PS_PAGE_BUFFERS; j++) {
7805 - if (j < adapter->rx_ps_pages) {
7806 - if (likely(!ps_page->ps_page[j])) {
7807 - ps_page->ps_page[j] =
7808 - alloc_page(GFP_ATOMIC);
7809 + if (j < adapter->rx_ps_pages) {
7810 + if (likely(!ps_page->ps_page[j])) {
7811 + ps_page->ps_page[j] =
7812 + alloc_page(GFP_ATOMIC);
7813 if (unlikely(!ps_page->ps_page[j])) {
7815 + adapter->alloc_rx_buff_failed++;
7818 - ps_page_dma->ps_page_dma[j] =
7819 - pci_map_page(pdev,
7820 - ps_page->ps_page[j],
7821 + ps_page_dma->ps_page_dma[j] =
7822 + pci_map_page(pdev,
7823 + ps_page->ps_page[j],
7825 PCI_DMA_FROMDEVICE);
7827 @@ -4462,26 +4196,26 @@ iegbe_alloc_rx_buffers_ps(struct iegbe_a
7828 * change because each write-back erases
7831 - rx_desc->read.buffer_addr[j+0x1] =
7832 + rx_desc->read.buffer_addr[j+1] =
7833 cpu_to_le64(ps_page_dma->ps_page_dma[j]);
7835 - rx_desc->read.buffer_addr[j+0x1] = ~0;
7838 + rx_desc->read.buffer_addr[j+1] = ~cpu_to_le64(0);
7841 - skb = dev_alloc_skb(adapter->rx_ps_bsize0 + NET_IP_ALIGN);
7842 + skb = netdev_alloc_skb(netdev,
7843 + adapter->rx_ps_bsize0 + NET_IP_ALIGN);
7845 - if (unlikely(!skb)) {
7846 + if (unlikely(!skb)) {
7847 + adapter->alloc_rx_buff_failed++;
7852 /* Make buffer alignment 2 beyond a 16 byte boundary
7853 * this will result in a 16 byte aligned IP header after
7854 * the 14 byte MAC header is removed
7856 skb_reserve(skb, NET_IP_ALIGN);
7858 - skb->dev = netdev;
7860 buffer_info->skb = skb;
7861 buffer_info->length = adapter->rx_ps_bsize0;
7862 buffer_info->dma = pci_map_single(pdev, skb->data,
7863 @@ -4490,27 +4224,28 @@ iegbe_alloc_rx_buffers_ps(struct iegbe_a
7865 rx_desc->read.buffer_addr[0] = cpu_to_le64(buffer_info->dma);
7867 - if (unlikely((i & ~(E1000_RX_BUFFER_WRITE - 0x1)) == i)) {
7868 - /* Force memory writes to complete before letting h/w
7869 - * know there are new descriptors to fetch. (Only
7870 - * applicable for weak-ordered memory model archs,
7871 - * such as IA-64). */
7873 - /* Hardware increments by 16 bytes, but packet split
7874 - * descriptors are 32 bytes...so we increment tail
7877 - writel(i<<1, adapter->hw.hw_addr + rx_ring->rdt);
7880 - if (unlikely(++i == rx_ring->count)) { i = 0; }
7881 + if (unlikely(++i == rx_ring->count)) i = 0;
7882 buffer_info = &rx_ring->buffer_info[i];
7883 ps_page = &rx_ring->ps_page[i];
7884 ps_page_dma = &rx_ring->ps_page_dma[i];
7888 - rx_ring->next_to_use = i;
7889 + if (likely(rx_ring->next_to_use != i)) {
7890 + rx_ring->next_to_use = i;
7891 + if (unlikely(i-- == 0)) i = (rx_ring->count - 1);
7893 + /* Force memory writes to complete before letting h/w
7894 + * know there are new descriptors to fetch. (Only
7895 + * applicable for weak-ordered memory model archs,
7896 + * such as IA-64). */
7898 + /* Hardware increments by 16 bytes, but packet split
7899 + * descriptors are 32 bytes...so we increment tail
7902 + writel(i<<1, hw->hw_addr + rx_ring->rdt);
7907 @@ -4521,52 +4256,52 @@ no_buffers:
7909 iegbe_smartspeed(struct iegbe_adapter *adapter)
7911 - uint16_t phy_status;
7912 - uint16_t phy_ctrl;
7913 + uint16_t phy_status;
7914 + uint16_t phy_ctrl;
7916 - if((adapter->hw.phy_type != iegbe_phy_igp) || !adapter->hw.autoneg ||
7917 + if((adapter->hw.phy_type != iegbe_phy_igp) || !adapter->hw.autoneg ||
7918 !(adapter->hw.autoneg_advertised & ADVERTISE_1000_FULL)) {
7922 - if(adapter->smartspeed == 0) {
7923 - /* If Master/Slave config fault is asserted twice,
7924 - * we assume back-to-back */
7925 - iegbe_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status);
7926 + if(adapter->smartspeed == 0x0) {
7927 + /* If Master/Slave config fault is asserted twice,
7928 + * we assume back-to-back */
7929 + iegbe_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status);
7930 if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) { return; }
7931 - iegbe_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status);
7932 + iegbe_read_phy_reg(&adapter->hw, PHY_1000T_STATUS, &phy_status);
7933 if(!(phy_status & SR_1000T_MS_CONFIG_FAULT)) { return; }
7934 - iegbe_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl);
7935 - if(phy_ctrl & CR_1000T_MS_ENABLE) {
7936 - phy_ctrl &= ~CR_1000T_MS_ENABLE;
7937 - iegbe_write_phy_reg(&adapter->hw, PHY_1000T_CTRL,
7939 - adapter->smartspeed++;
7940 - if(!iegbe_phy_setup_autoneg(&adapter->hw) &&
7941 - !iegbe_read_phy_reg(&adapter->hw, PHY_CTRL,
7943 - phy_ctrl |= (MII_CR_AUTO_NEG_EN |
7944 - MII_CR_RESTART_AUTO_NEG);
7945 - iegbe_write_phy_reg(&adapter->hw, PHY_CTRL,
7950 - } else if(adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) {
7951 - /* If still no link, perhaps using 2/3 pair cable */
7952 - iegbe_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl);
7953 - phy_ctrl |= CR_1000T_MS_ENABLE;
7954 - iegbe_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_ctrl);
7955 - if(!iegbe_phy_setup_autoneg(&adapter->hw) &&
7956 - !iegbe_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_ctrl)) {
7957 - phy_ctrl |= (MII_CR_AUTO_NEG_EN |
7958 - MII_CR_RESTART_AUTO_NEG);
7959 - iegbe_write_phy_reg(&adapter->hw, PHY_CTRL, phy_ctrl);
7962 - /* Restart process after E1000_SMARTSPEED_MAX iterations */
7963 + iegbe_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl);
7964 + if(phy_ctrl & CR_1000T_MS_ENABLE) {
7965 + phy_ctrl &= ~CR_1000T_MS_ENABLE;
7966 + iegbe_write_phy_reg(&adapter->hw, PHY_1000T_CTRL,
7968 + adapter->smartspeed++;
7969 + if(!iegbe_phy_setup_autoneg(&adapter->hw) &&
7970 + !iegbe_read_phy_reg(&adapter->hw, PHY_CTRL,
7972 + phy_ctrl |= (MII_CR_AUTO_NEG_EN |
7973 + MII_CR_RESTART_AUTO_NEG);
7974 + iegbe_write_phy_reg(&adapter->hw, PHY_CTRL,
7979 + } else if(adapter->smartspeed == E1000_SMARTSPEED_DOWNSHIFT) {
7980 + /* If still no link, perhaps using 2/3 pair cable */
7981 + iegbe_read_phy_reg(&adapter->hw, PHY_1000T_CTRL, &phy_ctrl);
7982 + phy_ctrl |= CR_1000T_MS_ENABLE;
7983 + iegbe_write_phy_reg(&adapter->hw, PHY_1000T_CTRL, phy_ctrl);
7984 + if(!iegbe_phy_setup_autoneg(&adapter->hw) &&
7985 + !iegbe_read_phy_reg(&adapter->hw, PHY_CTRL, &phy_ctrl)) {
7986 + phy_ctrl |= (MII_CR_AUTO_NEG_EN |
7987 + MII_CR_RESTART_AUTO_NEG);
7988 + iegbe_write_phy_reg(&adapter->hw, PHY_CTRL, phy_ctrl);
7991 + /* Restart process after E1000_SMARTSPEED_MAX iterations */
7992 if(adapter->smartspeed++ == E1000_SMARTSPEED_MAX) {
7993 - adapter->smartspeed = 0;
7995 + adapter->smartspeed = 0x0;
8000 @@ -4576,23 +4311,22 @@ iegbe_smartspeed(struct iegbe_adapter *a
8005 -iegbe_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
8006 +static int iegbe_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
8014 - return iegbe_mii_ioctl(netdev, ifr, cmd);
8018 + return iegbe_mii_ioctl(netdev, ifr, cmd);
8020 #ifdef ETHTOOL_OPS_COMPAT
8022 - return ethtool_ioctl(ifr);
8024 + return ethtool_ioctl(ifr);
8027 - return -EOPNOTSUPP;
8030 + return -EOPNOTSUPP;
8035 @@ -4603,534 +4337,510 @@ iegbe_ioctl(struct net_device *netdev, s
8040 -iegbe_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
8041 +static int iegbe_mii_ioctl(struct net_device *netdev, struct ifreq *ifr,
8044 - struct iegbe_adapter *adapter = netdev_priv(netdev);
8045 - struct mii_ioctl_data *data = if_mii(ifr);
8049 - unsigned long flags;
8051 - if((adapter->hw.media_type == iegbe_media_type_oem &&
8052 - !iegbe_oem_phy_is_copper(&adapter->hw)) ||
8053 - adapter->hw.media_type == iegbe_media_type_fiber ||
8054 - adapter->hw.media_type == iegbe_media_type_internal_serdes ) {
8055 - return -EOPNOTSUPP;
8059 - data->phy_id = adapter->hw.phy_addr;
8062 + struct iegbe_adapter *adapter = netdev_priv(netdev);
8063 + struct mii_ioctl_data *data = if_mii(ifr);
8067 + unsigned long flags = 0;
8069 + if((adapter->hw.media_type == iegbe_media_type_oem
8070 + && !iegbe_oem_phy_is_copper(&adapter->hw))
8071 + ||adapter->hw.media_type != iegbe_media_type_copper) {
8072 + return -EOPNOTSUPP;
8076 + data->phy_id = adapter->hw.phy_addr;
8079 if(!capable(CAP_NET_ADMIN)) {
8083 - spin_lock_irqsave(&adapter->stats_lock, flags);
8084 - if(iegbe_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
8085 - &data->val_out)) {
8086 - spin_unlock_irqrestore(&adapter->stats_lock, flags);
8089 - spin_unlock_irqrestore(&adapter->stats_lock, flags);
8092 + spin_lock_irqsave(&adapter->stats_lock, flags);
8093 + if(iegbe_read_phy_reg(&adapter->hw, data->reg_num & 0x1F,
8094 + &data->val_out)) {
8095 + spin_unlock_irqrestore(&adapter->stats_lock, flags);
8098 + spin_unlock_irqrestore(&adapter->stats_lock, flags);
8101 if(!capable(CAP_NET_ADMIN)){
8105 if(data->reg_num & ~(0x1F)) {
8109 - mii_reg = data->val_in;
8110 - spin_lock_irqsave(&adapter->stats_lock, flags);
8111 - if(iegbe_write_phy_reg(&adapter->hw, data->reg_num,
8113 - spin_unlock_irqrestore(&adapter->stats_lock, flags);
8116 - switch(adapter->hw.phy_type) {
8117 - case iegbe_phy_m88:
8118 - switch (data->reg_num) {
8120 + mii_reg = data->val_in;
8121 + spin_lock_irqsave(&adapter->stats_lock, flags);
8122 + if(iegbe_write_phy_reg(&adapter->hw, data->reg_num,
8124 + spin_unlock_irqrestore(&adapter->stats_lock, flags);
8127 + switch(adapter->hw.phy_type) {
8128 + case iegbe_phy_m88:
8129 + switch (data->reg_num) {
8131 if(mii_reg & MII_CR_POWER_DOWN) {
8135 - if(mii_reg & MII_CR_AUTO_NEG_EN) {
8136 - adapter->hw.autoneg = 1;
8137 - adapter->hw.autoneg_advertised = 0x2F;
8139 + if(mii_reg & MII_CR_AUTO_NEG_EN) {
8140 + adapter->hw.autoneg = 1;
8141 + adapter->hw.autoneg_advertised = 0x2F;
8144 - spddplx = SPEED_1000;
8145 + spddplx = SPEED_1000;
8146 } else if(mii_reg & 0x2000) {
8147 - spddplx = SPEED_100;
8148 + spddplx = SPEED_100;
8150 - spddplx = SPEED_10;
8151 + spddplx = SPEED_10;
8153 - spddplx += (mii_reg & 0x100)
8156 - retval = iegbe_set_spd_dplx(adapter,
8159 - spin_unlock_irqrestore(
8160 - &adapter->stats_lock,
8165 - if(netif_running(adapter->netdev)) {
8166 - iegbe_down(adapter);
8167 - iegbe_up(adapter);
8168 + spddplx += (mii_reg & 0x100)
8171 + retval = iegbe_set_spd_dplx(adapter,
8174 + spin_unlock_irqrestore(
8175 + &adapter->stats_lock,
8180 + if(netif_running(adapter->netdev)) {
8181 + iegbe_down(adapter);
8182 + iegbe_up(adapter);
8184 - iegbe_reset(adapter);
8185 + iegbe_reset(adapter);
8188 - case M88E1000_PHY_SPEC_CTRL:
8189 - case M88E1000_EXT_PHY_SPEC_CTRL:
8190 - if(iegbe_phy_reset(&adapter->hw)) {
8191 - spin_unlock_irqrestore(
8192 - &adapter->stats_lock, flags);
8199 + case M88E1000_PHY_SPEC_CTRL:
8200 + case M88E1000_EXT_PHY_SPEC_CTRL:
8201 + if(iegbe_phy_reset(&adapter->hw)) {
8202 + spin_unlock_irqrestore(
8203 + &adapter->stats_lock, flags);
8210 - case iegbe_phy_oem:
8211 - retval = iegbe_oem_mii_ioctl(adapter, flags, ifr, cmd);
8213 - spin_unlock_irqrestore(
8214 - &adapter->stats_lock, flags);
8218 + case iegbe_phy_oem:
8219 + retval = iegbe_oem_mii_ioctl(adapter, flags, ifr, cmd);
8221 + spin_unlock_irqrestore(
8222 + &adapter->stats_lock, flags);
8228 - switch (data->reg_num) {
8231 + switch (data->reg_num) {
8233 if(mii_reg & MII_CR_POWER_DOWN) {
8237 - if(netif_running(adapter->netdev)) {
8238 - iegbe_down(adapter);
8239 - iegbe_up(adapter);
8240 + if(netif_running(adapter->netdev)) {
8241 + iegbe_down(adapter);
8242 + iegbe_up(adapter);
8244 - iegbe_reset(adapter);
8245 + iegbe_reset(adapter);
8250 - spin_unlock_irqrestore(&adapter->stats_lock, flags);
8253 - return -EOPNOTSUPP;
8255 - return E1000_SUCCESS;
8259 + spin_unlock_irqrestore(&adapter->stats_lock, flags);
8262 + return -EOPNOTSUPP;
8264 + return E1000_SUCCESS;
8269 -iegbe_pci_set_mwi(struct iegbe_hw *hw)
8270 +void iegbe_pci_set_mwi(struct iegbe_hw *hw)
8272 - struct iegbe_adapter *adapter = hw->back;
8273 -#ifdef HAVE_PCI_SET_MWI
8274 - int ret_val = pci_set_mwi(adapter->pdev);
8277 - DPRINTK(PROBE, ERR, "Error in setting MWI\n");
8280 - pci_write_config_word(adapter->pdev, PCI_COMMAND,
8281 - adapter->hw.pci_cmd_word |
8282 - PCI_COMMAND_INVALIDATE);
8284 + struct iegbe_adapter *adapter = hw->back;
8285 + int ret_val = pci_set_mwi(adapter->pdev);
8288 + DPRINTK(PROBE, ERR, "Error in setting MWI\n");
8292 -iegbe_pci_clear_mwi(struct iegbe_hw *hw)
8293 +void iegbe_pci_clear_mwi(struct iegbe_hw *hw)
8295 - struct iegbe_adapter *adapter = hw->back;
8296 + struct iegbe_adapter *adapter = hw->back;
8298 -#ifdef HAVE_PCI_SET_MWI
8299 - pci_clear_mwi(adapter->pdev);
8301 - pci_write_config_word(adapter->pdev, PCI_COMMAND,
8302 - adapter->hw.pci_cmd_word &
8303 - ~PCI_COMMAND_INVALIDATE);
8305 + pci_clear_mwi(adapter->pdev);
8309 iegbe_read_pci_cfg(struct iegbe_hw *hw, uint32_t reg, uint16_t *value)
8311 - struct iegbe_adapter *adapter = hw->back;
8312 + struct iegbe_adapter *adapter = hw->back;
8314 - pci_read_config_word(adapter->pdev, reg, value);
8315 + pci_read_config_word(adapter->pdev, reg, value);
8319 iegbe_write_pci_cfg(struct iegbe_hw *hw, uint32_t reg, uint16_t *value)
8321 - struct iegbe_adapter *adapter = hw->back;
8322 + struct iegbe_adapter *adapter = hw->back;
8324 - pci_write_config_word(adapter->pdev, reg, *value);
8325 + pci_write_config_word(adapter->pdev, reg, *value);
8329 iegbe_io_read(struct iegbe_hw *hw, unsigned long port)
8336 iegbe_io_write(struct iegbe_hw *hw, unsigned long port, uint32_t value)
8338 - outl(value, port);
8339 + outl(value, port);
8342 -#ifdef NETIF_F_HW_VLAN_TX
8344 -iegbe_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
8345 +static void iegbe_vlan_rx_register(struct net_device *netdev,
8346 + struct vlan_group *grp)
8348 - struct iegbe_adapter *adapter = netdev_priv(netdev);
8349 - uint32_t ctrl, rctl;
8351 - iegbe_irq_disable(adapter);
8352 - adapter->vlgrp = grp;
8355 - /* enable VLAN tag insert/strip */
8356 - ctrl = E1000_READ_REG(&adapter->hw, CTRL);
8357 - ctrl |= E1000_CTRL_VME;
8358 - E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
8360 - /* enable VLAN receive filtering */
8361 - rctl = E1000_READ_REG(&adapter->hw, RCTL);
8362 - rctl |= E1000_RCTL_VFE;
8363 - rctl &= ~E1000_RCTL_CFIEN;
8364 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
8365 - iegbe_update_mng_vlan(adapter);
8367 - /* disable VLAN tag insert/strip */
8368 - ctrl = E1000_READ_REG(&adapter->hw, CTRL);
8369 - ctrl &= ~E1000_CTRL_VME;
8370 - E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
8371 + struct iegbe_adapter *adapter = netdev_priv(netdev);
8372 + uint32_t ctrl, rctl;
8374 - /* disable VLAN filtering */
8375 - rctl = E1000_READ_REG(&adapter->hw, RCTL);
8376 - rctl &= ~E1000_RCTL_VFE;
8377 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
8378 - if(adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) {
8379 - iegbe_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
8380 - adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
8383 + if (!test_bit(__E1000_DOWN, &adapter->flags))
8384 + iegbe_irq_disable(adapter);
8385 + adapter->vlgrp = grp;
8388 + /* enable VLAN tag insert/strip */
8389 + ctrl = E1000_READ_REG(&adapter->hw, CTRL);
8390 + ctrl |= E1000_CTRL_VME;
8391 + E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
8393 + /* enable VLAN receive filtering */
8394 + rctl = E1000_READ_REG(&adapter->hw, RCTL);
8395 + rctl |= E1000_RCTL_VFE;
8396 + rctl &= ~E1000_RCTL_CFIEN;
8397 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
8398 + iegbe_update_mng_vlan(adapter);
8400 + /* disable VLAN tag insert/strip */
8401 + ctrl = E1000_READ_REG(&adapter->hw, CTRL);
8402 + ctrl &= ~E1000_CTRL_VME;
8403 + E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
8405 + /* disable VLAN filtering */
8406 + rctl = E1000_READ_REG(&adapter->hw, RCTL);
8407 + rctl &= ~E1000_RCTL_VFE;
8408 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
8409 + if(adapter->mng_vlan_id != (uint16_t)E1000_MNG_VLAN_NONE) {
8410 + iegbe_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
8411 + adapter->mng_vlan_id = E1000_MNG_VLAN_NONE;
8415 - iegbe_irq_enable(adapter);
8416 + if (!test_bit(__E1000_DOWN, &adapter->flags))
8417 + iegbe_irq_enable(adapter);
8421 -iegbe_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid)
8422 +static void iegbe_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
8424 - struct iegbe_adapter *adapter = netdev_priv(netdev);
8425 - uint32_t vfta, index;
8426 - if((adapter->hw.mng_cookie.status &
8427 - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
8428 + struct iegbe_adapter *adapter = netdev_priv(netdev);
8429 + uint32_t vfta, index;
8430 + if((adapter->hw.mng_cookie.status &
8431 + E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
8432 (vid == adapter->mng_vlan_id)) {
8436 - /* add VID to filter table */
8437 + /* add VID to filter table */
8438 index = (vid >> 0x5) & 0x7F;
8439 - vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
8440 + vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
8441 vfta |= (0x1 << (vid & 0x1F));
8442 - iegbe_write_vfta(&adapter->hw, index, vfta);
8443 + iegbe_write_vfta(&adapter->hw, index, vfta);
8447 -iegbe_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid)
8448 +static void iegbe_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
8450 struct iegbe_adapter *adapter = netdev_priv(netdev);
8451 - uint32_t vfta, index;
8454 + if (!test_bit(__E1000_DOWN, &adapter->flags))
8455 iegbe_irq_disable(adapter);
8457 - if(adapter->vlgrp) {
8458 - adapter->vlgrp->vlan_devices[vid] = NULL;
8460 + vlan_group_set_device(adapter->vlgrp, vid, NULL);
8461 + if (!test_bit(__E1000_DOWN, &adapter->flags))
8462 iegbe_irq_enable(adapter);
8464 - if((adapter->hw.mng_cookie.status &
8465 - E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT) &&
8466 - (vid == adapter->mng_vlan_id)) {
8469 /* remove VID from filter table */
8470 - index = (vid >> 0x5) & 0x7F;
8471 + index = (vid >> 0x5) & 0x7F;
8472 vfta = E1000_READ_REG_ARRAY(&adapter->hw, VFTA, index);
8473 - vfta &= ~(0x1 << (vid & 0x1F));
8474 + vfta &= ~(0x1 << (vid & 0x1F));
8475 iegbe_write_vfta(&adapter->hw, index, vfta);
8479 -iegbe_restore_vlan(struct iegbe_adapter *adapter)
8480 +static void iegbe_restore_vlan(struct iegbe_adapter *adapter)
8482 iegbe_vlan_rx_register(adapter->netdev, adapter->vlgrp);
8484 - if(adapter->vlgrp) {
8486 - for(vid = 0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
8487 - if(!adapter->vlgrp->vlan_devices[vid]) {
8488 + if (adapter->vlgrp) {
8490 + for (vid = 0x0; vid < VLAN_GROUP_ARRAY_LEN; vid++) {
8491 + if (!vlan_group_get_device(adapter->vlgrp, vid))
8494 iegbe_vlan_rx_add_vid(adapter->netdev, vid);
8501 -iegbe_set_spd_dplx(struct iegbe_adapter *adapter, uint16_t spddplx)
8503 +int iegbe_set_spd_dplx(struct iegbe_adapter *adapter, u16 spddplx)
8505 - adapter->hw.autoneg = 0;
8506 + adapter->hw.autoneg = 0x0;
8508 - /* Fiber NICs only allow 1000 gbps Full duplex */
8509 - if((adapter->hw.media_type == iegbe_media_type_fiber
8510 + /* Fiber NICs only allow 1000 gbps Full duplex */
8511 + if((adapter->hw.media_type == iegbe_media_type_fiber
8512 || (adapter->hw.media_type == iegbe_media_type_oem
8513 && !iegbe_oem_phy_is_copper(&adapter->hw)))
8514 - && spddplx != (SPEED_1000 + FULL_DUPLEX)) {
8515 - DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
8520 - case SPEED_10 + HALF_DUPLEX:
8521 - adapter->hw.forced_speed_duplex = iegbe_10_half;
8523 - case SPEED_10 + FULL_DUPLEX:
8524 - adapter->hw.forced_speed_duplex = iegbe_10_full;
8526 - case SPEED_100 + HALF_DUPLEX:
8527 - adapter->hw.forced_speed_duplex = iegbe_100_half;
8529 - case SPEED_100 + FULL_DUPLEX:
8530 - adapter->hw.forced_speed_duplex = iegbe_100_full;
8532 - case SPEED_1000 + FULL_DUPLEX:
8533 + && spddplx != (SPEED_1000 + DUPLEX_FULL)) {
8534 + DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
8539 + case SPEED_10 + DUPLEX_HALF:
8540 + adapter->hw.forced_speed_duplex = iegbe_10_half;
8542 + case SPEED_10 + DUPLEX_FULL:
8543 + adapter->hw.forced_speed_duplex = iegbe_10_full;
8545 + case SPEED_100 + DUPLEX_HALF:
8546 + adapter->hw.forced_speed_duplex = iegbe_100_half;
8548 + case SPEED_100 + DUPLEX_FULL:
8549 + adapter->hw.forced_speed_duplex = iegbe_100_full;
8551 + case SPEED_1000 + DUPLEX_FULL:
8552 adapter->hw.autoneg = 0x1;
8553 - adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
8555 - case SPEED_1000 + HALF_DUPLEX: /* not supported */
8557 - DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
8561 + adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
8563 + case SPEED_1000 + DUPLEX_HALF: /* not supported */
8565 + DPRINTK(PROBE, ERR, "Unsupported Speed/Duplex configuration\n");
8572 iegbe_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
8574 - struct pci_dev *pdev = NULL;
8575 + struct pci_dev *pdev = NULL;
8576 pm_message_t state = {0x3};
8582 - case SYS_POWER_OFF:
8583 - while((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
8587 + case SYS_POWER_OFF:
8588 + while((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev))) {
8589 if(pci_dev_driver(pdev) == &iegbe_driver) {
8590 - iegbe_suspend(pdev, state);
8593 + iegbe_suspend(pdev, state);
8597 - return NOTIFY_DONE;
8598 + return NOTIFY_DONE;
8602 iegbe_suspend(struct pci_dev *pdev, pm_message_t state)
8604 - struct net_device *netdev = pci_get_drvdata(pdev);
8605 - struct iegbe_adapter *adapter = netdev_priv(netdev);
8606 - uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm;
8607 - uint32_t wufc = adapter->wol;
8608 - uint16_t cmd_word;
8609 + struct net_device *netdev = pci_get_drvdata(pdev);
8610 + struct iegbe_adapter *adapter = netdev_priv(netdev);
8611 + uint32_t ctrl, ctrl_ext, rctl, manc, status, swsm;
8612 + uint32_t wufc = adapter->wol;
8613 + uint16_t cmd_word;
8615 - netif_device_detach(netdev);
8616 + netif_device_detach(netdev);
8618 if(netif_running(netdev)) {
8619 - iegbe_down(adapter);
8620 + WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags));
8621 + iegbe_down(adapter);
8624 - * ICP_XXXX style MACs do not have a link up bit in
8625 - * the STATUS register, query the PHY directly
8627 - if(adapter->hw.mac_type != iegbe_icp_xxxx) {
8628 - status = E1000_READ_REG(&adapter->hw, STATUS);
8630 + * ICP_XXXX style MACs do not have a link up bit in
8631 + * the STATUS register, query the PHY directly
8633 + if(adapter->hw.mac_type != iegbe_icp_xxxx) {
8634 + status = E1000_READ_REG(&adapter->hw, STATUS);
8635 if(status & E1000_STATUS_LU) {
8636 - wufc &= ~E1000_WUFC_LNKC;
8637 + wufc &= ~E1000_WUFC_LNKC;
8643 if(iegbe_oem_phy_is_link_up(&adapter->hw, &isUp) != E1000_SUCCESS) {
8648 - wufc &= ~E1000_WUFC_LNKC;
8650 + wufc &= ~E1000_WUFC_LNKC;
8655 - iegbe_setup_rctl(adapter);
8656 - iegbe_set_multi(netdev);
8658 - /* turn on all-multi mode if wake on multicast is enabled */
8659 - if(adapter->wol & E1000_WUFC_MC) {
8660 - rctl = E1000_READ_REG(&adapter->hw, RCTL);
8661 - rctl |= E1000_RCTL_MPE;
8662 - E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
8665 + iegbe_setup_rctl(adapter);
8666 + iegbe_set_rx_mode(netdev);
8668 + /* turn on all-multi mode if wake on multicast is enabled */
8669 + if(adapter->wol & E1000_WUFC_MC) {
8670 + rctl = E1000_READ_REG(&adapter->hw, RCTL);
8671 + rctl |= E1000_RCTL_MPE;
8672 + E1000_WRITE_REG(&adapter->hw, RCTL, rctl);
8675 - if(adapter->hw.mac_type >= iegbe_82540) {
8676 - ctrl = E1000_READ_REG(&adapter->hw, CTRL);
8677 - /* advertise wake from D3Cold */
8678 - #define E1000_CTRL_ADVD3WUC 0x00100000
8679 - /* phy power management enable */
8680 - ctrl |= E1000_CTRL_ADVD3WUC |
8681 - (adapter->hw.mac_type != iegbe_icp_xxxx
8682 - ? E1000_CTRL_EN_PHY_PWR_MGMT : 0);
8683 + if(adapter->hw.mac_type >= iegbe_82540) {
8684 + ctrl = E1000_READ_REG(&adapter->hw, CTRL);
8685 + /* advertise wake from D3Cold */
8686 + #define E1000_CTRL_ADVD3WUC 0x00100000
8687 + /* phy power management enable */
8688 + #define E1000_CTRL_EN_PHY_PWR_MGMT 0x00200000
8689 + ctrl |= E1000_CTRL_ADVD3WUC |
8690 + (adapter->hw.mac_type != iegbe_icp_xxxx
8691 + ? E1000_CTRL_EN_PHY_PWR_MGMT : 0x0);
8693 - E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
8695 + E1000_WRITE_REG(&adapter->hw, CTRL, ctrl);
8698 - if(adapter->hw.media_type == iegbe_media_type_fiber ||
8699 - adapter->hw.media_type == iegbe_media_type_internal_serdes) {
8700 - /* keep the laser running in D3 */
8701 - ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
8702 - ctrl_ext |= E1000_CTRL_EXT_SDP7_DATA;
8703 - E1000_WRITE_REG(&adapter->hw, CTRL_EXT, ctrl_ext);
8705 + if(adapter->hw.media_type == iegbe_media_type_fiber ||
8706 + adapter->hw.media_type == iegbe_media_type_internal_serdes) {
8707 + /* keep the laser running in D3 */
8708 + ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
8709 + ctrl_ext |= E1000_CTRL_EXT_SDP7_DATA;
8710 + E1000_WRITE_REG(&adapter->hw, CTRL_EXT, ctrl_ext);
8713 /* Allow OEM PHYs (if any exist) to keep the laser
8715 iegbe_oem_fiber_live_in_suspend(&adapter->hw);
8717 - /* Allow time for pending master requests to run */
8718 - iegbe_disable_pciex_master(&adapter->hw);
8719 + /* Allow time for pending master requests to run */
8720 + iegbe_disable_pciex_master(&adapter->hw);
8722 - E1000_WRITE_REG(&adapter->hw, WUC, E1000_WUC_PME_EN);
8723 - E1000_WRITE_REG(&adapter->hw, WUFC, wufc);
8724 + E1000_WRITE_REG(&adapter->hw, WUC, E1000_WUC_PME_EN);
8725 + E1000_WRITE_REG(&adapter->hw, WUFC, wufc);
8726 pci_enable_wake(pdev, 0x3, 0x1);
8727 pci_enable_wake(pdev, 0x4, 0x1); /* 4 == D3 cold */
8729 - E1000_WRITE_REG(&adapter->hw, WUC, 0);
8730 - E1000_WRITE_REG(&adapter->hw, WUFC, 0);
8731 - pci_enable_wake(pdev, 0x3, 0);
8732 - pci_enable_wake(pdev, 0x4, 0); /* 4 == D3 cold */
8735 + E1000_WRITE_REG(&adapter->hw, WUC, 0x0);
8736 + E1000_WRITE_REG(&adapter->hw, WUFC, 0x0);
8737 + pci_enable_wake(pdev, 0x3, 0x0);
8738 + pci_enable_wake(pdev, 0x4, 0x0); /* 4 == D3 cold */
8741 - pci_save_state(pdev);
8743 - if(adapter->hw.mac_type >= iegbe_82540
8744 - && adapter->hw.mac_type != iegbe_icp_xxxx
8745 - && adapter->hw.media_type == iegbe_media_type_copper) {
8746 - manc = E1000_READ_REG(&adapter->hw, MANC);
8747 - if(manc & E1000_MANC_SMBUS_EN) {
8748 - manc |= E1000_MANC_ARP_EN;
8749 - E1000_WRITE_REG(&adapter->hw, MANC, manc);
8750 + pci_save_state(pdev);
8752 + if(adapter->hw.mac_type >= iegbe_82540
8753 + && adapter->hw.mac_type != iegbe_icp_xxxx
8754 + && adapter->hw.media_type == iegbe_media_type_copper) {
8755 + manc = E1000_READ_REG(&adapter->hw, MANC);
8756 + if(manc & E1000_MANC_SMBUS_EN) {
8757 + manc |= E1000_MANC_ARP_EN;
8758 + E1000_WRITE_REG(&adapter->hw, MANC, manc);
8759 pci_enable_wake(pdev, 0x3, 0x1);
8760 pci_enable_wake(pdev, 0x4, 0x1); /* 4 == D3 cold */
8766 - switch(adapter->hw.mac_type) {
8769 - ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
8770 - E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
8771 - ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
8774 - swsm = E1000_READ_REG(&adapter->hw, SWSM);
8775 - E1000_WRITE_REG(&adapter->hw, SWSM,
8776 - swsm & ~E1000_SWSM_DRV_LOAD);
8781 + switch(adapter->hw.mac_type) {
8784 + ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
8785 + E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
8786 + ctrl_ext & ~E1000_CTRL_EXT_DRV_LOAD);
8789 + swsm = E1000_READ_REG(&adapter->hw, SWSM);
8790 + E1000_WRITE_REG(&adapter->hw, SWSM,
8791 + swsm & ~E1000_SWSM_DRV_LOAD);
8797 - pci_disable_device(pdev);
8798 - if(adapter->hw.mac_type == iegbe_icp_xxxx) {
8800 - * ICP xxxx devices are not true PCI devices, in the context
8801 - * of power management, disabling the bus mastership is not
8802 - * sufficient to disable the device, it is also necessary to
8803 - * disable IO, Memory, and Interrupts if they are enabled.
8805 - pci_read_config_word(pdev, PCI_COMMAND, &cmd_word);
8806 + pci_disable_device(pdev);
8807 + if(adapter->hw.mac_type == iegbe_icp_xxxx) {
8809 + * ICP xxxx devices are not true PCI devices, in the context
8810 + * of power management, disabling the bus mastership is not
8811 + * sufficient to disable the device, it is also necessary to
8812 + * disable IO, Memory, and Interrupts if they are enabled.
8814 + pci_read_config_word(pdev, PCI_COMMAND, &cmd_word);
8815 if(cmd_word & PCI_COMMAND_IO) {
8816 - cmd_word &= ~PCI_COMMAND_IO;
8817 + cmd_word &= ~PCI_COMMAND_IO;
8819 if(cmd_word & PCI_COMMAND_MEMORY) {
8820 - cmd_word &= ~PCI_COMMAND_MEMORY;
8821 + cmd_word &= ~PCI_COMMAND_MEMORY;
8823 if(cmd_word & PCI_COMMAND_INTX_DISABLE) {
8824 - cmd_word &= ~PCI_COMMAND_INTX_DISABLE;
8825 + cmd_word &= ~PCI_COMMAND_INTX_DISABLE;
8827 - pci_write_config_word(pdev, PCI_COMMAND, cmd_word);
8829 + pci_write_config_word(pdev, PCI_COMMAND, cmd_word);
8832 - state.event = (state.event > 0) ? 0x3 : 0;
8833 - pci_set_power_state(pdev, state.event);
8834 - if(gcu_suspend == 0)
8835 + state.event = (state.event > 0x0) ? 0x3 : 0x0;
8836 + pci_set_power_state(pdev, state.event);
8837 + if(gcu_suspend == 0x0)
8840 - gcu = pci_find_device(PCI_VENDOR_ID_INTEL, GCU_DEVID, NULL);
8842 + gcu = pci_get_device(PCI_VENDOR_ID_INTEL, GCU_DEVID, NULL);
8844 gcu_iegbe_suspend(gcu, 0x3);
8847 + gcu_suspend = 0x1;
8856 iegbe_resume(struct pci_dev *pdev)
8858 - struct net_device *netdev = pci_get_drvdata(pdev);
8859 - struct iegbe_adapter *adapter = netdev_priv(netdev);
8860 - uint32_t manc, ret_val, swsm;
8861 - uint32_t ctrl_ext;
8862 + struct net_device *netdev = pci_get_drvdata(pdev);
8863 + struct iegbe_adapter *adapter = netdev_priv(netdev);
8864 + uint32_t manc, ret_val, swsm;
8865 + uint32_t ctrl_ext;
8869 - if(gcu_resume == 0)
8870 + if(gcu_resume == 0x0)
8873 - gcu = pci_find_device(PCI_VENDOR_ID_INTEL, GCU_DEVID, NULL);
8874 + gcu = pci_get_device(PCI_VENDOR_ID_INTEL, GCU_DEVID, NULL);
8875 pci_read_config_dword(gcu, 0x00, &vdid);
8881 gcu_iegbe_resume(gcu);
8885 + gcu_suspend = 0x0;
8887 printk("Unable to resume GCU!\n");
8891 pci_set_power_state(pdev, 0x0);
8892 - pci_restore_state(pdev);
8893 - ret_val = pci_enable_device(pdev);
8894 - pci_set_master(pdev);
8895 + pci_restore_state(pdev);
8896 + ret_val = pci_enable_device(pdev);
8897 + pci_set_master(pdev);
8899 pci_enable_wake(pdev, 0x3, 0x0);
8900 pci_enable_wake(pdev, 0x4, 0x0); /* 4 == D3 cold */
8902 - iegbe_reset(adapter);
8903 - E1000_WRITE_REG(&adapter->hw, WUS, ~0);
8904 + iegbe_reset(adapter);
8905 + E1000_WRITE_REG(&adapter->hw, WUS, ~0);
8906 offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_ST)
8907 + PCI_ST_SMIA_OFFSET;
8908 pci_write_config_dword(adapter->pdev, offset, 0x00000006);
8909 @@ -5138,51 +4848,52 @@ iegbe_resume(struct pci_dev *pdev)
8910 E1000_WRITE_REG(&adapter->hw, IMC2, ~0UL);
8912 if(netif_running(netdev)) {
8913 - iegbe_up(adapter);
8914 + iegbe_up(adapter);
8916 - netif_device_attach(netdev);
8918 - if(adapter->hw.mac_type >= iegbe_82540
8919 - && adapter->hw.mac_type != iegbe_icp_xxxx
8920 - && adapter->hw.media_type == iegbe_media_type_copper) {
8921 - manc = E1000_READ_REG(&adapter->hw, MANC);
8922 - manc &= ~(E1000_MANC_ARP_EN);
8923 - E1000_WRITE_REG(&adapter->hw, MANC, manc);
8925 + netif_device_attach(netdev);
8927 - switch(adapter->hw.mac_type) {
8930 - ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
8931 - E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
8932 - ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
8935 - swsm = E1000_READ_REG(&adapter->hw, SWSM);
8936 - E1000_WRITE_REG(&adapter->hw, SWSM,
8937 - swsm | E1000_SWSM_DRV_LOAD);
8942 + if(adapter->hw.mac_type >= iegbe_82540
8943 + && adapter->hw.mac_type != iegbe_icp_xxxx
8944 + && adapter->hw.media_type == iegbe_media_type_copper) {
8945 + manc = E1000_READ_REG(&adapter->hw, MANC);
8946 + manc &= ~(E1000_MANC_ARP_EN);
8947 + E1000_WRITE_REG(&adapter->hw, MANC, manc);
8950 + switch(adapter->hw.mac_type) {
8953 + ctrl_ext = E1000_READ_REG(&adapter->hw, CTRL_EXT);
8954 + E1000_WRITE_REG(&adapter->hw, CTRL_EXT,
8955 + ctrl_ext | E1000_CTRL_EXT_DRV_LOAD);
8958 + swsm = E1000_READ_REG(&adapter->hw, SWSM);
8959 + E1000_WRITE_REG(&adapter->hw, SWSM,
8960 + swsm | E1000_SWSM_DRV_LOAD);
8972 #ifdef CONFIG_NET_POLL_CONTROLLER
8974 * Polling 'interrupt' - used by things like netconsole to send skbs
8975 * without having to re-enable interrupts. It's not called while
8976 * the interrupt routine is executing.
8979 -iegbe_netpoll(struct net_device *netdev)
8980 +static void iegbe_netpoll(struct net_device *netdev)
8982 - struct iegbe_adapter *adapter = netdev_priv(netdev);
8983 - disable_irq(adapter->pdev->irq);
8984 - iegbe_intr(adapter->pdev->irq, netdev, NULL);
8985 - enable_irq(adapter->pdev->irq);
8986 + struct iegbe_adapter *adapter = netdev_priv(netdev);
8987 + disable_irq(adapter->pdev->irq);
8988 + iegbe_intr(adapter->pdev->irq, netdev);
8989 + enable_irq(adapter->pdev->irq);
8995 --- a/Embedded/src/GbE/iegbe_oem_phy.c
8996 +++ b/Embedded/src/GbE/iegbe_oem_phy.c
9001 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
9002 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
9004 - This program is free software; you can redistribute it and/or modify
9005 + This program is free software; you can redistribute it and/or modify
9006 it under the terms of version 2 of the GNU General Public License as
9007 published by the Free Software Foundation.
9009 - This program is distributed in the hope that it will be useful, but
9010 - WITHOUT ANY WARRANTY; without even the implied warranty of
9011 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9012 + This program is distributed in the hope that it will be useful, but
9013 + WITHOUT ANY WARRANTY; without even the implied warranty of
9014 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9015 General Public License for more details.
9017 - You should have received a copy of the GNU General Public License
9018 - along with this program; if not, write to the Free Software
9019 + You should have received a copy of the GNU General Public License
9020 + along with this program; if not, write to the Free Software
9021 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
9022 - The full GNU General Public License is included in this distribution
9023 + The full GNU General Public License is included in this distribution
9024 in the file called LICENSE.GPL.
9026 Contact Information:
9029 - version: Embedded.L.1.0.34
9030 + version: Embedded.Release.Patch.L.1.0.7-5
9032 Contact Information:
9034 - Intel Corporation, 5000 W Chandler Blvd, Chandler, AZ 85226
9035 + Intel Corporation, 5000 W Chandler Blvd, Chandler, AZ 85226
9037 *****************************************************************************/
9038 /**************************************************************************
9039 @@ -65,11 +65,6 @@ static int32_t iegbe_oem_link_m88_setup(
9040 static int32_t iegbe_oem_set_phy_mode(struct iegbe_hw *hw);
9041 static int32_t iegbe_oem_detect_phy(struct iegbe_hw *hw);
9043 -/* Define specific BCM functions */
9044 -static int32_t iegbe_oem_link_bcm5481_setup(struct iegbe_hw *hw);
9045 -static int32_t bcm5481_read_18sv (struct iegbe_hw *hw, int sv, uint16_t *data);
9046 -static int32_t oi_phy_setup (struct iegbe_hw *hw);
9049 * iegbe_oem_setup_link
9050 * @hw: iegbe_hw struct containing device specific information
9051 @@ -84,7 +79,7 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
9053 #ifdef EXTERNAL_MDIO
9057 * see iegbe_setup_copper_link() as the primary example. Look at both
9058 * the M88 and IGP functions that are called for ideas, possibly for
9060 @@ -102,14 +97,14 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
9062 /* AFU: add test to exit out if improper phy type
9064 - /* relevent parts of iegbe_copper_link_preconfig */
9065 - ctrl = E1000_READ_REG(hw, CTRL);
9066 - ctrl |= E1000_CTRL_SLU;
9067 - ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
9068 - E1000_WRITE_REG(hw, CTRL, ctrl);
9070 + /* relevent parts of iegbe_copper_link_preconfig */
9071 + ctrl = E1000_READ_REG(hw, CTRL);
9072 + ctrl |= E1000_CTRL_SLU;
9073 + ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
9074 + E1000_WRITE_REG(hw, CTRL, ctrl);
9076 /* this is required for *hw init */
9077 - ret_val = iegbe_oem_detect_phy(hw);
9078 + ret_val = iegbe_oem_detect_phy(hw);
9082 @@ -119,23 +114,13 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
9085 switch (hw->phy_id) {
9086 - case BCM5395S_PHY_ID:
9087 - return E1000_SUCCESS;
9090 case M88E1000_I_PHY_ID:
9091 case M88E1141_E_PHY_ID:
9092 ret_val = iegbe_oem_link_m88_setup(hw);
9097 - case BCM5481_PHY_ID:
9098 - ret_val = iegbe_oem_link_bcm5481_setup(hw);
9107 DEBUGOUT("Invalid PHY ID\n");
9108 return -E1000_ERR_PHY_TYPE;
9109 @@ -143,16 +128,16 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
9112 ret_val = iegbe_copper_link_autoneg(hw);
9121 DEBUGOUT("Forcing speed and duplex\n");
9122 ret_val = iegbe_phy_force_speed_duplex(hw);
9128 * Check link status. Wait up to 100 microseconds for link to become
9131 @@ -194,51 +179,6 @@ iegbe_oem_setup_link(struct iegbe_hw *hw
9132 #endif /* ifdef EXTERNAL_MDIO */
9136 - * iegbe_oem_link_bcm5481_setup
9137 - * @hw: iegbe_hw struct containing device specific information
9139 - * Returns E1000_SUCCESS, negative E1000 error code on failure
9141 - * copied verbatim from iegbe_oem_link_m88_setup
9144 -iegbe_oem_link_bcm5481_setup(struct iegbe_hw *hw)
9147 - uint16_t phy_data;
9149 - //DEBUGFUNC(__func__);
9154 - /* phy_reset_disable is set in iegbe_oem_set_phy_mode */
9155 - if(hw->phy_reset_disable)
9156 - return E1000_SUCCESS;
9158 - // Enable MDIX in extended control reg.
9159 - ret_val = iegbe_oem_read_phy_reg_ex(hw, BCM5481_ECTRL, &phy_data);
9162 - DEBUGOUT("Unable to read BCM5481_ECTRL register\n");
9166 - phy_data &= ~BCM5481_ECTRL_DISMDIX;
9167 - ret_val = iegbe_oem_write_phy_reg_ex(hw, BCM5481_ECTRL, phy_data);
9170 - DEBUGOUT("Unable to write BCM5481_ECTRL register\n");
9174 - ret_val = oi_phy_setup (hw);
9178 - return E1000_SUCCESS;
9182 * iegbe_oem_link_m88_setup
9183 @@ -253,7 +193,7 @@ static int32_t
9184 iegbe_oem_link_m88_setup(struct iegbe_hw *hw)
9187 - uint16_t phy_data;
9188 + uint16_t phy_data = 0;
9190 DEBUGFUNC1("%s",__func__);
9192 @@ -261,7 +201,7 @@ iegbe_oem_link_m88_setup(struct iegbe_hw
9196 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
9197 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
9199 phy_data |= 0x00000008;
9200 ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
9201 @@ -279,7 +219,7 @@ iegbe_oem_link_m88_setup(struct iegbe_hw
9203 phy_data &= ~M88E1000_PSCR_ASSERT_CRS_ON_TX;
9208 * MDI/MDI-X = 0 (default)
9209 * 0 - Auto for all speeds
9210 @@ -305,7 +245,7 @@ iegbe_oem_link_m88_setup(struct iegbe_hw
9217 * disable_polarity_correction = 0 (default)
9218 * Automatic Correction for Reversed Cable Polarity
9219 @@ -316,25 +256,25 @@ iegbe_oem_link_m88_setup(struct iegbe_hw
9221 if(hw->disable_polarity_correction == 1) {
9222 phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
9225 ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
9227 DEBUGOUT("Unable to write M88E1000_PHY_SPEC_CTRL register\n");
9233 * Force TX_CLK in the Extended PHY Specific Control Register
9236 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_EXT_PHY_SPEC_CTRL,
9237 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_EXT_PHY_SPEC_CTRL,
9240 DEBUGOUT("Unable to read M88E1000_EXT_PHY_SPEC_CTRL register\n");
9246 * For Truxton, it is necessary to add RGMII tx and rx
9247 * timing delay though the EXT_PHY_SPEC_CTRL register
9249 @@ -350,13 +290,13 @@ iegbe_oem_link_m88_setup(struct iegbe_hw
9250 phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
9251 M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X);
9253 - ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_EXT_PHY_SPEC_CTRL,
9254 + ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_EXT_PHY_SPEC_CTRL,
9257 DEBUGOUT("Unable to read M88E1000_EXT_PHY_SPEC_CTRL register\n");
9263 /* SW Reset the PHY so all changes take effect */
9264 ret_val = iegbe_phy_hw_reset(hw);
9265 @@ -371,7 +311,7 @@ iegbe_oem_link_m88_setup(struct iegbe_hw
9267 * iegbe_oem_force_mdi
9268 * @hw: iegbe_hw struct containing device specific information
9269 - * @resetPhy: returns true if after calling this function the
9270 + * @resetPhy: returns true if after calling this function the
9271 * PHY requires a reset
9273 * Returns E1000_SUCCESS, negative E1000 error code on failure
9274 @@ -379,7 +319,7 @@ iegbe_oem_link_m88_setup(struct iegbe_hw
9275 * This is called from iegbe_phy_force_speed_duplex, which is
9276 * called from iegbe_oem_setup_link.
9280 iegbe_oem_force_mdi(struct iegbe_hw *hw, int *resetPhy)
9282 #ifdef EXTERNAL_MDIO
9283 @@ -393,35 +333,30 @@ iegbe_oem_force_mdi(struct iegbe_hw *hw,
9289 * a boolean to indicate if the phy needs to be reset
9292 * Make note that the M88 phy is what'll be used on Truxton
9293 * see iegbe_phy_force_speed_duplex, which does the following for M88
9295 switch (hw->phy_id) {
9296 - case BCM5395S_PHY_ID:
9297 - case BCM5481_PHY_ID:
9298 - DEBUGOUT("WARNING: An empty iegbe_oem_force_mdi() has been called!\n");
9301 case M88E1000_I_PHY_ID:
9302 case M88E1141_E_PHY_ID:
9303 - ret_val = iegbe_oem_read_phy_reg_ex(hw,
9304 - M88E1000_PHY_SPEC_CTRL,
9305 + ret_val = iegbe_oem_read_phy_reg_ex(hw,
9306 + M88E1000_PHY_SPEC_CTRL,
9309 DEBUGOUT("Unable to read M88E1000_PHY_SPEC_CTRL register\n");
9315 - * Clear Auto-Crossover to force MDI manually. M88E1000 requires
9316 + * Clear Auto-Crossover to force MDI manually. M88E1000 requires
9317 * MDI forced whenever speed are duplex are forced.
9321 phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
9322 - ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
9323 + ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
9326 DEBUGOUT("Unable to write M88E1000_PHY_SPEC_CTRL register\n");
9327 @@ -458,7 +393,7 @@ iegbe_oem_force_mdi(struct iegbe_hw *hw,
9328 * This is called from iegbe_phy_force_speed_duplex, which is
9329 * called from iegbe_oem_setup_link.
9333 iegbe_oem_phy_reset_dsp(struct iegbe_hw *hw)
9335 #ifdef EXTERNAL_MDIO
9336 @@ -478,10 +413,8 @@ iegbe_oem_phy_reset_dsp(struct iegbe_hw
9339 switch (hw->phy_id) {
9340 - case M88E1000_I_PHY_ID:
9341 - case M88E1141_E_PHY_ID:
9342 - case BCM5481_PHY_ID:
9343 - case BCM5395S_PHY_ID:
9344 + case M88E1000_I_PHY_ID:
9345 + case M88E1141_E_PHY_ID:
9346 DEBUGOUT("No DSP to reset on OEM PHY\n");
9349 @@ -508,7 +441,7 @@ iegbe_oem_phy_reset_dsp(struct iegbe_hw
9350 * This is called from iegbe_phy_force_speed_duplex, which is
9351 * called from iegbe_oem_setup_link.
9355 iegbe_oem_cleanup_after_phy_reset(struct iegbe_hw *hw)
9357 #ifdef EXTERNAL_MDIO
9358 @@ -520,29 +453,24 @@ iegbe_oem_cleanup_after_phy_reset(struct
9367 * Make note that the M88 phy is what'll be used on Truxton.
9368 * see iegbe_phy_force_speed_duplex, which does the following for M88
9370 switch (hw->phy_id) {
9371 - case BCM5395S_PHY_ID:
9372 - case BCM5481_PHY_ID:
9373 - DEBUGOUT("WARNING: An empty iegbe_oem_cleanup_after_phy_reset() has been called!\n");
9376 case M88E1000_I_PHY_ID:
9377 case M88E1141_E_PHY_ID:
9379 - * Because we reset the PHY above, we need to re-force
9380 + * Because we reset the PHY above, we need to re-force
9381 * TX_CLK in the Extended PHY Specific Control Register to
9382 * 25MHz clock. This value defaults back to a 2.5MHz clock
9383 * when the PHY is reset.
9386 ret_val = iegbe_oem_read_phy_reg_ex(hw,
9387 - M88E1000_EXT_PHY_SPEC_CTRL,
9388 + M88E1000_EXT_PHY_SPEC_CTRL,
9391 DEBUGOUT("Unable to read M88E1000_EXT_SPEC_CTRL register\n");
9392 @@ -550,22 +478,23 @@ iegbe_oem_cleanup_after_phy_reset(struct
9395 phy_data |= M88E1000_EPSCR_TX_CLK_25;
9396 - ret_val = iegbe_oem_write_phy_reg_ex(hw,
9397 - M88E1000_EXT_PHY_SPEC_CTRL,
9398 + ret_val = iegbe_oem_write_phy_reg_ex(hw,
9399 + M88E1000_EXT_PHY_SPEC_CTRL,
9402 - DEBUGOUT("Unable to write M88E1000_EXT_PHY_SPEC_CTRL register\n");
9403 + DEBUGOUT("Unable to write M88E1000_EXT_PHY_SPEC_CTRL "
9409 * In addition, because of the s/w reset above, we need to enable
9410 - * CRX on TX. This must be set for both full and half duplex
9411 + * CRX on TX. This must be set for both full and half duplex
9415 - ret_val = iegbe_oem_read_phy_reg_ex(hw,
9416 - M88E1000_PHY_SPEC_CTRL,
9417 + ret_val = iegbe_oem_read_phy_reg_ex(hw,
9418 + M88E1000_PHY_SPEC_CTRL,
9421 DEBUGOUT("Unable to read M88E1000_PHY_SPEC_CTRL register\n");
9422 @@ -573,12 +502,12 @@ iegbe_oem_cleanup_after_phy_reset(struct
9425 phy_data &= ~M88E1000_PSCR_ASSERT_CRS_ON_TX;
9426 - ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
9427 + ret_val = iegbe_oem_write_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
9430 DEBUGOUT("Unable to write M88E1000_PHY_SPEC_CTRL register\n");
9436 DEBUGOUT("Invalid PHY ID\n");
9437 @@ -604,12 +533,12 @@ iegbe_oem_cleanup_after_phy_reset(struct
9438 * This is called from iegbe_oem_setup_link which is
9439 * called from iegbe_setup_link.
9443 iegbe_oem_set_phy_mode(struct iegbe_hw *hw)
9446 * it is unclear if it is necessary to set the phy mode. Right now only
9447 - * one MAC 82545 Rev 3 does it, but the other MACs like Tolapai do not.
9448 + * one MAC 82545 Rev 3 does it, but the other MACs like tola do not.
9449 * Leave the functionality off for now until it is determined that Tolapai
9452 @@ -638,41 +567,37 @@ iegbe_oem_set_phy_mode(struct iegbe_hw *
9453 #ifndef skip_set_mode
9454 DEBUGOUT("No need to call oem_set_phy_mode on Truxton\n");
9458 * Make note that the M88 phy is what'll be used on Truxton.
9460 * use iegbe_set_phy_mode as example
9462 switch (hw->phy_id) {
9463 - case BCM5395S_PHY_ID:
9464 - case BCM5481_PHY_ID:
9465 - DEBUGOUT("WARNING: An empty iegbe_oem_set_phy_mode() has been called!\n");
9468 case M88E1000_I_PHY_ID:
9469 case M88E1141_E_PHY_ID:
9470 - ret_val = iegbe_read_eeprom(hw,
9471 - EEPROM_PHY_CLASS_WORD,
9473 + ret_val = iegbe_read_eeprom(hw,
9474 + EEPROM_PHY_CLASS_WORD,
9481 - if((eeprom_data != EEPROM_RESERVED_WORD) &&
9482 - (eeprom_data & EEPROM_PHY_CLASS_A))
9483 + if((eeprom_data != EEPROM_RESERVED_WORD) &&
9484 + (eeprom_data & EEPROM_PHY_CLASS_A))
9486 - ret_val = iegbe_oem_write_phy_reg_ex(hw,
9487 - M88E1000_PHY_PAGE_SELECT,
9489 + ret_val = iegbe_oem_write_phy_reg_ex(hw,
9490 + M88E1000_PHY_PAGE_SELECT,
9493 - DEBUGOUT("Unable to write to M88E1000_PHY_PAGE_SELECT register on PHY\n");
9494 + DEBUGOUT("Unable to write to M88E1000_PHY_PAGE_SELECT "
9495 + "register on PHY\n");
9499 - ret_val = iegbe_oem_write_phy_reg_ex(hw,
9500 - M88E1000_PHY_GEN_CONTROL,
9502 + ret_val = iegbe_oem_write_phy_reg_ex(hw,
9503 + M88E1000_PHY_GEN_CONTROL,
9506 DEBUGOUT("Unable to write to M88E1000_PHY_GEN_CONTROL"
9507 "register on PHY\n");
9508 @@ -687,11 +612,12 @@ iegbe_oem_set_phy_mode(struct iegbe_hw *
9509 return -E1000_ERR_PHY_TYPE;
9514 return E1000_SUCCESS;
9520 * iegbe_oem_detect_phy
9521 * @hw: iegbe_hw struct containing device specific information
9522 @@ -702,7 +628,7 @@ iegbe_oem_set_phy_mode(struct iegbe_hw *
9524 * This borrows heavily from iegbe_detect_gig_phy
9528 iegbe_oem_detect_phy(struct iegbe_hw *hw)
9531 @@ -715,33 +641,20 @@ iegbe_oem_detect_phy(struct iegbe_hw *hw
9533 hw->phy_type = iegbe_phy_oem;
9536 - // If MAC2 (BCM5395 switch), manually detect the phy
9537 - struct iegbe_adapter *adapter;
9538 - uint32_t device_number;
9539 - adapter = (struct iegbe_adapter *) hw->back;
9540 - device_number = PCI_SLOT(adapter->pdev->devfn);
9541 - if (device_number == ICP_XXXX_MAC_2) {
9542 - hw->phy_id = BCM5395S_PHY_ID;
9543 - hw->phy_revision = 0;
9544 - return E1000_SUCCESS;
9549 ret_val = iegbe_oem_read_phy_reg_ex(hw, PHY_ID1, &phy_id_high);
9551 DEBUGOUT("Unable to read PHY register PHY_ID1\n");
9557 ret_val = iegbe_oem_read_phy_reg_ex(hw, PHY_ID2, &phy_id_low);
9559 DEBUGOUT("Unable to read PHY register PHY_ID2\n");
9562 - hw->phy_id = (uint32_t) ((phy_id_high << 0x10) + phy_id_low);
9563 + hw->phy_id = (uint32_t) ((phy_id_high << 0x10) +
9564 + (phy_id_low & PHY_REVISION_MASK));
9565 hw->phy_revision = (uint32_t) phy_id_low & ~PHY_REVISION_MASK;
9567 return E1000_SUCCESS;
9568 @@ -753,15 +666,15 @@ iegbe_oem_detect_phy(struct iegbe_hw *hw
9569 * @hw: iegbe_hw struct containing device specific information
9571 * Returns the value of the Inter Packet Gap (IPG) Transmit Time (IPGT) in the
9572 - * Transmit IPG register appropriate for the given PHY. This field is only 10
9573 + * Transmit IPG register appropriate for the given PHY. This field is only 10
9576 * In the original iegbe code, only the IPGT field varied between media types.
9577 - * If the OEM phy requires setting IPG Receive Time 1 & 2 Registers, it would
9578 + * If the OEM phy requires setting IPG Receive Time 1 & 2 Registers, it would
9579 * be required to modify the iegbe_config_tx() function to accomdate the change
9584 iegbe_oem_get_tipg(struct iegbe_hw *hw)
9586 #ifdef EXTERNAL_MDIO
9587 @@ -777,15 +690,13 @@ iegbe_oem_get_tipg(struct iegbe_hw *hw)
9588 switch (hw->phy_id) {
9589 case M88E1000_I_PHY_ID:
9590 case M88E1141_E_PHY_ID:
9591 - case BCM5481_PHY_ID:
9592 - case BCM5395S_PHY_ID:
9593 phy_num = DEFAULT_ICP_XXXX_TIPG_IPGT;
9596 DEBUGOUT("Invalid PHY ID\n");
9597 return DEFAULT_ICP_XXXX_TIPG_IPGT;
9603 #else /* ifdef EXTERNAL_MDIO */
9604 @@ -803,15 +714,15 @@ iegbe_oem_get_tipg(struct iegbe_hw *hw)
9605 * iegbe_oem_phy_is_copper
9606 * @hw: iegbe_hw struct containing device specific information
9608 - * Test for media type within the iegbe driver is common, so this is a simple
9609 - * test for copper PHYs. The ICP_XXXX family of controllers initially only
9610 - * supported copper interconnects (no TBI (ten bit interface) for Fiber
9611 - * existed). If future revs support either Fiber or an internal SERDES, it
9612 - * may become necessary to evaluate where this function is used to go beyond
9613 + * Test for media type within the iegbe driver is common, so this is a simple
9614 + * test for copper PHYs. The ICP_XXXX family of controllers initially only
9615 + * supported copper interconnects (no TBI (ten bit interface) for Fiber
9616 + * existed). If future revs support either Fiber or an internal SERDES, it
9617 + * may become necessary to evaluate where this function is used to go beyond
9618 * determining whether or not media type is just copper.
9623 iegbe_oem_phy_is_copper(struct iegbe_hw *hw)
9625 #ifdef EXTERNAL_MDIO
9626 @@ -827,23 +738,21 @@ iegbe_oem_phy_is_copper(struct iegbe_hw
9627 switch (hw->phy_id) {
9628 case M88E1000_I_PHY_ID:
9629 case M88E1141_E_PHY_ID:
9630 - case BCM5481_PHY_ID:
9631 - case BCM5395S_PHY_ID:
9635 DEBUGOUT("Invalid PHY ID\n");
9636 return -E1000_ERR_PHY_TYPE;
9642 #else /* ifdef EXTERNAL_MDIO */
9646 * caught between returning true or false. True allows it to
9647 * be entered into && statements w/o ill effect, but false
9648 - * would make more sense
9649 + * would make more sense
9651 DEBUGOUT("Invalid value for transceiver type, return FALSE\n");
9653 @@ -856,19 +765,19 @@ iegbe_oem_phy_is_copper(struct iegbe_hw
9654 * iegbe_oem_get_phy_dev_number
9655 * @hw: iegbe_hw struct containing device specific information
9657 - * For ICP_XXXX family of devices, there are 3 MACs, each of which may
9658 - * have a different PHY (and indeed a different media interface). This
9659 - * function is used to indicate which of the MAC/PHY pairs we are interested
9660 + * For ICP_XXXX family of devices, there are 3 MACs, each of which may
9661 + * have a different PHY (and indeed a different media interface). This
9662 + * function is used to indicate which of the MAC/PHY pairs we are interested
9669 iegbe_oem_get_phy_dev_number(struct iegbe_hw *hw)
9671 #ifdef EXTERNAL_MDIO
9674 - * for ICP_XXXX family of devices, the three network interfaces are
9676 + * for ICP_XXXX family of devices, the three network interfaces are
9677 * differentiated by their PCI device number, where the three share
9680 @@ -886,15 +795,15 @@ iegbe_oem_get_phy_dev_number(struct iegb
9682 switch(device_number)
9684 - case ICP_XXXX_MAC_0:
9685 + case ICP_XXXX_MAC_0:
9686 + hw->phy_addr = 0x00;
9688 + case ICP_XXXX_MAC_1:
9689 hw->phy_addr = 0x01;
9691 - case ICP_XXXX_MAC_1:
9692 + case ICP_XXXX_MAC_2:
9693 hw->phy_addr = 0x02;
9695 - case ICP_XXXX_MAC_2:
9696 - hw->phy_addr = 0x00;
9698 default: hw->phy_addr = 0x00;
9700 return hw->phy_addr;
9701 @@ -915,7 +824,7 @@ iegbe_oem_get_phy_dev_number(struct iegb
9702 * @cmd: the original IOCTL command that instigated the call chain.
9704 * This function abstracts out the code necessary to service the
9705 - * SIOCSMIIREG case within the iegbe_mii_ioctl() for oem PHYs.
9706 + * SIOCSMIIREG case within the iegbe_mii_ioctl() for oem PHYs.
9707 * iegbe_mii_ioctl() was implemented for copper phy's only and this
9708 * function will only be called if iegbe_oem_phy_is_copper() returns true for
9709 * a given MAC. Note that iegbe_mii_ioctl() has a compile flag
9710 @@ -924,14 +833,14 @@ iegbe_oem_get_phy_dev_number(struct iegb
9711 * NOTE: a spinlock is in effect for the duration of this call. It is
9712 * imperative that a negative value be returned on any error, so
9713 * the spinlock can be released properly.
9718 iegbe_oem_mii_ioctl(struct iegbe_adapter *adapter, unsigned long flags,
9719 struct ifreq *ifr, int cmd)
9721 #ifdef EXTERNAL_MDIO
9724 struct mii_ioctl_data *data = if_mii(ifr);
9725 uint16_t mii_reg = data->val_in;
9727 @@ -942,12 +851,6 @@ iegbe_oem_mii_ioctl(struct iegbe_adapter
9728 if(!adapter || !ifr) {
9732 - // If MAC2 (BCM5395 switch) then leave now
9733 - if ((PCI_SLOT(adapter->pdev->devfn)) == ICP_XXXX_MAC_2) {
9737 switch (data->reg_num) {
9739 if(mii_reg & MII_CR_POWER_DOWN) {
9740 @@ -956,7 +859,7 @@ iegbe_oem_mii_ioctl(struct iegbe_adapter
9741 if(mii_reg & MII_CR_AUTO_NEG_EN) {
9742 adapter->hw.autoneg = 1;
9743 adapter->hw.autoneg_advertised = ICP_XXXX_AUTONEG_ADV_DEFAULT;
9747 if(mii_reg & 0x40) {
9748 spddplx = SPEED_1000;
9749 @@ -976,7 +879,7 @@ iegbe_oem_mii_ioctl(struct iegbe_adapter
9750 if(netif_running(adapter->netdev)) {
9751 iegbe_down(adapter);
9756 iegbe_reset(adapter);
9758 @@ -1043,10 +946,10 @@ void iegbe_oem_fiber_live_in_suspend(str
9759 * Note: The call to iegbe_get_regs() assumed an array of 24 elements
9760 * where the last 11 are passed to this function. If the array
9761 * that is passed to the calling function has its size or element
9762 - * defintions changed, this function becomes broken.
9763 + * defintions changed, this function becomes broken.
9766 -void iegbe_oem_get_phy_regs(struct iegbe_adapter *adapter, uint32_t *data,
9767 +void iegbe_oem_get_phy_regs(struct iegbe_adapter *adapter, uint32_t *data,
9770 #define EXPECTED_ARRAY_LEN 11
9771 @@ -1062,13 +965,13 @@ void iegbe_oem_get_phy_regs(struct iegbe
9772 * Use the corrected_length variable to make sure we don't exceed that
9775 - corrected_len = data_len>EXPECTED_ARRAY_LEN
9776 + corrected_len = data_len>EXPECTED_ARRAY_LEN
9777 ? EXPECTED_ARRAY_LEN : data_len;
9778 memset(data, 0, corrected_len*sizeof(uint32_t));
9780 #ifdef EXTERNAL_MDIO
9784 * Fill data[] with...
9786 * [0] = cable length
9787 @@ -1084,16 +987,11 @@ void iegbe_oem_get_phy_regs(struct iegbe
9790 switch (adapter->hw.phy_id) {
9791 - case BCM5395S_PHY_ID:
9792 - case BCM5481_PHY_ID:
9793 - DEBUGOUT("WARNING: An empty iegbe_oem_get_phy_regs() has been called!\n");
9796 case M88E1000_I_PHY_ID:
9797 case M88E1141_E_PHY_ID:
9798 if(corrected_len > 0) {
9799 - iegbe_oem_read_phy_reg_ex(&adapter->hw,
9800 - M88E1000_PHY_SPEC_STATUS,
9801 + iegbe_oem_read_phy_reg_ex(&adapter->hw,
9802 + M88E1000_PHY_SPEC_STATUS,
9803 (uint16_t *) &data[0]);
9805 if(corrected_len > 0x1){
9806 @@ -1106,7 +1004,7 @@ void iegbe_oem_get_phy_regs(struct iegbe
9807 data[0x3] = 0x0; /* Dummy (to align w/ IGP phy reg dump) */
9809 if(corrected_len > 0x4) {
9810 - iegbe_oem_read_phy_reg_ex(&adapter->hw, M88E1000_PHY_SPEC_CTRL,
9811 + iegbe_oem_read_phy_reg_ex(&adapter->hw, M88E1000_PHY_SPEC_CTRL,
9812 (uint16_t *) &data[0x4]);
9814 if(corrected_len > 0x5) {
9815 @@ -1144,7 +1042,7 @@ void iegbe_oem_get_phy_regs(struct iegbe
9816 * This is called from iegbe_set_phy_loopback in response from call from
9817 * ethtool to place the PHY into loopback mode.
9821 iegbe_oem_phy_loopback(struct iegbe_adapter *adapter)
9823 #ifdef EXTERNAL_MDIO
9824 @@ -1165,23 +1063,18 @@ iegbe_oem_phy_loopback(struct iegbe_adap
9825 * was that nonintegrated called iegbe_phy_reset_clk_and_crs(),
9826 * hopefully this won't matter as CRS required for half-duplex
9827 * operation and this is set to full duplex.
9830 * Make note that the M88 phy is what'll be used on Truxton
9831 * Loopback configuration is the same for each of the supported PHYs.
9833 switch (adapter->hw.phy_id) {
9834 - case BCM5395S_PHY_ID:
9835 - DEBUGOUT("WARNING: An empty iegbe_oem_phy_loopback() has been called!\n");
9838 case M88E1000_I_PHY_ID:
9839 case M88E1141_E_PHY_ID:
9840 - case BCM5481_PHY_ID:
9842 adapter->hw.autoneg = FALSE;
9844 /* turn off Auto-MDI/MDIX */
9845 - /*ret_val = iegbe_oem_write_phy_reg_ex(&adapter->hw,
9846 + /*ret_val = iegbe_oem_write_phy_reg_ex(&adapter->hw,
9847 M88E1000_PHY_SPEC_CTRL, 0x0808);
9850 @@ -1206,10 +1099,10 @@ iegbe_oem_phy_loopback(struct iegbe_adap
9851 DEBUGOUT("Unable to write to register PHY_CTRL\n");
9858 /* force 1000, set loopback */
9861 iegbe_oem_write_phy_reg_ex(&adapter->hw, PHY_CTRL, 0x4140); */
9862 ret_val = iegbe_oem_write_phy_reg_ex(&adapter->hw, PHY_CTRL, 0x6100);
9864 @@ -1228,21 +1121,21 @@ iegbe_oem_phy_loopback(struct iegbe_adap
9865 E1000_WRITE_REG(&adapter->hw, CTRL, ctrl_reg);
9868 - * Write out to PHY registers 29 and 30 to disable the Receiver.
9869 + * Write out to PHY registers 29 and 30 to disable the Receiver.
9870 * This directly lifted from iegbe_phy_disable_receiver().
9873 * The code is currently commented out as for the M88 used in
9874 * Truxton, registers 29 and 30 are unutilized. Leave in, just
9875 - * in case we are on the receiving end of an 'undocumented'
9876 + * in case we are on the receiving end of an 'undocumented'
9881 * iegbe_oem_write_phy_reg_ex(&adapter->hw, 29, 0x001F);
9882 * iegbe_oem_write_phy_reg_ex(&adapter->hw, 30, 0x8FFC);
9883 * iegbe_oem_write_phy_reg_ex(&adapter->hw, 29, 0x001A);
9884 * iegbe_oem_write_phy_reg_ex(&adapter->hw, 30, 0x8FF0);
9890 DEBUGOUT("Invalid PHY ID\n");
9891 @@ -1268,15 +1161,15 @@ iegbe_oem_phy_loopback(struct iegbe_adap
9892 * ethtool to place the PHY out of loopback mode. This handles the OEM
9893 * specific part of loopback cleanup.
9897 iegbe_oem_loopback_cleanup(struct iegbe_adapter *adapter)
9899 #ifdef EXTERNAL_MDIO
9902 - * This borrows liberally from iegbe_loopback_cleanup().
9904 + * This borrows liberally from iegbe_loopback_cleanup().
9905 * making note that the M88 phy is what'll be used on Truxton
9908 * Loopback cleanup is the same for all supported PHYs.
9911 @@ -1289,38 +1182,32 @@ iegbe_oem_loopback_cleanup(struct iegbe_
9914 switch (adapter->hw.phy_id) {
9915 - case BCM5395S_PHY_ID:
9916 - DEBUGOUT("WARNING: An empty iegbe_oem_loopback_cleanup() has been called!\n");
9920 case M88E1000_I_PHY_ID:
9921 case M88E1141_E_PHY_ID:
9922 - case BCM5481_PHY_ID:
9924 adapter->hw.autoneg = TRUE;
9926 - ret_val = iegbe_oem_read_phy_reg_ex(&adapter->hw, PHY_CTRL,
9928 + ret_val = iegbe_oem_read_phy_reg_ex(&adapter->hw, PHY_CTRL,
9931 DEBUGOUT("Unable to read to register PHY_CTRL\n");
9936 if(phy_reg & MII_CR_LOOPBACK) {
9937 phy_reg &= ~MII_CR_LOOPBACK;
9939 - ret_val = iegbe_oem_write_phy_reg_ex(&adapter->hw, PHY_CTRL,
9941 + ret_val = iegbe_oem_write_phy_reg_ex(&adapter->hw, PHY_CTRL,
9944 DEBUGOUT("Unable to write to register PHY_CTRL\n");
9949 iegbe_phy_reset(&adapter->hw);
9954 #endif /* ifdef EXTERNAL_MDIO */
9957 @@ -1336,7 +1223,7 @@ iegbe_oem_loopback_cleanup(struct iegbe_
9958 * Called by iegbe_check_downshift(), checks the PHY to see if it running
9959 * at as speed slower than its maximum.
9963 iegbe_oem_phy_speed_downgraded(struct iegbe_hw *hw, uint16_t *isDowngraded)
9965 #ifdef EXTERNAL_MDIO
9966 @@ -1356,24 +1243,19 @@ iegbe_oem_phy_speed_downgraded(struct ie
9969 switch (hw->phy_id) {
9970 - case BCM5395S_PHY_ID:
9971 - case BCM5481_PHY_ID:
9972 - *isDowngraded = 0;
9975 case M88E1000_I_PHY_ID:
9976 case M88E1141_E_PHY_ID:
9977 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
9978 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
9981 DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_STATUS\n");
9985 - *isDowngraded = (phy_data & M88E1000_PSSR_DOWNSHIFT)
9987 + *isDowngraded = (phy_data & M88E1000_PSSR_DOWNSHIFT)
9988 >> M88E1000_PSSR_DOWNSHIFT_SHIFT;
9994 DEBUGOUT("Invalid PHY ID\n");
9996 @@ -1388,7 +1270,7 @@ iegbe_oem_phy_speed_downgraded(struct ie
10003 #endif /* ifdef EXTERNAL_MDIO */
10005 @@ -1403,7 +1285,7 @@ iegbe_oem_phy_speed_downgraded(struct ie
10006 * Called by iegbe_check_downshift(), checks the PHY to see if it running
10007 * at as speed slower than its maximum.
10011 iegbe_oem_check_polarity(struct iegbe_hw *hw, uint16_t *polarity)
10013 #ifdef EXTERNAL_MDIO
10014 @@ -1417,33 +1299,27 @@ iegbe_oem_check_polarity(struct iegbe_hw
10020 * borrow liberally from iegbe_check_polarity.
10021 * Make note that the M88 phy is what'll be used on Truxton
10024 switch (hw->phy_id) {
10025 - case BCM5395S_PHY_ID:
10026 - case BCM5481_PHY_ID:
10030 case M88E1000_I_PHY_ID:
10031 case M88E1141_E_PHY_ID:
10032 /* return the Polarity bit in the Status register. */
10033 - ret_val = iegbe_oem_read_phy_reg_ex(hw,
10034 - M88E1000_PHY_SPEC_STATUS,
10035 + ret_val = iegbe_oem_read_phy_reg_ex(hw,
10036 + M88E1000_PHY_SPEC_STATUS,
10039 DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_STATUS\n");
10043 - *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY)
10044 + *polarity = (phy_data & M88E1000_PSSR_REV_POLARITY)
10045 >> M88E1000_PSSR_REV_POLARITY_SHIFT;
10052 DEBUGOUT("Invalid PHY ID\n");
10053 return -E1000_ERR_PHY_TYPE;
10054 @@ -1472,7 +1348,7 @@ iegbe_oem_check_polarity(struct iegbe_hw
10055 * the MAC with the PHY. It turns out on ICP_XXXX, this is not
10056 * done automagically.
10060 iegbe_oem_phy_is_full_duplex(struct iegbe_hw *hw, int *isFD)
10062 #ifdef EXTERNAL_MDIO
10063 @@ -1485,40 +1361,22 @@ iegbe_oem_phy_is_full_duplex(struct iegb
10069 * Make note that the M88 phy is what'll be used on Truxton
10070 * see iegbe_config_mac_to_phy
10074 switch (hw->phy_id) {
10075 - case BCM5395S_PHY_ID:
10076 - /* Always full duplex */
10080 - case BCM5481_PHY_ID:
10081 - ret_val = iegbe_read_phy_reg(hw, BCM5481_ASTAT, &phy_data);
10082 - if(ret_val) return ret_val;
10084 - switch (BCM5481_ASTAT_HCD(phy_data)) {
10085 - case BCM5481_ASTAT_1KBTFD:
10086 - case BCM5481_ASTAT_100BTXFD:
10094 case M88E1000_I_PHY_ID:
10095 case M88E1141_E_PHY_ID:
10096 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
10098 - DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_STATUS\n");
10101 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
10104 + DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_STATUS\n");
10107 *isFD = (phy_data & M88E1000_PSSR_DPLX) != 0;
10112 DEBUGOUT("Invalid PHY ID\n");
10113 @@ -1546,7 +1404,7 @@ iegbe_oem_phy_is_full_duplex(struct iegb
10114 * the MAC with the PHY. It turns out on ICP_XXXX, this is not
10115 * done automagically.
10119 iegbe_oem_phy_is_speed_1000(struct iegbe_hw *hw, int *is1000)
10121 #ifdef EXTERNAL_MDIO
10122 @@ -1565,28 +1423,10 @@ iegbe_oem_phy_is_speed_1000(struct iegbe
10125 switch (hw->phy_id) {
10126 - case BCM5395S_PHY_ID:
10127 - /* Always 1000mb */
10131 - case BCM5481_PHY_ID:
10132 - ret_val = iegbe_read_phy_reg(hw, BCM5481_ASTAT, &phy_data);
10133 - if(ret_val) return ret_val;
10135 - switch (BCM5481_ASTAT_HCD(phy_data)) {
10136 - case BCM5481_ASTAT_1KBTFD:
10137 - case BCM5481_ASTAT_1KBTHD:
10145 case M88E1000_I_PHY_ID:
10146 case M88E1141_E_PHY_ID:
10147 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
10148 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
10151 DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_STATUS\n");
10153 @@ -1638,28 +1478,9 @@ iegbe_oem_phy_is_speed_100(struct iegbe_
10154 * see iegbe_config_mac_to_phy
10156 switch (hw->phy_id) {
10157 - case BCM5395S_PHY_ID:
10158 - /* Always 1000Mb, never 100mb */
10162 - case BCM5481_PHY_ID:
10163 - ret_val = iegbe_read_phy_reg(hw, BCM5481_ASTAT, &phy_data);
10164 - if(ret_val) return ret_val;
10166 - switch (BCM5481_ASTAT_HCD(phy_data)) {
10167 - case BCM5481_ASTAT_100BTXFD:
10168 - case BCM5481_ASTAT_100BTXHD:
10176 case M88E1000_I_PHY_ID:
10177 case M88E1141_E_PHY_ID:
10178 - ret_val = iegbe_oem_read_phy_reg_ex(hw,
10179 + ret_val = iegbe_oem_read_phy_reg_ex(hw,
10180 M88E1000_PHY_SPEC_STATUS,
10183 @@ -1714,29 +1535,24 @@ iegbe_oem_phy_get_info(struct iegbe_hw *
10184 * see iegbe_phy_m88_get_info
10186 switch (hw->phy_id) {
10187 - case BCM5395S_PHY_ID:
10188 - case BCM5481_PHY_ID:
10189 - DEBUGOUT("WARNING: An empty iegbe_oem_phy_get_info() has been called!\n");
10192 case M88E1000_I_PHY_ID:
10193 case M88E1141_E_PHY_ID:
10194 - /* The downshift status is checked only once, after link is
10195 - * established and it stored in the hw->speed_downgraded parameter.*/
10196 + /* The downshift status is checked only once, after link is
10197 + * established and it stored in the hw->speed_downgraded parameter.*/
10198 phy_info->downshift = (iegbe_downshift)hw->speed_downgraded;
10200 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
10202 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_CTRL,
10205 DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_CTRL\n");
10209 - phy_info->extended_10bt_distance =
10210 - (phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE)
10211 + phy_info->extended_10bt_distance =
10212 + (phy_data & M88E1000_PSCR_10BT_EXT_DIST_ENABLE)
10213 >> M88E1000_PSCR_10BT_EXT_DIST_ENABLE_SHIFT;
10214 phy_info->polarity_correction =
10215 - (phy_data & M88E1000_PSCR_POLARITY_REVERSAL)
10216 + (phy_data & M88E1000_PSCR_POLARITY_REVERSAL)
10217 >> M88E1000_PSCR_POLARITY_REVERSAL_SHIFT;
10219 /* Check polarity status */
10220 @@ -1747,11 +1563,11 @@ iegbe_oem_phy_get_info(struct iegbe_hw *
10222 phy_info->cable_polarity = polarity;
10224 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
10225 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
10228 - DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_STATUS\n");
10230 + DEBUGOUT("Unable to read register M88E1000_PHY_SPEC_STATUS\n");
10234 phy_info->mdix_mode = (phy_data & M88E1000_PSSR_MDIX)
10235 @@ -1761,24 +1577,24 @@ iegbe_oem_phy_get_info(struct iegbe_hw *
10236 /* Cable Length Estimation and Local/Remote Receiver Information
10237 * are only valid at 1000 Mbps.
10239 - phy_info->cable_length =
10240 + phy_info->cable_length =
10241 (phy_data & M88E1000_PSSR_CABLE_LENGTH)
10242 >> M88E1000_PSSR_CABLE_LENGTH_SHIFT;
10244 - ret_val = iegbe_oem_read_phy_reg_ex(hw, PHY_1000T_STATUS,
10245 + ret_val = iegbe_oem_read_phy_reg_ex(hw, PHY_1000T_STATUS,
10248 DEBUGOUT("Unable to read register PHY_1000T_STATUS\n");
10252 - phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS)
10253 + phy_info->local_rx = (phy_data & SR_1000T_LOCAL_RX_STATUS)
10254 >> SR_1000T_LOCAL_RX_STATUS_SHIFT;
10256 - phy_info->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS)
10258 + phy_info->remote_rx = (phy_data & SR_1000T_REMOTE_RX_STATUS)
10259 >> SR_1000T_REMOTE_RX_STATUS_SHIFT;
10265 DEBUGOUT("Invalid PHY ID\n");
10266 @@ -1801,7 +1617,7 @@ iegbe_oem_phy_get_info(struct iegbe_hw *
10267 * This function will perform a software initiated reset of
10272 iegbe_oem_phy_hw_reset(struct iegbe_hw *hw)
10274 #ifdef EXTERNAL_MDIO
10275 @@ -1815,18 +1631,13 @@ iegbe_oem_phy_hw_reset(struct iegbe_hw *
10279 - * This code pretty much copies the default case from
10280 + * This code pretty much copies the default case from
10281 * iegbe_phy_reset() as that is what is appropriate for
10282 - * the M88 used in truxton.
10283 + * the M88 used in truxton.
10285 switch (hw->phy_id) {
10286 - case BCM5395S_PHY_ID:
10287 - DEBUGOUT("WARNING: An empty iegbe_oem_phy_hw_reset() has been called!\n");
10290 case M88E1000_I_PHY_ID:
10291 case M88E1141_E_PHY_ID:
10292 - case BCM5481_PHY_ID:
10293 ret_val = iegbe_oem_read_phy_reg_ex(hw, PHY_CTRL, &phy_data);
10295 DEBUGOUT("Unable to read register PHY_CTRL\n");
10296 @@ -1864,7 +1675,7 @@ iegbe_oem_phy_hw_reset(struct iegbe_hw *
10297 * to perform and post reset initialiation. Not all PHYs require
10298 * this, which is why it was split off as a seperate function.
10302 iegbe_oem_phy_init_script(struct iegbe_hw *hw)
10304 #ifdef EXTERNAL_MDIO
10305 @@ -1877,19 +1688,17 @@ iegbe_oem_phy_init_script(struct iegbe_h
10307 /* call the GCU func that can do any phy specific init
10308 * functions after a reset
10311 * Make note that the M88 phy is what'll be used on Truxton
10313 - * The closest thing is in iegbe_phy_init_script, however this is
10314 + * The closest thing is in iegbe_phy_init_script, however this is
10315 * for the IGP style of phy. This is probably a no-op for truxton
10316 * but may be needed by OEM's later on
10320 switch (hw->phy_id) {
10321 case M88E1000_I_PHY_ID:
10322 case M88E1141_E_PHY_ID:
10323 - case BCM5481_PHY_ID:
10324 - case BCM5395S_PHY_ID:
10325 DEBUGOUT("Nothing to do for OEM PHY Init");
10328 @@ -1926,13 +1735,8 @@ iegbe_oem_read_phy_reg_ex(struct iegbe_h
10332 - if (hw->phy_id == BCM5395S_PHY_ID) {
10333 - DEBUGOUT("WARNING: iegbe_oem_read_phy_reg_ex() has been unexpectedly called!\n");
10337 /* call the GCU func that will read the phy
10340 * Make note that the M88 phy is what'll be used on Truxton.
10342 * The closest thing is in iegbe_read_phy_reg_ex.
10343 @@ -1940,7 +1744,7 @@ iegbe_oem_read_phy_reg_ex(struct iegbe_h
10344 * NOTE: this is 1 (of 2) functions that is truly dependant on the
10349 ret_val = gcu_read_eth_phy(iegbe_oem_get_phy_dev_number(hw),
10350 reg_addr, phy_data);
10352 @@ -1962,10 +1766,10 @@ iegbe_oem_read_phy_reg_ex(struct iegbe_h
10354 * Returns E1000_SUCCESS, negative E1000 error code on failure
10356 - * This is called from iegbe_config_mac_to_phy. Various supported
10357 + * This is called from iegbe_config_mac_to_phy. Various supported
10358 * Phys may require the RGMII/RMII Translation gasket be set to RMII.
10362 iegbe_oem_set_trans_gasket(struct iegbe_hw *hw)
10364 #ifdef EXTERNAL_MDIO
10365 @@ -1978,17 +1782,12 @@ iegbe_oem_set_trans_gasket(struct iegbe_
10368 switch (hw->phy_id) {
10369 - case BCM5395S_PHY_ID:
10370 - case BCM5481_PHY_ID:
10371 - DEBUGOUT("WARNING: An empty iegbe_oem_set_trans_gasket() has been called!\n");
10374 case M88E1000_I_PHY_ID:
10375 case M88E1141_E_PHY_ID:
10376 /* Gasket set correctly for Marvell Phys, so nothing to do */
10378 /* Add your PHY_ID here if your device requires an RMII interface
10379 - case YOUR_PHY_ID:
10380 + case YOUR_PHY_ID:
10381 ctrl_aux_reg = E1000_READ_REG(hw, CTRL_AUX);
10382 ctrl_aux_reg |= E1000_CTRL_AUX_ICP_xxxx_MII_TGS; // Set the RGMII_RMII bit
10384 @@ -2032,7 +1831,7 @@ iegbe_oem_write_phy_reg_ex(struct iegbe_
10387 /* call the GCU func that will write to the phy
10390 * Make note that the M88 phy is what'll be used on Truxton.
10392 * The closest thing is in iegbe_write_phy_reg_ex
10393 @@ -2062,11 +1861,11 @@ iegbe_oem_write_phy_reg_ex(struct iegbe_
10394 * @hw struct iegbe_hw hardware specific data
10396 * iegbe_reset_hw is called to reset the MAC. If, for
10397 - * some reason the PHY needs to be reset as well, this
10398 + * some reason the PHY needs to be reset as well, this
10399 * should return TRUE and then iegbe_oem_phy_hw_reset()
10404 iegbe_oem_phy_needs_reset_with_mac(struct iegbe_hw *hw)
10406 #ifdef EXTERNAL_MDIO
10407 @@ -2079,16 +1878,14 @@ iegbe_oem_phy_needs_reset_with_mac(struc
10413 * From the original iegbe driver, the M88
10414 - * PHYs did not seem to need this reset,
10415 + * PHYs did not seem to need this reset,
10416 * so returning FALSE.
10418 switch (hw->phy_id) {
10419 case M88E1000_I_PHY_ID:
10420 case M88E1141_E_PHY_ID:
10421 - case BCM5481_PHY_ID:
10422 - case BCM5395S_PHY_ID:
10426 @@ -2116,7 +1913,7 @@ iegbe_oem_phy_needs_reset_with_mac(struc
10427 * tweaking of the PHY, for PHYs that support a DSP.
10432 iegbe_oem_config_dsp_after_link_change(struct iegbe_hw *hw,
10435 @@ -2138,8 +1935,6 @@ iegbe_oem_config_dsp_after_link_change(s
10436 switch (hw->phy_id) {
10437 case M88E1000_I_PHY_ID:
10438 case M88E1141_E_PHY_ID:
10439 - case BCM5481_PHY_ID:
10440 - case BCM5395S_PHY_ID:
10441 DEBUGOUT("No DSP to configure on OEM PHY");
10444 @@ -2165,7 +1960,7 @@ iegbe_oem_config_dsp_after_link_change(s
10450 iegbe_oem_get_cable_length(struct iegbe_hw *hw,
10451 uint16_t *min_length,
10452 uint16_t *max_length)
10453 @@ -2177,21 +1972,15 @@ iegbe_oem_get_cable_length(struct iegbe_
10456 DEBUGFUNC1("%s",__func__);
10459 if(!hw || !min_length || !max_length) {
10463 switch (hw->phy_id) {
10464 - case BCM5395S_PHY_ID:
10465 - case BCM5481_PHY_ID:
10467 - *max_length = iegbe_igp_cable_length_150;
10470 case M88E1000_I_PHY_ID:
10471 case M88E1141_E_PHY_ID:
10472 - ret_val = iegbe_oem_read_phy_reg_ex(hw,
10473 + ret_val = iegbe_oem_read_phy_reg_ex(hw,
10474 M88E1000_PHY_SPEC_STATUS,
10477 @@ -2246,13 +2035,13 @@ iegbe_oem_get_cable_length(struct iegbe_
10479 * iegbe_oem_phy_is_link_up
10480 * @hw iegbe_hw struct containing device specific information
10481 - * @isUp a boolean returning true if link is up
10482 + * @isUp a boolean returning true if link is up
10484 * This is called as part of iegbe_config_mac_to_phy() to align
10485 * the MAC with the PHY. It turns out on ICP_XXXX, this is not
10486 * done automagically.
10490 iegbe_oem_phy_is_link_up(struct iegbe_hw *hw, int *isUp)
10492 #ifdef EXTERNAL_MDIO
10493 @@ -2266,35 +2055,19 @@ iegbe_oem_phy_is_link_up(struct iegbe_hw
10499 * Make note that the M88 phy is what'll be used on Truxton
10500 * see iegbe_config_mac_to_phy
10503 switch (hw->phy_id) {
10504 - case BCM5395S_PHY_ID:
10505 - /* Link always up */
10507 - return E1000_SUCCESS;
10510 - case BCM5481_PHY_ID:
10511 - iegbe_oem_read_phy_reg_ex(hw, BCM5481_ESTAT, &phy_data);
10512 - ret_val = iegbe_oem_read_phy_reg_ex(hw, BCM5481_ESTAT, &phy_data);
10515 - DEBUGOUT("Unable to read PHY register BCM5481_ESTAT\n");
10518 - statusMask = BCM5481_ESTAT_LINK;
10521 - case M88E1000_I_PHY_ID:
10522 + case M88E1000_I_PHY_ID:
10523 case M88E1141_E_PHY_ID:
10524 - iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
10525 - ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
10526 + iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
10527 + ret_val = iegbe_oem_read_phy_reg_ex(hw, M88E1000_PHY_SPEC_STATUS,
10529 statusMask = M88E1000_PSSR_LINK;
10533 DEBUGOUT("Invalid PHY ID\n");
10534 return -E1000_ERR_PHY_TYPE;
10535 @@ -2319,213 +2092,3 @@ iegbe_oem_phy_is_link_up(struct iegbe_hw
10536 #endif /* ifdef EXTERNAL_MDIO */
10542 -// Read BCM5481 expansion register
10545 -bcm5481_read_ex (struct iegbe_hw *hw, uint16_t reg, uint16_t *data)
10548 - uint16_t selector;
10549 - uint16_t reg_data;
10551 - // Get the current value of bits 15:12
10552 - ret = iegbe_oem_read_phy_reg_ex (hw, 0x15, &selector);
10556 - // Select the expansion register
10557 - selector &= 0xf000;
10558 - selector |= (0xf << 8) | (reg);
10559 - iegbe_oem_write_phy_reg_ex (hw, 0x17, selector);
10561 - // Read the expansion register
10562 - ret = iegbe_oem_read_phy_reg_ex (hw, 0x15, ®_data);
10564 - // De-select the expansion registers.
10565 - selector &= 0xf000;
10566 - iegbe_oem_write_phy_reg_ex (hw, 0x17, selector);
10571 - *data = reg_data;
10576 -// Read reg 0x18 sub-register
10579 -bcm5481_read_18sv (struct iegbe_hw *hw, int sv, uint16_t *data)
10582 - uint16_t tmp_data;
10584 - // Select reg 0x18, sv
10585 - tmp_data = ((sv & BCM5481_R18H_SV_MASK) << 12) | BCM5481_R18H_SV_MCTRL;
10586 - ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R18H, tmp_data);
10590 - // Read reg 0x18, sv
10591 - ret = iegbe_oem_read_phy_reg_ex (hw, BCM5481_R18H, &tmp_data);
10595 - *data = tmp_data;
10600 -// Read reg 0x1C sub-register
10603 -bcm5481_read_1csv (struct iegbe_hw *hw, int sv, uint16_t *data)
10606 - uint16_t tmp_data;
10608 - // Select reg 0x1c, sv
10609 - tmp_data = ((sv & BCM5481_R1CH_SV_MASK) << BCM5481_R1CH_SV_SHIFT);
10611 - ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R1CH, tmp_data);
10615 - // Read reg 0x1c, sv
10616 - ret = iegbe_oem_read_phy_reg_ex (hw, BCM5481_R1CH, &tmp_data);
10620 - *data = tmp_data;
10625 -// Read-modify-write a 0x1C register.
10627 -// hw - hardware access info.
10628 -// reg - 0x1C register to modify.
10629 -// data - bits which should be set.
10630 -// mask - the '1' bits in this argument will be cleared in the data
10631 -// read from 'reg' then 'data' will be or'd in and the result
10632 -// will be written to 'reg'.
10635 -bcm5481_rmw_1csv (struct iegbe_hw *hw, uint16_t reg, uint16_t data, uint16_t mask)
10638 - uint16_t reg_data;
10642 - ret = bcm5481_read_1csv (hw, reg, ®_data);
10645 - DEBUGOUT("Unable to read BCM5481 1CH register\n");
10646 - printk (KERN_ERR "Unable to read BCM5481 1CH register [0x%x]\n", reg);
10650 - reg_data &= ~mask;
10651 - reg_data |= (BCM5481_R1CH_WE | data);
10653 - ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R1CH, reg_data);
10656 - DEBUGOUT("Unable to write BCM5481 1CH register\n");
10657 - printk (KERN_ERR "Unable to write BCM5481 1CH register\n");
10665 -oi_phy_setup (struct iegbe_hw *hw)
10668 - uint16_t pmii_data;
10669 - uint16_t mctrl_data;
10670 - uint16_t cacr_data;
10671 - uint16_t sc1_data;
10672 - uint16_t lctl_data;
10676 - // Set low power mode via reg 0x18, sv010, bit 6
10677 - // Do a read-modify-write on reg 0x18, sv010 register to preserve existing bits.
10678 - ret = bcm5481_read_18sv (hw, BCM5481_R18H_SV_PMII, &pmii_data);
10681 - DEBUGOUT("Unable to read BCM5481_R18H_SV_PMII register\n");
10682 - printk (KERN_ERR "Unable to read BCM5481_R18H_SV_PMII register\n");
10686 - // Set the LPM bit in the data just read and write back to sv010
10687 - // The shadow register select bits [2:0] are set by reading the sv010
10689 - pmii_data |= BCM5481_R18H_SV010_LPM;
10690 - ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R18H, pmii_data);
10693 - DEBUGOUT("Unable to write BCM5481_R18H register\n");
10694 - printk (KERN_ERR "Unable to write BCM5481_R18H register\n");
10699 - // Set the RGMII RXD to RXC skew bit in reg 0x18, sv111
10701 - if (bcm5481_read_18sv (hw, BCM5481_R18H_SV_MCTRL, &mctrl_data))
10703 - DEBUGOUT("Unable to read BCM5481_R18H_SV_MCTRL register\n");
10704 - printk (KERN_ERR "Unable to read BCM5481_R18H_SV_MCTRL register\n");
10707 - mctrl_data |= (BCM5481_R18H_WE | BCM5481_R18H_SV111_SKEW);
10709 - ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R18H, mctrl_data);
10712 - DEBUGOUT("Unable to write BCM5481_R18H register\n");
10713 - printk (KERN_ERR "Unable to write BCM5481_R18H register\n");
10718 - // Enable RGMII transmit clock delay in reg 0x1c, sv00011
10719 - ret = bcm5481_read_1csv (hw, BCM5481_R1CH_CACR, &cacr_data);
10722 - DEBUGOUT("Unable to read BCM5481_R1CH_CACR register\n");
10723 - printk (KERN_ERR "Unable to read BCM5481_R1CH_CACR register\n");
10727 - cacr_data |= (BCM5481_R1CH_WE | BCM5481_R1CH_CACR_TCD);
10729 - ret = iegbe_oem_write_phy_reg_ex (hw, BCM5481_R1CH, cacr_data);
10732 - DEBUGOUT("Unable to write BCM5481_R1CH register\n");
10733 - printk (KERN_ERR "Unable to write BCM5481_R1CH register\n");
10737 - // Enable dual link speed indication (0x1c, sv 00010, bit 2)
10738 - ret = bcm5481_rmw_1csv (hw, BCM5481_R1CH_SC1, BCM5481_R1CH_SC1_LINK, BCM5481_R1CH_SC1_LINK);
10742 - // Enable link and activity on ACTIVITY LED (0x1c, sv 01001, bit 4=1, bit 3=0)
10743 - ret = bcm5481_rmw_1csv (hw, BCM5481_R1CH_LCTRL, BCM5481_R1CH_LCTRL_ALEN, BCM5481_R1CH_LCTRL_ALEN | BCM5481_R1CH_LCTRL_AEN);
10749 --- a/Embedded/src/GbE/iegbe_oem_phy.h
10750 +++ b/Embedded/src/GbE/iegbe_oem_phy.h
10753 GPL LICENSE SUMMARY
10755 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
10756 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
10758 - This program is free software; you can redistribute it and/or modify
10759 + This program is free software; you can redistribute it and/or modify
10760 it under the terms of version 2 of the GNU General Public License as
10761 published by the Free Software Foundation.
10763 - This program is distributed in the hope that it will be useful, but
10764 - WITHOUT ANY WARRANTY; without even the implied warranty of
10765 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10766 + This program is distributed in the hope that it will be useful, but
10767 + WITHOUT ANY WARRANTY; without even the implied warranty of
10768 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10769 General Public License for more details.
10771 - You should have received a copy of the GNU General Public License
10772 - along with this program; if not, write to the Free Software
10773 + You should have received a copy of the GNU General Public License
10774 + along with this program; if not, write to the Free Software
10775 Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
10776 - The full GNU General Public License is included in this distribution
10777 + The full GNU General Public License is included in this distribution
10778 in the file called LICENSE.GPL.
10780 Contact Information:
10783 - version: Embedded.L.1.0.34
10784 + version: Embedded.Release.Patch.L.1.0.7-5
10786 Contact Information:
10788 - Intel Corporation, 5000 W Chandler Blvd, Chandler, AZ 85226
10790 + Intel Corporation, 5000 W Chandler Blvd, Chandler, AZ 85226
10792 *******************************************************************************/
10793 #ifndef _IEGBE_OEM_PHY_H_
10794 @@ -45,10 +45,10 @@ int32_t iegbe_oem_set_trans_gasket(struc
10795 uint32_t iegbe_oem_get_tipg(struct iegbe_hw *hw);
10796 int iegbe_oem_phy_is_copper(struct iegbe_hw *hw);
10797 uint32_t iegbe_oem_get_phy_dev_number(struct iegbe_hw *hw);
10798 -int iegbe_oem_mii_ioctl(struct iegbe_adapter *adapter, unsigned long flags,
10799 +int iegbe_oem_mii_ioctl(struct iegbe_adapter *adapter, unsigned long flags,
10800 struct ifreq *ifr, int cmd);
10801 void iegbe_oem_fiber_live_in_suspend(struct iegbe_hw *hw);
10802 -void iegbe_oem_get_phy_regs(struct iegbe_adapter *adapter, uint32_t *data,
10803 +void iegbe_oem_get_phy_regs(struct iegbe_adapter *adapter, uint32_t *data,
10804 uint32_t data_length);
10805 int iegbe_oem_phy_loopback(struct iegbe_adapter *adapter);
10806 void iegbe_oem_loopback_cleanup(struct iegbe_adapter *adapter);
10807 @@ -94,81 +94,14 @@ int32_t iegbe_oem_phy_is_link_up(struct
10808 #define ICP_XXXX_MAC_2 2
10810 #define DEFAULT_ICP_XXXX_TIPG_IPGT 8 /* Inter Packet Gap Transmit Time */
10811 -#define ICP_XXXX_TIPG_IPGT_MASK 0x000003FFUL
10812 -#define BCM5481_PHY_ID 0x0143BCA2
10813 -#define BCM5395S_PHY_ID 0x0143BCF0
10814 +#define ICP_XXXX_TIPG_IPGT_MASK 0x000003FFUL
10816 /* Miscellaneous defines */
10817 #ifdef IEGBE_10_100_ONLY
10818 - #define ICP_XXXX_AUTONEG_ADV_DEFAULT 0x0F
10819 + #define ICP_XXXX_AUTONEG_ADV_DEFAULT 0x0F
10821 #define ICP_XXXX_AUTONEG_ADV_DEFAULT 0x2F
10825 -// BCM5481 specifics
10827 -#define BCM5481_ECTRL (0x10)
10828 -#define BCM5481_ESTAT (0x11)
10829 -#define BCM5481_RXERR (0x12)
10830 -#define BCM5481_EXPRW (0x15)
10831 -#define BCM5481_EXPACC (0x17)
10832 -#define BCM5481_ASTAT (0x19)
10833 -#define BCM5481_R18H (0x18)
10834 -#define BCM5481_R1CH (0x1c)
10837 -// indirect register access via register 18h
10839 -#define BCM5481_R18H_SV_MASK (7) // Mask for SV bits.
10840 -#define BCM5481_R18H_SV_ACTRL (0) // SV000 Aux. control
10841 -#define BCM5481_R18H_SV_10BT (1) // SV001 10Base-T
10842 -#define BCM5481_R18H_SV_PMII (2) // SV010 Power/MII control
10843 -#define BCM5481_R18H_SV_MTEST (4) // SV100 Misc. test
10844 -#define BCM5481_R18H_SV_MCTRL (7) // SV111 Misc. control
10846 -#define BCM5481_R18H_SV001_POL (1 << 13) // Polarity
10847 -#define BCM5481_R18H_SV010_LPM (1 << 6)
10848 -#define BCM5481_R18H_SV111_SKEW (1 << 8)
10849 -#define BCM5481_R18H_WE (1 << 15) // Write enable
10852 -#define BCM5481_R1CH_SV_SHIFT (10)
10853 -#define BCM5481_R1CH_SV_MASK (0x1f)
10854 -#define BCM5481_R1CH_SC1 (0x02) // sv00010 Spare control 1
10855 -#define BCM5481_R1CH_CACR (0x03) // sv00011 Clock alignment control
10856 -#define BCM5481_R1CH_LCTRL (0x09) // sv01001 LED control
10857 -#define BCM5481_R1CH_LEDS1 (0x0d) // sv01101 LED selector 1
10860 -#define BCM5481_R1CH_WE (1 << 15) // Write enable
10863 -#define BCM5481_R1CH_SC1_LINK (1 << 2) // sv00010 Linkspeed
10866 -#define BCM5481_R1CH_CACR_TCD (1 << 9) // sv00011 RGMII tx clock delay
10869 -#define BCM5481_R1CH_LCTRL_ALEN (1 << 4) // Activity/Link enable on ACTIVITY LED
10870 -#define BCM5481_R1CH_LCTRL_AEN (1 << 3) // Activity enable on ACTIVITY LED
10873 -#define BCM5481_ECTRL_DISMDIX (1 <<14)
10875 -#define BCM5481_MCTRL_AUTOMDIX (1 <<9)
10877 -#define BCM5481_ESTAT_LINK (1 << 8)
10879 -#define BCM5481_ASTAT_ANC (1 << 15)
10880 -#define BCM5481_ASTAT_ANHCD (7 << 8)
10881 -#define BCM5481_ASTAT_HCD(x) ((x >> 8) & 7)
10882 -#define BCM5481_ASTAT_1KBTFD (0x7)
10883 -#define BCM5481_ASTAT_1KBTHD (0x6)
10884 -#define BCM5481_ASTAT_100BTXFD (0x5)
10885 -#define BCM5481_ASTAT_100BTXHD (0x3)
10887 -// end BCM5481 specifics
10889 #endif /* ifndef _IEGBE_OEM_PHY_H_ */
10892 --- a/Embedded/src/GbE/iegbe_osdep.h
10893 +++ b/Embedded/src/GbE/iegbe_osdep.h
10896 GPL LICENSE SUMMARY
10898 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
10899 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
10901 This program is free software; you can redistribute it and/or modify
10902 it under the terms of version 2 of the GNU General Public License as
10903 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
10904 Contact Information:
10907 - version: Embedded.L.1.0.34
10908 + version: Embedded.Release.Patch.L.1.0.7-5
10910 Contact Information:
10912 --- a/Embedded/src/GbE/iegbe_param.c
10913 +++ b/Embedded/src/GbE/iegbe_param.c
10916 GPL LICENSE SUMMARY
10918 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
10919 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
10921 This program is free software; you can redistribute it and/or modify
10922 it under the terms of version 2 of the GNU General Public License as
10923 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
10924 Contact Information:
10927 - version: Embedded.L.1.0.34
10928 + version: Embedded.Release.Patch.L.1.0.7-5
10930 Contact Information:
10932 @@ -239,11 +239,7 @@ E1000_PARAM(InterruptThrottleRate, "Inte
10933 #define MAX_TXABSDELAY 0xFFFF
10934 #define MIN_TXABSDELAY 0
10936 -#ifdef IEGBE_GBE_WORKAROUND
10937 -#define DEFAULT_ITR 0
10939 #define DEFAULT_ITR 8000
10943 #define MAX_ITR 100000
10944 @@ -373,7 +369,7 @@ iegbe_check_options(struct iegbe_adapter
10945 tx_ring->count = opt.def;
10948 - for (i = 0; i < adapter->num_queues; i++)
10949 + for (i = 0; i < adapter->num_tx_queues; i++)
10950 tx_ring[i].count = tx_ring->count;
10952 { /* Receive Descriptor Count */
10953 @@ -403,7 +399,7 @@ iegbe_check_options(struct iegbe_adapter
10954 rx_ring->count = opt.def;
10957 - for (i = 0; i < adapter->num_queues; i++)
10958 + for (i = 0; i < adapter->num_rx_queues; i++)
10959 rx_ring[i].count = rx_ring->count;
10961 { /* Checksum Offload Enable/Disable */
10962 --- a/Embedded/src/GbE/kcompat.c
10963 +++ b/Embedded/src/GbE/kcompat.c
10965 -/************************************************************
10967 +/************************************************************
10969 GPL LICENSE SUMMARY
10971 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
10972 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
10974 This program is free software; you can redistribute it and/or modify
10975 it under the terms of version 2 of the GNU General Public License as
10976 @@ -22,183 +22,192 @@ GPL LICENSE SUMMARY
10977 Contact Information:
10980 - version: Embedded.L.1.0.34
10982 - Contact Information:
10984 - Intel Corporation, 5000 W Chandler Blvd, Chandler, AZ 85226
10986 -**************************************************************/
10987 -/**************************************************************************
10988 - * @ingroup KCOMPAT_GENERAL
10990 - * @file kcompat.c
10995 - **************************************************************************/
10996 -#include "kcompat.h"
10998 -/*************************************************************/
10999 -/* 2.4.13 => 2.4.3 */
11000 -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(0x2,0x4,0xd) )
11002 -/**************************************/
11003 -/* PCI DMA MAPPING */
11005 -#if defined(CONFIG_HIGHMEM)
11007 -#ifndef PCI_DRAM_OFFSET
11008 -#define PCI_DRAM_OFFSET 0
11011 -u64 _kc_pci_map_page(struct pci_dev *dev,
11012 - struct page *page,
11013 - unsigned long offset,
11018 - ret_val = (((u64)(page - mem_map) << PAGE_SHIFT) + offset +
11019 - PCI_DRAM_OFFSET);
11023 -#else /* CONFIG_HIGHMEM */
11025 -u64 _kc_pci_map_page(struct pci_dev *dev,
11026 - struct page *page,
11027 - unsigned long offset,
11031 - return pci_map_single(dev, (void *)page_address(page) + offset,
11032 - size, direction);
11035 -#endif /* CONFIG_HIGHMEM */
11037 -void _kc_pci_unmap_page(struct pci_dev *dev,
11042 - return pci_unmap_single(dev, dma_addr, size, direction);
11045 -#endif /* 2.4.13 => 2.4.3 */
11048 -/*****************************************************************************/
11049 -/* 2.4.3 => 2.4.0 */
11050 -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(0x2,0x4,0x3) )
11052 -/**************************************/
11053 -/* PCI DRIVER API */
11055 -int _kc_pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask)
11057 - if(!pci_dma_supported(dev, mask)) {
11060 - dev->dma_mask = mask;
11064 -int _kc_pci_request_regions(struct pci_dev *dev, char *res_name)
11068 - for (i = 0; i < 0x6; i++) {
11069 - if (pci_resource_len(dev, i) == 0) {
11072 - if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
11073 - if (!request_region(pci_resource_start(dev, i),
11074 - pci_resource_len(dev, i), res_name)) {
11075 - pci_release_regions(dev);
11078 - } else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
11079 - if (!request_mem_region(pci_resource_start(dev, i),
11080 - pci_resource_len(dev, i),
11082 - pci_release_regions(dev);
11090 -void _kc_pci_release_regions(struct pci_dev *dev)
11094 - for (i = 0; i < 0x6; i++) {
11095 - if (pci_resource_len(dev, i) == 0) {
11098 - if (pci_resource_flags(dev, i) & IORESOURCE_IO){
11099 - release_region(pci_resource_start(dev, i),
11100 - pci_resource_len(dev, i));
11101 - } else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
11102 - release_mem_region(pci_resource_start(dev, i),
11103 - pci_resource_len(dev, i));
11108 -/**************************************/
11109 -/* NETWORK DRIVER API */
11111 -struct net_device * _kc_alloc_etherdev(int sizeof_priv)
11113 - struct net_device *dev;
11116 - alloc_size = sizeof(*dev) + sizeof_priv + IFNAMSIZ + 0x1f;
11118 - dev = kmalloc(alloc_size, GFP_KERNEL);
11120 - if (!dev) { return NULL; }
11122 - memset(dev, 0, alloc_size);
11124 - if (sizeof_priv) {
11125 - dev->priv = (void *) (((unsigned long)(dev + 1) + 0x1f) & ~0x1f);
11127 - dev->name[0] = '\0';
11129 - ether_setup(dev);
11134 -int _kc_is_valid_ether_addr(u8 *addr)
11136 - const char zaddr[0x6] = {0,};
11138 - return !(addr[0]&1) && memcmp( addr, zaddr, 0x6);
11141 -#endif /* 2.4.3 => 2.4.0 */
11144 -/*****************************************************************/
11145 -/* 2.4.6 => 2.4.3 */
11146 -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(0x2,0x4,0x6) )
11148 -int _kc_pci_set_power_state(struct pci_dev *dev, int state)
11150 -int _kc_pci_save_state(struct pci_dev *dev, u32 *buffer)
11152 -int _kc_pci_restore_state(struct pci_dev *pdev, u32 *buffer)
11154 -int _kc_pci_enable_wake(struct pci_dev *pdev, u32 state, int enable)
11157 -#endif /* 2.4.6 => 2.4.3 */
11160 + version: Embedded.Release.Patch.L.1.0.7-5
11162 + Contact Information:
11164 + Intel Corporation, 5000 W Chandler Blvd, Chandler, AZ 85226
11166 +**************************************************************/
11167 +/**************************************************************************
11168 + * @ingroup KCOMPAT_GENERAL
11170 + * @file kcompat.c
11175 + **************************************************************************/
11176 +#include "kcompat.h"
11178 +/*************************************************************/
11179 +/* 2.4.13 => 2.4.3 */
11180 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(0x2,0x4,0xd) )
11182 +/**************************************/
11183 +/* PCI DMA MAPPING */
11185 +#if defined(CONFIG_HIGHMEM)
11187 +#ifndef PCI_DRAM_OFFSET
11188 +#define PCI_DRAM_OFFSET 0
11191 +u64 _kc_pci_map_page(struct pci_dev *dev,
11192 + struct page *page,
11193 + unsigned long offset,
11198 + ret_val = (((u64)(page - mem_map) << PAGE_SHIFT) + offset +
11199 + PCI_DRAM_OFFSET);
11203 +#else /* CONFIG_HIGHMEM */
11205 +u64 _kc_pci_map_page(struct pci_dev *dev,
11206 + struct page *page,
11207 + unsigned long offset,
11211 + return pci_map_single(dev, (void *)page_address(page) + offset,
11212 + size, direction);
11215 +#endif /* CONFIG_HIGHMEM */
11217 +void _kc_pci_unmap_page(struct pci_dev *dev,
11222 + return pci_unmap_single(dev, dma_addr, size, direction);
11225 +#endif /* 2.4.13 => 2.4.3 */
11228 +/*****************************************************************************/
11229 +/* 2.4.3 => 2.4.0 */
11230 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(0x2,0x4,0x3) )
11232 +/**************************************/
11233 +/* PCI DRIVER API */
11235 +int _kc_pci_set_dma_mask(struct pci_dev *dev, dma_addr_t mask)
11237 + if(!pci_dma_supported(dev, mask)) {
11240 + dev->dma_mask = mask;
11244 +int _kc_pci_request_regions(struct pci_dev *dev, char *res_name)
11248 + for (i = 0; i < 0x6; i++) {
11249 + if (pci_resource_len(dev, i) == 0) {
11252 + if (pci_resource_flags(dev, i) & IORESOURCE_IO) {
11253 + if (!request_region(pci_resource_start(dev, i),
11254 + pci_resource_len(dev, i), res_name)) {
11255 + pci_release_regions(dev);
11258 + } else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
11259 + if (!request_mem_region(pci_resource_start(dev, i),
11260 + pci_resource_len(dev, i),
11262 + pci_release_regions(dev);
11270 +void _kc_pci_release_regions(struct pci_dev *dev)
11274 + for (i = 0; i < 0x6; i++) {
11275 + if (pci_resource_len(dev, i) == 0) {
11278 + if (pci_resource_flags(dev, i) & IORESOURCE_IO){
11279 + release_region(pci_resource_start(dev, i),
11280 + pci_resource_len(dev, i));
11281 + } else if (pci_resource_flags(dev, i) & IORESOURCE_MEM) {
11282 + release_mem_region(pci_resource_start(dev, i),
11283 + pci_resource_len(dev, i));
11288 +/**************************************/
11289 +/* NETWORK DRIVER API */
11291 +struct net_device * _kc_alloc_etherdev(int sizeof_priv)
11293 + struct net_device *dev;
11296 + alloc_size = sizeof(*dev) + sizeof_priv + IFNAMSIZ + 0x1f;
11298 + dev = kmalloc(alloc_size, GFP_KERNEL);
11300 + if (!dev) { return NULL; }
11302 + memset(dev, 0, alloc_size);
11304 + if (sizeof_priv) {
11305 + dev->priv = (void *) (((unsigned long)(dev + 1) + 0x1f) & ~0x1f);
11307 + dev->name[0] = '\0';
11309 + ether_setup(dev);
11314 +int _kc_is_valid_ether_addr(u8 *addr)
11316 + const char zaddr[0x6] = {0,};
11318 + return !(addr[0]&1) && memcmp( addr, zaddr, 0x6);
11321 +#endif /* 2.4.3 => 2.4.0 */
11324 +/*****************************************************************/
11325 +/* 2.4.6 => 2.4.3 */
11326 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(0x2,0x4,0x6) )
11328 +int _kc_pci_set_power_state(struct pci_dev *dev, int state)
11330 +int _kc_pci_save_state(struct pci_dev *dev, u32 *buffer)
11332 +int _kc_pci_restore_state(struct pci_dev *pdev, u32 *buffer)
11334 +int _kc_pci_enable_wake(struct pci_dev *pdev, u32 state, int enable)
11337 +#endif /* 2.4.6 => 2.4.3 */
11341 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24) )
11343 +void dump_stack(void)
11347 +#endif /* 2.4.24 */
11349 --- a/Embedded/src/GbE/kcompat_ethtool.c
11350 +++ b/Embedded/src/GbE/kcompat_ethtool.c
11353 * GPL LICENSE SUMMARY
11355 - * Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
11356 + * Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
11358 * This program is free software; you can redistribute it and/or modify
11359 * it under the terms of version 2 of the GNU General Public License as
11361 * Contact Information:
11362 * Intel Corporation
11364 - * version: Embedded.L.1.0.34
11365 + * version: Embedded.Release.Patch.L.1.0.7-5
11368 /**************************************************************************
11369 @@ -779,6 +779,7 @@ static int ethtool_get_stats(struct net_
11372 /* The main entry point in this file. Called from net/core/dev.c */
11374 #define ETHTOOL_OPS_COMPAT
11375 int ethtool_ioctl(struct ifreq *ifr)
11377 --- a/Embedded/src/GbE/kcompat.h
11378 +++ b/Embedded/src/GbE/kcompat.h
11381 GPL LICENSE SUMMARY
11383 - Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
11384 + Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
11386 This program is free software; you can redistribute it and/or modify
11387 it under the terms of version 2 of the GNU General Public License as
11388 @@ -22,7 +22,7 @@ GPL LICENSE SUMMARY
11389 Contact Information:
11392 - version: Embedded.L.1.0.34
11393 + version: Embedded.Release.Patch.L.1.0.7-5
11395 Contact Information:
11397 @@ -69,15 +69,6 @@ GPL LICENSE SUMMARY
11398 #define CONFIG_NET_POLL_CONTROLLER
11402 -#undef CONFIG_E1000_NAPI
11403 -#define CONFIG_E1000_NAPI
11406 -#ifdef E1000_NO_NAPI
11407 -#undef CONFIG_E1000_NAPI
11410 #ifndef module_param
11411 #define module_param(v,t,p) MODULE_PARM(v, "i");
11413 @@ -554,35 +545,14 @@ extern void _kc_pci_unmap_page(struct pc
11416 /*****************************************************************************/
11417 -/* 2.4.23 => 2.4.22 */
11418 -#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) )
11419 -#ifdef CONFIG_E1000_NAPI
11420 -#ifndef netif_poll_disable
11421 -#define netif_poll_disable(x) _kc_netif_poll_disable(x)
11422 -static inline void _kc_netif_poll_disable(struct net_device *netdev)
11424 - while (test_and_set_bit(__LINK_STATE_RX_SCHED, &netdev->state)) {
11426 - current->state = TASK_INTERRUPTIBLE;
11427 - schedule_timeout(1);
11431 -#ifndef netif_poll_enable
11432 -#define netif_poll_enable(x) _kc_netif_poll_enable(x)
11433 -static inline void _kc_netif_poll_enable(struct net_device *netdev)
11435 - clear_bit(__LINK_STATE_RX_SCHED, &netdev->state);
11441 -/*****************************************************************************/
11442 /* 2.5.28 => 2.4.23 */
11443 #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) )
11445 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) )
11446 +static inline void _kc_synchronize_irq(void) { barrier(); }
11448 static inline void _kc_synchronize_irq() { synchronize_irq(); }
11449 +#endif /* 2.4.23 */
11450 #undef synchronize_irq
11451 #define synchronize_irq(X) _kc_synchronize_irq()
11453 @@ -747,6 +717,37 @@ static inline struct mii_ioctl_data *_kc
11454 #define skb_header_cloned(x) 0
11455 #endif /* SKB_DATAREF_SHIFT not defined */
11457 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) )
11459 +#define ioread32(addr) readl(addr)
11460 +#define iowrite32(val,addr) writel(val,addr)
11462 +#endif /* 2.6.10 */
11464 +#ifndef DEFINE_SPINLOCK
11465 +#define DEFINE_SPINLOCK(s) spinlock_t s = SPIN_LOCK_UNLOCKED
11466 +#endif /* DEFINE_SPINLOCK */
11468 +#ifndef PCI_COMMAND_INTX_DISABLE
11469 +#define PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
11470 +#endif /* PCI_COMMAND_INTX_DISABLE */
11472 +#ifndef ETH_GSTRING_LEN
11473 +#define ETH_GSTRING_LEN 32
11474 +#endif /* ETH_GSTRING_LEN */
11476 +#if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24) )
11478 +extern void dump_stack(void);
11480 +#undef register_reboot_notifier
11481 +#define register_reboot_notifier(a)
11483 +#undef unregister_reboot_notifier
11484 +#define unregister_reboot_notifier(a)
11486 +#endif /* 2.4.24 */
11488 #endif /* _KCOMPAT_H_ */
11491 --- a/Embedded/src/GbE/Makefile
11492 +++ b/Embedded/src/GbE/Makefile
11494 # GPL LICENSE SUMMARY
11496 -# Copyright(c) 2007,2008 Intel Corporation. All rights reserved.
11497 +# Copyright(c) 2007,2008,2009 Intel Corporation. All rights reserved.
11499 # This program is free software; you can redistribute it and/or modify
11500 # it under the terms of version 2 of the GNU General Public License as
11502 # Contact Information:
11503 # Intel Corporation
11505 -# version: Embedded.L.1.0.34
11506 +# version: Embedded.Release.Patch.L.1.0.7-5
11508 ###########################################################################
11510 @@ -35,6 +35,8 @@ MDIO_PHONY_CFILES = gcu.c
11511 MDIO_CFILES = gcu_main.c gcu_if.c
11512 MDIO_HFILES = gcu.h gcu_if.h gcu_reg.h kcompat.h
11514 +KVER=$(shell uname -r)
11518 # KSRC (path to kernel source to build against)
11519 @@ -50,45 +52,16 @@ MDIO_HFILES = gcu.h gcu_if.h gcu_reg.h k
11521 # set KSRC, KOBJ, and EXTERNAL_MDIO to default values of not already set
11523 -KOBJ ?= /usr/src/kernels/linux
11524 -KSRC ?= /usr/src/kernels/linux
11525 +#KOBJ=/usr/src/kernels/linux
11526 +#KSRC=/usr/src/kernels/linux
11532 -# By default the workaround for the IEGBE writeback issue is enabled
11534 -IEGBE_GBE_WORKAROUND ?= 0
11536 -# If the platform only supports 10/100 this variable needs to be set
11537 -# so the default advertisement is set appropriately.
11538 -# By default, this variable will be disabled.
11540 -IEGBE_10_100_ONLY ?= 0
11542 -# check for version.h and autoconf.h for running kernel in /boot (SUSE)
11543 -ifneq (,$(wildcard /boot/vmlinuz.version.h))
11544 - VERSION_FILE := /boot/vmlinuz.version.h
11545 - CONFIG_FILE := /boot/vmlinuz.autoconf.h
11546 - KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | \
11547 - grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')
11548 - ifeq ($(KVER),$(shell uname -r))
11549 - # set up include path to override headers from kernel source
11550 - x:=$(shell rm -rf include)
11551 - x:=$(shell mkdir -p include/linux)
11552 - x:=$(shell cp /boot/vmlinuz.version.h include/linux/version.h)
11553 - x:=$(shell cp /boot/vmlinuz.autoconf.h include/linux/autoconf.h)
11554 - CFLAGS += -I./include
11556 - VERSION_FILE := $(KOBJ)/include/linux/version.h
11557 - UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
11558 - CONFIG_FILE := $(KOBJ)/include/linux/autoconf.h
11561 - VERSION_FILE := $(KOBJ)/include/linux/version.h
11562 - UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
11563 - CONFIG_FILE := $(KOBJ)/include/linux/autoconf.h
11565 +VERSION_FILE := $(KSRC)/include/linux/version.h
11566 +UTS_REL_FILE := $(KSRC)/include/linux/utsrelease.h
11567 +CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
11569 ifeq (,$(wildcard $(VERSION_FILE)))
11570 $(error Linux kernel source not configured - missing version.h)
11571 @@ -98,83 +71,8 @@ ifeq (,$(wildcard $(CONFIG_FILE)))
11572 $(error Linux kernel source not configured - missing autoconf.h)
11575 -# as of 2.6.16, kernel define UTS_RELEASE has been moved to utsrelease.h
11576 -# so check that file for kernel version string instead of version.h
11577 -USE_UTS_REL := $(shell [ -f $(UTS_REL_FILE) ] && echo "1")
11580 -ifneq (,$(findstring egcs-2.91.66, $(shell cat /proc/version)))
11581 - CC := kgcc gcc cc
11585 -test_cc = $(shell $(cc) --version > /dev/null 2>&1 && echo $(cc))
11586 -CC := $(foreach cc, $(CC), $(test_cc))
11587 -CC := $(firstword $(CC))
11589 - $(error Compiler not found)
11592 -# we need to know what platform the driver is being built on
11593 -# some additional features are only built on Intel platforms
11594 -ARCH := $(shell uname -m | sed 's/i.86/i386/')
11595 -ifeq ($(ARCH),alpha)
11596 - CFLAGS += -ffixed-8 -mno-fp-regs
11598 -ifeq ($(ARCH),x86_64)
11599 - CFLAGS += -mcmodel=kernel -mno-red-zone
11601 -ifeq ($(ARCH),ppc)
11602 - CFLAGS += -msoft-float
11604 -ifeq ($(ARCH),ppc64)
11605 - CFLAGS += -m64 -msoft-float
11606 - LDFLAGS += -melf64ppc
11609 -# standard flags for module builds
11610 -CFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
11611 -CFLAGS += -I$(KSRC)/include -I.
11612 -CFLAGS += $(shell [ -f $(KSRC)/include/linux/modversions.h ] && \
11613 - echo "-DMODVERSIONS -DEXPORT_SYMTAB \
11614 - -include $(KSRC)/include/linux/modversions.h")
11616 -ifeq ($(IEGBE_GBE_WORKAROUND), 1)
11617 -CFLAGS += -DIEGBE_GBE_WORKAROUND -DE1000_NO_NAPI
11620 -ifeq ($(IEGBE_10_100_ONLY), 1)
11621 -CFLAGS += -DIEGBE_10_100_ONLY
11624 -CFLAGS += $(CFLAGS_EXTRA)
11625 -#ifeq (,$(shell echo $(CFLAGS_EXTRA) | grep NAPI))
11626 -#CFLAGS += -DE1000_NO_NAPI
11627 -#CFLAGS_EXTRA += -DE1000_NO_NAPI
11630 -RHC := $(KSRC)/include/linux/rhconfig.h
11631 -ifneq (,$(wildcard $(RHC)))
11632 - # 7.3 typo in rhconfig.h
11633 - ifneq (,$(shell $(CC) $(CFLAGS) -E -dM $(RHC) | grep __module__bigmem))
11634 - CFLAGS += -D__module_bigmem
11638 -# get the kernel version - we use this to find the correct install path
11639 -ifeq ($(USE_UTS_REL), 1)
11640 - KVER := $(shell $(CC) $(CFLAGS) -E -dM $(UTS_REL_FILE) | grep UTS_RELEASE | \
11641 - awk '{ print $$3 }' | sed 's/\"//g')
11643 - KVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | grep UTS_RELEASE | \
11644 - awk '{ print $$3 }' | sed 's/\"//g')
11647 -KKVER := $(shell echo $(KVER) | \
11648 - awk '{ if ($$0 ~ /2\.[6-9]\./) print "1"; else print "0"}')
11649 -ifeq ($(KKVER), 0)
11650 - $(error *** Aborting the build. \
11651 - *** This driver is not supported on kernel versions older than 2.6.18)
11652 +ifeq (,$(wildcard $(UTS_REL_FILE)))
11653 + $(error Linux kernel source not configured - missing utsrelease.h)
11656 # set the install path
11657 @@ -202,11 +100,11 @@ ifneq ($(SMP),$(shell uname -a | grep SM
11661 - CFLAGS += -D__SMP__
11662 + EXTRA_CFLAGS += -D__SMP__
11665 ifeq ($(EXTERNAL_MDIO), 1)
11666 - CFLAGS += -DEXTERNAL_MDIO
11667 + EXTRA_CFLAGS += -DEXTERNAL_MDIO
11670 ###########################################################################
11671 @@ -223,7 +121,6 @@ MANSECTION = 7
11672 MANFILE = $(TARGET:.ko=.$(MANSECTION))
11674 ifneq ($(PATCHLEVEL),)
11675 - EXTRA_CFLAGS += $(CFLAGS_EXTRA)
11676 obj-m += $(TARGET:.ko=.o)
11677 iegbe-objs := $(CFILES:.c=.o)
11678 ifeq ($(EXTERNAL_MDIO),1)
11683 -Embedded/environment.mk
11684 -Embedded/src/1588/1588.c
11685 -Embedded/src/1588/1588.h
11686 -Embedded/src/1588/IxTimeSyncAcc_p.h
11687 -Embedded/src/1588/Makefile
11688 -Embedded/src/1588/ixtimesyncacc.c
11689 -Embedded/src/1588/ixtimesyncacc.h
11690 -Embedded/src/1588/linux_ioctls.h
11691 -Embedded/src/CAN/Makefile
11692 -Embedded/src/CAN/can_fifo.c
11693 -Embedded/src/CAN/can_fifo.h
11694 -Embedded/src/CAN/can_ioctl.h
11695 -Embedded/src/CAN/can_main.c
11696 -Embedded/src/CAN/can_main.h
11697 -Embedded/src/CAN/can_port.h
11698 -Embedded/src/CAN/icp_can.c
11699 -Embedded/src/CAN/icp_can.h
11700 -Embedded/src/CAN/icp_can_regs.h
11701 -Embedded/src/CAN/icp_can_types.h
11702 -Embedded/src/CAN/icp_can_user.h
11703 -Embedded/src/EDMA/Makefile
11704 -Embedded/src/EDMA/dma.h
11705 -Embedded/src/EDMA/dma_api.h
11706 -Embedded/src/EDMA/dma_client_api.c
11707 -Embedded/src/EDMA/dma_common.c
11708 -Embedded/src/EDMA/dma_internals.h
11709 -Embedded/src/EDMA/dma_linux.c
11710 -Embedded/src/EDMA/os/os.c
11711 -Embedded/src/EDMA/os/os.h
11712 -Embedded/src/EDMA/os/os_list.c
11713 -Embedded/src/EDMA/os/os_list.h
11714 -Embedded/src/EDMA/os/os_types.h
11715 -Embedded/src/GPIO/Makefile
11716 -Embedded/src/GPIO/common.h
11717 -Embedded/src/GPIO/gpio.h
11718 -Embedded/src/GPIO/gpio_ref.c
11719 -Embedded/src/GPIO/linux_ioctls.h
11720 Embedded/src/GbE/Makefile
11721 Embedded/src/GbE/gcu.h
11722 Embedded/src/GbE/gcu_if.c
11723 @@ -55,16 +17,6 @@ Embedded/src/GbE/iegbe_param.c
11724 Embedded/src/GbE/kcompat.c
11725 Embedded/src/GbE/kcompat.h
11726 Embedded/src/GbE/kcompat_ethtool.c
11727 -Embedded/src/WDT/Makefile
11728 -Embedded/src/WDT/iwdt.c
11729 -Embedded/src/WDT/iwdt.h
11730 -Embedded/src/patches/Intel_EP80579_RHEL5.patch
11731 -Embedded/src/patches/pci.ids_RHEL5.patch
11733 -build_system/build_files/Core/ia.mk
11734 -build_system/build_files/OS/linux_2.6.mk
11735 -build_system/build_files/OS/linux_2.6_kernel_space_rules.mk
11736 -build_system/build_files/common.mk
11737 -build_system/build_files/rules.mk
11743 -PACKAGE_TYPE=Embedded
11744 +PACKAGE_TYPE=Embedded.Release.Patch
11748 @@ -6,4 +6,6 @@ PACKAGE_VERSION_MAJOR_NUMBER=1
11750 PACKAGE_VERSION_MINOR_NUMBER=0
11752 -PACKAGE_VERSION_PATCH_NUMBER=34
11753 +PACKAGE_VERSION_PATCH_NUMBER=7
11755 +PACKAGE_VERSION_BUILD_NUMBER=5