aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-11-09 02:00:54 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-09 02:00:54 -0500
commitd0e1e88d6e7dbd8e1661cb6a058ca30f54ee39e4 (patch)
treedaab7cc0db83226672f76d2fc9277e4355f89e6b /drivers/net
parent9e0d57fd6dad37d72a3ca6db00ca8c76f2215454 (diff)
parent2606289779cb297320a185db5997729d29b6700b (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/can/usb/ems_usb.c
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/benet/be.h2
-rw-r--r--drivers/net/benet/be_ethtool.c8
-rw-r--r--drivers/net/benet/be_main.c28
-rw-r--r--drivers/net/can/dev.c17
-rw-r--r--drivers/net/can/usb/ems_usb.c5
-rw-r--r--drivers/net/cassini.c5
-rw-r--r--drivers/net/fsl_pq_mdio.c1
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c84
-rw-r--r--drivers/net/macsonic.c117
-rw-r--r--drivers/net/qlge/qlge_main.c2
-rw-r--r--drivers/net/qlge/qlge_mpi.c2
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2100.c5
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c2
-rw-r--r--drivers/net/wireless/ipw2x00/libipw.h1
-rw-r--r--drivers/net/wireless/ipw2x00/libipw_module.c14
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00link.c11
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c9
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_leds.c4
19 files changed, 215 insertions, 106 deletions
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index ce7563175cef..67e165cf3f4e 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -269,6 +269,8 @@ struct be_adapter {
269 u32 port_num; 269 u32 port_num;
270 bool promiscuous; 270 bool promiscuous;
271 u32 cap; 271 u32 cap;
272 u32 rx_fc; /* Rx flow control */
273 u32 tx_fc; /* Tx flow control */
272}; 274};
273 275
274extern const struct ethtool_ops be_ethtool_ops; 276extern const struct ethtool_ops be_ethtool_ops;
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c
index edebce994906..e8f92831021a 100644
--- a/drivers/net/benet/be_ethtool.c
+++ b/drivers/net/benet/be_ethtool.c
@@ -362,10 +362,12 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
362 362
363 if (ecmd->autoneg != 0) 363 if (ecmd->autoneg != 0)
364 return -EINVAL; 364 return -EINVAL;
365 adapter->tx_fc = ecmd->tx_pause;
366 adapter->rx_fc = ecmd->rx_pause;
365 367
366 status = be_cmd_set_flow_control(adapter, ecmd->tx_pause, 368 status = be_cmd_set_flow_control(adapter,
367 ecmd->rx_pause); 369 adapter->tx_fc, adapter->rx_fc);
368 if (!status) 370 if (status)
369 dev_warn(&adapter->pdev->dev, "Pause param set failed.\n"); 371 dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");
370 372
371 return status; 373 return status;
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 43180dc210a2..c0bd20356eaf 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -1611,11 +1611,21 @@ static int be_open(struct net_device *netdev)
1611 status = be_cmd_link_status_query(adapter, &link_up, &mac_speed, 1611 status = be_cmd_link_status_query(adapter, &link_up, &mac_speed,
1612 &link_speed); 1612 &link_speed);
1613 if (status) 1613 if (status)
1614 return status; 1614 goto ret_sts;
1615 be_link_status_update(adapter, link_up); 1615 be_link_status_update(adapter, link_up);
1616 1616
1617 status = be_vid_config(adapter);
1618 if (status)
1619 goto ret_sts;
1620
1621 status = be_cmd_set_flow_control(adapter,
1622 adapter->tx_fc, adapter->rx_fc);
1623 if (status)
1624 goto ret_sts;
1625
1617 schedule_delayed_work(&adapter->work, msecs_to_jiffies(100)); 1626 schedule_delayed_work(&adapter->work, msecs_to_jiffies(100));
1618 return 0; 1627ret_sts:
1628 return status;
1619} 1629}
1620 1630
1621static int be_setup(struct be_adapter *adapter) 1631static int be_setup(struct be_adapter *adapter)
@@ -1649,17 +1659,8 @@ static int be_setup(struct be_adapter *adapter)
1649 if (status != 0) 1659 if (status != 0)
1650 goto rx_qs_destroy; 1660 goto rx_qs_destroy;
1651 1661
1652 status = be_vid_config(adapter);
1653 if (status != 0)
1654 goto mccqs_destroy;
1655
1656 status = be_cmd_set_flow_control(adapter, true, true);
1657 if (status != 0)
1658 goto mccqs_destroy;
1659 return 0; 1662 return 0;
1660 1663
1661mccqs_destroy:
1662 be_mcc_queues_destroy(adapter);
1663rx_qs_destroy: 1664rx_qs_destroy:
1664 be_rx_queues_destroy(adapter); 1665 be_rx_queues_destroy(adapter);
1665tx_qs_destroy: 1666tx_qs_destroy:
@@ -1910,6 +1911,10 @@ static void be_netdev_init(struct net_device *netdev)
1910 1911
1911 adapter->rx_csum = true; 1912 adapter->rx_csum = true;
1912 1913
1914 /* Default settings for Rx and Tx flow control */
1915 adapter->rx_fc = true;
1916 adapter->tx_fc = true;
1917
1913 netif_set_gso_max_size(netdev, 65535); 1918 netif_set_gso_max_size(netdev, 65535);
1914 1919
1915 BE_SET_NETDEV_OPS(netdev, &be_netdev_ops); 1920 BE_SET_NETDEV_OPS(netdev, &be_netdev_ops);
@@ -2172,6 +2177,7 @@ static int be_suspend(struct pci_dev *pdev, pm_message_t state)
2172 be_close(netdev); 2177 be_close(netdev);
2173 rtnl_unlock(); 2178 rtnl_unlock();
2174 } 2179 }
2180 be_cmd_get_flow_control(adapter, &adapter->tx_fc, &adapter->rx_fc);
2175 be_clear(adapter); 2181 be_clear(adapter);
2176 2182
2177 pci_save_state(pdev); 2183 pci_save_state(pdev);
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 5fe34d64ca2a..26c89aaeba62 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -637,6 +637,22 @@ static int can_changelink(struct net_device *dev,
637 return 0; 637 return 0;
638} 638}
639 639
640static size_t can_get_size(const struct net_device *dev)
641{
642 struct can_priv *priv = netdev_priv(dev);
643 size_t size;
644
645 size = nla_total_size(sizeof(u32)); /* IFLA_CAN_STATE */
646 size += sizeof(struct can_ctrlmode); /* IFLA_CAN_CTRLMODE */
647 size += nla_total_size(sizeof(u32)); /* IFLA_CAN_RESTART_MS */
648 size += sizeof(struct can_bittiming); /* IFLA_CAN_BITTIMING */
649 size += sizeof(struct can_clock); /* IFLA_CAN_CLOCK */
650 if (priv->bittiming_const) /* IFLA_CAN_BITTIMING_CONST */
651 size += sizeof(struct can_bittiming_const);
652
653 return size;
654}
655
640static int can_fill_info(struct sk_buff *skb, const struct net_device *dev) 656static int can_fill_info(struct sk_buff *skb, const struct net_device *dev)
641{ 657{
642 struct can_priv *priv = netdev_priv(dev); 658 struct can_priv *priv = netdev_priv(dev);
@@ -687,6 +703,7 @@ static struct rtnl_link_ops can_link_ops __read_mostly = {
687 .setup = can_setup, 703 .setup = can_setup,
688 .newlink = can_newlink, 704 .newlink = can_newlink,
689 .changelink = can_changelink, 705 .changelink = can_changelink,
706 .get_size = can_get_size,
690 .fill_info = can_fill_info, 707 .fill_info = can_fill_info,
691 .fill_xstats = can_fill_xstats, 708 .fill_xstats = can_fill_xstats,
692}; 709};
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 3685f3e42d12..3e4419054c81 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -315,7 +315,7 @@ static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg)
315 if (skb == NULL) 315 if (skb == NULL)
316 return; 316 return;
317 317
318 cf->can_id = msg->msg.can_msg.id; 318 cf->can_id = le32_to_cpu(msg->msg.can_msg.id);
319 cf->can_dlc = min_t(u8, msg->msg.can_msg.length, 8); 319 cf->can_dlc = min_t(u8, msg->msg.can_msg.length, 8);
320 320
321 if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME 321 if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME
@@ -801,6 +801,9 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
801 msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc; 801 msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc;
802 } 802 }
803 803
804 /* Respect byte order */
805 msg->msg.can_msg.id = cpu_to_le32(msg->msg.can_msg.id);
806
804 for (i = 0; i < MAX_TX_URBS; i++) { 807 for (i = 0; i < MAX_TX_URBS; i++) {
805 if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) { 808 if (dev->tx_contexts[i].echo_index == MAX_TX_URBS) {
806 context = &dev->tx_contexts[i]; 809 context = &dev->tx_contexts[i];
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 05916aafa4f1..f857afe8e488 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4342,11 +4342,11 @@ static int cas_open(struct net_device *dev)
4342 cas_unlock_all_restore(cp, flags); 4342 cas_unlock_all_restore(cp, flags);
4343 } 4343 }
4344 4344
4345 err = -ENOMEM;
4345 if (cas_tx_tiny_alloc(cp) < 0) 4346 if (cas_tx_tiny_alloc(cp) < 0)
4346 return -ENOMEM; 4347 goto err_unlock;
4347 4348
4348 /* alloc rx descriptors */ 4349 /* alloc rx descriptors */
4349 err = -ENOMEM;
4350 if (cas_alloc_rxds(cp) < 0) 4350 if (cas_alloc_rxds(cp) < 0)
4351 goto err_tx_tiny; 4351 goto err_tx_tiny;
4352 4352
@@ -4386,6 +4386,7 @@ err_spare:
4386 cas_free_rxds(cp); 4386 cas_free_rxds(cp);
4387err_tx_tiny: 4387err_tx_tiny:
4388 cas_tx_tiny_free(cp); 4388 cas_tx_tiny_free(cp);
4389err_unlock:
4389 mutex_unlock(&cp->pm_mutex); 4390 mutex_unlock(&cp->pm_mutex);
4390 return err; 4391 return err;
4391} 4392}
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index b2ca596760f8..25fabb3eedc5 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -462,3 +462,4 @@ void fsl_pq_mdio_exit(void)
462 of_unregister_platform_driver(&fsl_pq_mdio_driver); 462 of_unregister_platform_driver(&fsl_pq_mdio_driver);
463} 463}
464module_exit(fsl_pq_mdio_exit); 464module_exit(fsl_pq_mdio_exit);
465MODULE_LICENSE("GPL");
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 45c5faf0824a..448e84d56601 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -44,6 +44,7 @@
44 44
45#include "ixgbe.h" 45#include "ixgbe.h"
46#include "ixgbe_common.h" 46#include "ixgbe_common.h"
47#include "ixgbe_dcb_82599.h"
47 48
48char ixgbe_driver_name[] = "ixgbe"; 49char ixgbe_driver_name[] = "ixgbe";
49static const char ixgbe_driver_string[] = 50static const char ixgbe_driver_string[] =
@@ -228,6 +229,56 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter,
228 /* tx_buffer_info must be completely set up in the transmit path */ 229 /* tx_buffer_info must be completely set up in the transmit path */
229} 230}
230 231
232/**
233 * ixgbe_tx_is_paused - check if the tx ring is paused
234 * @adapter: the ixgbe adapter
235 * @tx_ring: the corresponding tx_ring
236 *
237 * If not in DCB mode, checks TFCS.TXOFF, otherwise, find out the
238 * corresponding TC of this tx_ring when checking TFCS.
239 *
240 * Returns : true if paused
241 */
242static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter,
243 struct ixgbe_ring *tx_ring)
244{
245 int tc;
246 u32 txoff = IXGBE_TFCS_TXOFF;
247
248#ifdef CONFIG_IXGBE_DCB
249 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
250 int reg_idx = tx_ring->reg_idx;
251 int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
252
253 if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
254 tc = reg_idx >> 2;
255 txoff = IXGBE_TFCS_TXOFF0;
256 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
257 tc = 0;
258 txoff = IXGBE_TFCS_TXOFF;
259 if (dcb_i == 8) {
260 /* TC0, TC1 */
261 tc = reg_idx >> 5;
262 if (tc == 2) /* TC2, TC3 */
263 tc += (reg_idx - 64) >> 4;
264 else if (tc == 3) /* TC4, TC5, TC6, TC7 */
265 tc += 1 + ((reg_idx - 96) >> 3);
266 } else if (dcb_i == 4) {
267 /* TC0, TC1 */
268 tc = reg_idx >> 6;
269 if (tc == 1) {
270 tc += (reg_idx - 64) >> 5;
271 if (tc == 2) /* TC2, TC3 */
272 tc += (reg_idx - 96) >> 4;
273 }
274 }
275 }
276 txoff <<= tc;
277 }
278#endif
279 return IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & txoff;
280}
281
231static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter, 282static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
232 struct ixgbe_ring *tx_ring, 283 struct ixgbe_ring *tx_ring,
233 unsigned int eop) 284 unsigned int eop)
@@ -239,7 +290,7 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
239 adapter->detect_tx_hung = false; 290 adapter->detect_tx_hung = false;
240 if (tx_ring->tx_buffer_info[eop].time_stamp && 291 if (tx_ring->tx_buffer_info[eop].time_stamp &&
241 time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) && 292 time_after(jiffies, tx_ring->tx_buffer_info[eop].time_stamp + HZ) &&
242 !(IXGBE_READ_REG(&adapter->hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF)) { 293 !ixgbe_tx_is_paused(adapter, tx_ring)) {
243 /* detected Tx unit hang */ 294 /* detected Tx unit hang */
244 union ixgbe_adv_tx_desc *tx_desc; 295 union ixgbe_adv_tx_desc *tx_desc;
245 tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); 296 tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
@@ -414,19 +465,23 @@ static void ixgbe_update_tx_dca(struct ixgbe_adapter *adapter,
414 u32 txctrl; 465 u32 txctrl;
415 int cpu = get_cpu(); 466 int cpu = get_cpu();
416 int q = tx_ring - adapter->tx_ring; 467 int q = tx_ring - adapter->tx_ring;
468 struct ixgbe_hw *hw = &adapter->hw;
417 469
418 if (tx_ring->cpu != cpu) { 470 if (tx_ring->cpu != cpu) {
419 txctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q));
420 if (adapter->hw.mac.type == ixgbe_mac_82598EB) { 471 if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
472 txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL(q));
421 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK; 473 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK;
422 txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu); 474 txctrl |= dca3_get_tag(&adapter->pdev->dev, cpu);
475 txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN;
476 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL(q), txctrl);
423 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) { 477 } else if (adapter->hw.mac.type == ixgbe_mac_82599EB) {
478 txctrl = IXGBE_READ_REG(hw, IXGBE_DCA_TXCTRL_82599(q));
424 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599; 479 txctrl &= ~IXGBE_DCA_TXCTRL_CPUID_MASK_82599;
425 txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) << 480 txctrl |= (dca3_get_tag(&adapter->pdev->dev, cpu) <<
426 IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599); 481 IXGBE_DCA_TXCTRL_CPUID_SHIFT_82599);
482 txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN;
483 IXGBE_WRITE_REG(hw, IXGBE_DCA_TXCTRL_82599(q), txctrl);
427 } 484 }
428 txctrl |= IXGBE_DCA_TXCTRL_DESC_DCA_EN;
429 IXGBE_WRITE_REG(&adapter->hw, IXGBE_DCA_TXCTRL(q), txctrl);
430 tx_ring->cpu = cpu; 485 tx_ring->cpu = cpu;
431 } 486 }
432 put_cpu(); 487 put_cpu();
@@ -1908,11 +1963,25 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter)
1908 break; 1963 break;
1909 } 1964 }
1910 } 1965 }
1966
1911 if (hw->mac.type == ixgbe_mac_82599EB) { 1967 if (hw->mac.type == ixgbe_mac_82599EB) {
1968 u32 rttdcs;
1969
1970 /* disable the arbiter while setting MTQC */
1971 rttdcs = IXGBE_READ_REG(hw, IXGBE_RTTDCS);
1972 rttdcs |= IXGBE_RTTDCS_ARBDIS;
1973 IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
1974
1912 /* We enable 8 traffic classes, DCB only */ 1975 /* We enable 8 traffic classes, DCB only */
1913 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) 1976 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED)
1914 IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA | 1977 IXGBE_WRITE_REG(hw, IXGBE_MTQC, (IXGBE_MTQC_RT_ENA |
1915 IXGBE_MTQC_8TC_8TQ)); 1978 IXGBE_MTQC_8TC_8TQ));
1979 else
1980 IXGBE_WRITE_REG(hw, IXGBE_MTQC, IXGBE_MTQC_64Q_1PB);
1981
1982 /* re-eable the arbiter */
1983 rttdcs &= ~IXGBE_RTTDCS_ARBDIS;
1984 IXGBE_WRITE_REG(hw, IXGBE_RTTDCS, rttdcs);
1916 } 1985 }
1917} 1986}
1918 1987
@@ -2466,7 +2535,10 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
2466 ixgbe_restore_vlan(adapter); 2535 ixgbe_restore_vlan(adapter);
2467#ifdef CONFIG_IXGBE_DCB 2536#ifdef CONFIG_IXGBE_DCB
2468 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { 2537 if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
2469 netif_set_gso_max_size(netdev, 32768); 2538 if (hw->mac.type == ixgbe_mac_82598EB)
2539 netif_set_gso_max_size(netdev, 32768);
2540 else
2541 netif_set_gso_max_size(netdev, 65536);
2470 ixgbe_configure_dcb(adapter); 2542 ixgbe_configure_dcb(adapter);
2471 } else { 2543 } else {
2472 netif_set_gso_max_size(netdev, 65536); 2544 netif_set_gso_max_size(netdev, 65536);
diff --git a/drivers/net/macsonic.c b/drivers/net/macsonic.c
index 61eabcac734c..b3d7d8d77f46 100644
--- a/drivers/net/macsonic.c
+++ b/drivers/net/macsonic.c
@@ -223,69 +223,73 @@ static int __devinit macsonic_init(struct net_device *dev)
223 return 0; 223 return 0;
224} 224}
225 225
226static int __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev) 226#define INVALID_MAC(mac) (memcmp(mac, "\x08\x00\x07", 3) && \
227 memcmp(mac, "\x00\xA0\x40", 3) && \
228 memcmp(mac, "\x00\x80\x19", 3) && \
229 memcmp(mac, "\x00\x05\x02", 3))
230
231static void __devinit mac_onboard_sonic_ethernet_addr(struct net_device *dev)
227{ 232{
228 struct sonic_local *lp = netdev_priv(dev); 233 struct sonic_local *lp = netdev_priv(dev);
229 const int prom_addr = ONBOARD_SONIC_PROM_BASE; 234 const int prom_addr = ONBOARD_SONIC_PROM_BASE;
230 int i; 235 unsigned short val;
231 236
232 /* On NuBus boards we can sometimes look in the ROM resources. 237 /*
233 No such luck for comm-slot/onboard. */ 238 * On NuBus boards we can sometimes look in the ROM resources.
234 for(i = 0; i < 6; i++) 239 * No such luck for comm-slot/onboard.
235 dev->dev_addr[i] = SONIC_READ_PROM(i); 240 * On the PowerBook 520, the PROM base address is a mystery.
241 */
242 if (hwreg_present((void *)prom_addr)) {
243 int i;
244
245 for (i = 0; i < 6; i++)
246 dev->dev_addr[i] = SONIC_READ_PROM(i);
247 if (!INVALID_MAC(dev->dev_addr))
248 return;
236 249
237 /* Most of the time, the address is bit-reversed. The NetBSD 250 /*
238 source has a rather long and detailed historical account of 251 * Most of the time, the address is bit-reversed. The NetBSD
239 why this is so. */ 252 * source has a rather long and detailed historical account of
240 if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) && 253 * why this is so.
241 memcmp(dev->dev_addr, "\x00\xA0\x40", 3) && 254 */
242 memcmp(dev->dev_addr, "\x00\x80\x19", 3) &&
243 memcmp(dev->dev_addr, "\x00\x05\x02", 3))
244 bit_reverse_addr(dev->dev_addr); 255 bit_reverse_addr(dev->dev_addr);
245 else 256 if (!INVALID_MAC(dev->dev_addr))
246 return 0; 257 return;
247 258
248 /* If we still have what seems to be a bogus address, we'll
249 look in the CAM. The top entry should be ours. */
250 /* Danger! This only works if MacOS has already initialized
251 the card... */
252 if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) &&
253 memcmp(dev->dev_addr, "\x00\xA0\x40", 3) &&
254 memcmp(dev->dev_addr, "\x00\x80\x19", 3) &&
255 memcmp(dev->dev_addr, "\x00\x05\x02", 3))
256 {
257 unsigned short val;
258
259 printk(KERN_INFO "macsonic: PROM seems to be wrong, trying CAM entry 15\n");
260
261 SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
262 SONIC_WRITE(SONIC_CEP, 15);
263
264 val = SONIC_READ(SONIC_CAP2);
265 dev->dev_addr[5] = val >> 8;
266 dev->dev_addr[4] = val & 0xff;
267 val = SONIC_READ(SONIC_CAP1);
268 dev->dev_addr[3] = val >> 8;
269 dev->dev_addr[2] = val & 0xff;
270 val = SONIC_READ(SONIC_CAP0);
271 dev->dev_addr[1] = val >> 8;
272 dev->dev_addr[0] = val & 0xff;
273
274 printk(KERN_INFO "HW Address from CAM 15: %pM\n",
275 dev->dev_addr);
276 } else return 0;
277
278 if (memcmp(dev->dev_addr, "\x08\x00\x07", 3) &&
279 memcmp(dev->dev_addr, "\x00\xA0\x40", 3) &&
280 memcmp(dev->dev_addr, "\x00\x80\x19", 3) &&
281 memcmp(dev->dev_addr, "\x00\x05\x02", 3))
282 {
283 /* 259 /*
284 * Still nonsense ... messed up someplace! 260 * If we still have what seems to be a bogus address, we'll
261 * look in the CAM. The top entry should be ours.
285 */ 262 */
286 printk(KERN_ERR "macsonic: ERROR (INVALID MAC)\n"); 263 printk(KERN_WARNING "macsonic: MAC address in PROM seems "
287 return -EIO; 264 "to be invalid, trying CAM\n");
288 } else return 0; 265 } else {
266 printk(KERN_WARNING "macsonic: cannot read MAC address from "
267 "PROM, trying CAM\n");
268 }
269
270 /* This only works if MacOS has already initialized the card. */
271
272 SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
273 SONIC_WRITE(SONIC_CEP, 15);
274
275 val = SONIC_READ(SONIC_CAP2);
276 dev->dev_addr[5] = val >> 8;
277 dev->dev_addr[4] = val & 0xff;
278 val = SONIC_READ(SONIC_CAP1);
279 dev->dev_addr[3] = val >> 8;
280 dev->dev_addr[2] = val & 0xff;
281 val = SONIC_READ(SONIC_CAP0);
282 dev->dev_addr[1] = val >> 8;
283 dev->dev_addr[0] = val & 0xff;
284
285 if (!INVALID_MAC(dev->dev_addr))
286 return;
287
288 /* Still nonsense ... messed up someplace! */
289
290 printk(KERN_WARNING "macsonic: MAC address in CAM entry 15 "
291 "seems invalid, will use a random MAC\n");
292 random_ether_addr(dev->dev_addr);
289} 293}
290 294
291static int __devinit mac_onboard_sonic_probe(struct net_device *dev) 295static int __devinit mac_onboard_sonic_probe(struct net_device *dev)
@@ -402,8 +406,7 @@ static int __devinit mac_onboard_sonic_probe(struct net_device *dev)
402 SONIC_WRITE(SONIC_ISR, 0x7fff); 406 SONIC_WRITE(SONIC_ISR, 0x7fff);
403 407
404 /* Now look for the MAC address. */ 408 /* Now look for the MAC address. */
405 if (mac_onboard_sonic_ethernet_addr(dev) != 0) 409 mac_onboard_sonic_ethernet_addr(dev);
406 return -ENODEV;
407 410
408 /* Shared init code */ 411 /* Shared init code */
409 return macsonic_init(dev); 412 return macsonic_init(dev);
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 0de596ad8a7e..bd8e164b121c 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -4145,6 +4145,8 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
4145 goto err_out; 4145 goto err_out;
4146 } 4146 }
4147 4147
4148 /* Set PCIe reset type for EEH to fundamental. */
4149 pdev->needs_freset = 1;
4148 pci_save_state(pdev); 4150 pci_save_state(pdev);
4149 qdev->reg_base = 4151 qdev->reg_base =
4150 ioremap_nocache(pci_resource_start(pdev, 1), 4152 ioremap_nocache(pci_resource_start(pdev, 1),
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c
index f5619fe87bb2..e2b2286102d4 100644
--- a/drivers/net/qlge/qlge_mpi.c
+++ b/drivers/net/qlge/qlge_mpi.c
@@ -483,7 +483,7 @@ static int ql_mailbox_command(struct ql_adapter *qdev, struct mbox_params *mbcp)
483 /* Wait for the interrupt to come in. */ 483 /* Wait for the interrupt to come in. */
484 status = ql_wait_mbx_cmd_cmplt(qdev); 484 status = ql_wait_mbx_cmd_cmplt(qdev);
485 if (status) 485 if (status)
486 goto end; 486 continue;
487 487
488 /* Process the event. If it's an AEN, it 488 /* Process the event. If it's an AEN, it
489 * will be handled in-line or a worker 489 * will be handled in-line or a worker
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
index a741d37fd96f..240cff1e6979 100644
--- a/drivers/net/wireless/ipw2x00/ipw2100.c
+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
@@ -6325,10 +6325,8 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev,
6325 6325
6326 fail: 6326 fail:
6327 if (dev) { 6327 if (dev) {
6328 if (registered) { 6328 if (registered)
6329 unregister_ieee80211(priv->ieee);
6330 unregister_netdev(dev); 6329 unregister_netdev(dev);
6331 }
6332 6330
6333 ipw2100_hw_stop_adapter(priv); 6331 ipw2100_hw_stop_adapter(priv);
6334 6332
@@ -6385,7 +6383,6 @@ static void __devexit ipw2100_pci_remove_one(struct pci_dev *pci_dev)
6385 /* Unregister the device first - this results in close() 6383 /* Unregister the device first - this results in close()
6386 * being called if the device is open. If we free storage 6384 * being called if the device is open. If we free storage
6387 * first, then close() will crash. */ 6385 * first, then close() will crash. */
6388 unregister_ieee80211(priv->ieee);
6389 unregister_netdev(dev); 6386 unregister_netdev(dev);
6390 6387
6391 /* ipw2100_down will ensure that there is no more pending work 6388 /* ipw2100_down will ensure that there is no more pending work
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 4539e63e978e..61ef8904af97 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -11822,7 +11822,6 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev,
11822 if (err) { 11822 if (err) {
11823 IPW_ERROR("Failed to register promiscuous network " 11823 IPW_ERROR("Failed to register promiscuous network "
11824 "device (error %d).\n", err); 11824 "device (error %d).\n", err);
11825 unregister_ieee80211(priv->ieee);
11826 unregister_netdev(priv->net_dev); 11825 unregister_netdev(priv->net_dev);
11827 goto out_remove_sysfs; 11826 goto out_remove_sysfs;
11828 } 11827 }
@@ -11873,7 +11872,6 @@ static void __devexit ipw_pci_remove(struct pci_dev *pdev)
11873 11872
11874 mutex_unlock(&priv->mutex); 11873 mutex_unlock(&priv->mutex);
11875 11874
11876 unregister_ieee80211(priv->ieee);
11877 unregister_netdev(priv->net_dev); 11875 unregister_netdev(priv->net_dev);
11878 11876
11879 if (priv->rxq) { 11877 if (priv->rxq) {
diff --git a/drivers/net/wireless/ipw2x00/libipw.h b/drivers/net/wireless/ipw2x00/libipw.h
index f42ade6c2d3e..bf45391172f3 100644
--- a/drivers/net/wireless/ipw2x00/libipw.h
+++ b/drivers/net/wireless/ipw2x00/libipw.h
@@ -1020,7 +1020,6 @@ static inline int libipw_is_cck_rate(u8 rate)
1020/* ieee80211.c */ 1020/* ieee80211.c */
1021extern void free_ieee80211(struct net_device *dev, int monitor); 1021extern void free_ieee80211(struct net_device *dev, int monitor);
1022extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor); 1022extern struct net_device *alloc_ieee80211(int sizeof_priv, int monitor);
1023extern void unregister_ieee80211(struct libipw_device *ieee);
1024extern int libipw_change_mtu(struct net_device *dev, int new_mtu); 1023extern int libipw_change_mtu(struct net_device *dev, int new_mtu);
1025 1024
1026extern void libipw_networks_age(struct libipw_device *ieee, 1025extern void libipw_networks_age(struct libipw_device *ieee,
diff --git a/drivers/net/wireless/ipw2x00/libipw_module.c b/drivers/net/wireless/ipw2x00/libipw_module.c
index be5b809ec97a..a0e9f6aed7da 100644
--- a/drivers/net/wireless/ipw2x00/libipw_module.c
+++ b/drivers/net/wireless/ipw2x00/libipw_module.c
@@ -235,19 +235,16 @@ void free_ieee80211(struct net_device *dev, int monitor)
235 libipw_networks_free(ieee); 235 libipw_networks_free(ieee);
236 236
237 /* free cfg80211 resources */ 237 /* free cfg80211 resources */
238 if (!monitor) 238 if (!monitor) {
239 wiphy_unregister(ieee->wdev.wiphy);
240 kfree(ieee->a_band.channels);
241 kfree(ieee->bg_band.channels);
239 wiphy_free(ieee->wdev.wiphy); 242 wiphy_free(ieee->wdev.wiphy);
243 }
240 244
241 free_netdev(dev); 245 free_netdev(dev);
242} 246}
243 247
244void unregister_ieee80211(struct libipw_device *ieee)
245{
246 wiphy_unregister(ieee->wdev.wiphy);
247 kfree(ieee->a_band.channels);
248 kfree(ieee->bg_band.channels);
249}
250
251#ifdef CONFIG_LIBIPW_DEBUG 248#ifdef CONFIG_LIBIPW_DEBUG
252 249
253static int debug = 0; 250static int debug = 0;
@@ -333,4 +330,3 @@ module_init(libipw_init);
333 330
334EXPORT_SYMBOL(alloc_ieee80211); 331EXPORT_SYMBOL(alloc_ieee80211);
335EXPORT_SYMBOL(free_ieee80211); 332EXPORT_SYMBOL(free_ieee80211);
336EXPORT_SYMBOL(unregister_ieee80211);
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 71761b343839..73bbec58341e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -815,6 +815,8 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
815 815
816 mutex_init(&rt2x00dev->csr_mutex); 816 mutex_init(&rt2x00dev->csr_mutex);
817 817
818 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
819
818 /* 820 /*
819 * Make room for rt2x00_intf inside the per-interface 821 * Make room for rt2x00_intf inside the per-interface
820 * structure ieee80211_vif. 822 * structure ieee80211_vif.
@@ -871,8 +873,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
871 rt2x00leds_register(rt2x00dev); 873 rt2x00leds_register(rt2x00dev);
872 rt2x00debug_register(rt2x00dev); 874 rt2x00debug_register(rt2x00dev);
873 875
874 set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
875
876 return 0; 876 return 0;
877 877
878exit: 878exit:
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
index c64db0ba7f40..c708d0be9155 100644
--- a/drivers/net/wireless/rt2x00/rt2x00link.c
+++ b/drivers/net/wireless/rt2x00/rt2x00link.c
@@ -362,8 +362,9 @@ void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
362 362
363 rt2x00link_reset_tuner(rt2x00dev, false); 363 rt2x00link_reset_tuner(rt2x00dev, false);
364 364
365 ieee80211_queue_delayed_work(rt2x00dev->hw, 365 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
366 &link->work, LINK_TUNE_INTERVAL); 366 ieee80211_queue_delayed_work(rt2x00dev->hw,
367 &link->work, LINK_TUNE_INTERVAL);
367} 368}
368 369
369void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev) 370void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev)
@@ -469,8 +470,10 @@ static void rt2x00link_tuner(struct work_struct *work)
469 * Increase tuner counter, and reschedule the next link tuner run. 470 * Increase tuner counter, and reschedule the next link tuner run.
470 */ 471 */
471 link->count++; 472 link->count++;
472 ieee80211_queue_delayed_work(rt2x00dev->hw, 473
473 &link->work, LINK_TUNE_INTERVAL); 474 if (test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
475 ieee80211_queue_delayed_work(rt2x00dev->hw,
476 &link->work, LINK_TUNE_INTERVAL);
474} 477}
475 478
476void rt2x00link_register(struct rt2x00_dev *rt2x00dev) 479void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 501544882c2c..f02b48a90593 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -47,6 +47,8 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev,
47 (requesttype == USB_VENDOR_REQUEST_IN) ? 47 (requesttype == USB_VENDOR_REQUEST_IN) ?
48 usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0); 48 usb_rcvctrlpipe(usb_dev, 0) : usb_sndctrlpipe(usb_dev, 0);
49 49
50 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
51 return -ENODEV;
50 52
51 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 53 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
52 status = usb_control_msg(usb_dev, pipe, request, requesttype, 54 status = usb_control_msg(usb_dev, pipe, request, requesttype,
@@ -60,8 +62,10 @@ int rt2x00usb_vendor_request(struct rt2x00_dev *rt2x00dev,
60 * -ENODEV: Device has disappeared, no point continuing. 62 * -ENODEV: Device has disappeared, no point continuing.
61 * All other errors: Try again. 63 * All other errors: Try again.
62 */ 64 */
63 else if (status == -ENODEV) 65 else if (status == -ENODEV) {
66 clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
64 break; 67 break;
68 }
65 } 69 }
66 70
67 ERROR(rt2x00dev, 71 ERROR(rt2x00dev,
@@ -161,6 +165,9 @@ int rt2x00usb_regbusy_read(struct rt2x00_dev *rt2x00dev,
161{ 165{
162 unsigned int i; 166 unsigned int i;
163 167
168 if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
169 return -ENODEV;
170
164 for (i = 0; i < REGISTER_BUSY_COUNT; i++) { 171 for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
165 rt2x00usb_register_read_lock(rt2x00dev, offset, reg); 172 rt2x00usb_register_read_lock(rt2x00dev, offset, reg);
166 if (!rt2x00_get_field32(*reg, field)) 173 if (!rt2x00_get_field32(*reg, field))
diff --git a/drivers/net/wireless/rtl818x/rtl8187_leds.c b/drivers/net/wireless/rtl818x/rtl8187_leds.c
index a1c670fc1552..cf8a4a40fdf6 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_leds.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_leds.c
@@ -210,10 +210,10 @@ void rtl8187_leds_exit(struct ieee80211_hw *dev)
210 210
211 /* turn the LED off before exiting */ 211 /* turn the LED off before exiting */
212 ieee80211_queue_delayed_work(dev, &priv->led_off, 0); 212 ieee80211_queue_delayed_work(dev, &priv->led_off, 0);
213 cancel_delayed_work_sync(&priv->led_off);
214 cancel_delayed_work_sync(&priv->led_on);
215 rtl8187_unregister_led(&priv->led_rx); 213 rtl8187_unregister_led(&priv->led_rx);
216 rtl8187_unregister_led(&priv->led_tx); 214 rtl8187_unregister_led(&priv->led_tx);
215 cancel_delayed_work_sync(&priv->led_off);
216 cancel_delayed_work_sync(&priv->led_on);
217} 217}
218#endif /* def CONFIG_RTL8187_LED */ 218#endif /* def CONFIG_RTL8187_LED */
219 219