aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-04-29 23:30:35 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-29 23:30:35 -0400
commitaba7453037c3a90714caae77a622dceaf1173786 (patch)
treebf07f9f432b0d8e9db9486f1f32ad065c0aa7c5c /drivers
parenta4fe91ee711f4e955ea85ab05b092cfe384b073e (diff)
parent93af7aca44f0e82e67bda10a0fb73d383edcc8bd (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: Documentation/isdn/00-INDEX drivers/net/wireless/iwlwifi/iwl-scan.c drivers/net/wireless/rndis_wlan.c net/mac80211/main.c
Diffstat (limited to 'drivers')
-rw-r--r--drivers/isdn/capi/kcapi.c171
-rw-r--r--drivers/net/e100.c30
-rw-r--r--drivers/net/forcedeth.c31
-rw-r--r--drivers/net/ixgbe/ixgbe_common.c51
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c10
-rw-r--r--drivers/net/mlx4/en_netdev.c2
-rw-r--r--drivers/net/mlx4/en_rx.c4
-rw-r--r--drivers/net/mv643xx_eth.c24
-rw-r--r--drivers/net/veth.c41
-rw-r--r--drivers/net/wireless/ath/ath5k/debug.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c1
12 files changed, 258 insertions, 114 deletions
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 5360c4fd4739..f33170368cd1 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -270,6 +270,15 @@ static void recv_handler(struct work_struct *work)
270 mutex_unlock(&ap->recv_mtx); 270 mutex_unlock(&ap->recv_mtx);
271} 271}
272 272
273/**
274 * capi_ctr_handle_message() - handle incoming CAPI message
275 * @card: controller descriptor structure.
276 * @appl: application ID.
277 * @skb: message.
278 *
279 * Called by hardware driver to pass a CAPI message to the application.
280 */
281
273void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb) 282void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb)
274{ 283{
275 struct capi20_appl *ap; 284 struct capi20_appl *ap;
@@ -348,6 +357,13 @@ error:
348 357
349EXPORT_SYMBOL(capi_ctr_handle_message); 358EXPORT_SYMBOL(capi_ctr_handle_message);
350 359
360/**
361 * capi_ctr_ready() - signal CAPI controller ready
362 * @card: controller descriptor structure.
363 *
364 * Called by hardware driver to signal that the controller is up and running.
365 */
366
351void capi_ctr_ready(struct capi_ctr * card) 367void capi_ctr_ready(struct capi_ctr * card)
352{ 368{
353 card->cardstate = CARD_RUNNING; 369 card->cardstate = CARD_RUNNING;
@@ -360,6 +376,14 @@ void capi_ctr_ready(struct capi_ctr * card)
360 376
361EXPORT_SYMBOL(capi_ctr_ready); 377EXPORT_SYMBOL(capi_ctr_ready);
362 378
379/**
380 * capi_ctr_reseted() - signal CAPI controller reset
381 * @card: controller descriptor structure.
382 *
383 * Called by hardware driver to signal that the controller is down and
384 * unavailable for use.
385 */
386
363void capi_ctr_reseted(struct capi_ctr * card) 387void capi_ctr_reseted(struct capi_ctr * card)
364{ 388{
365 u16 appl; 389 u16 appl;
@@ -391,6 +415,13 @@ void capi_ctr_reseted(struct capi_ctr * card)
391 415
392EXPORT_SYMBOL(capi_ctr_reseted); 416EXPORT_SYMBOL(capi_ctr_reseted);
393 417
418/**
419 * capi_ctr_suspend_output() - suspend controller
420 * @card: controller descriptor structure.
421 *
422 * Called by hardware driver to stop data flow.
423 */
424
394void capi_ctr_suspend_output(struct capi_ctr *card) 425void capi_ctr_suspend_output(struct capi_ctr *card)
395{ 426{
396 if (!card->blocked) { 427 if (!card->blocked) {
@@ -401,6 +432,13 @@ void capi_ctr_suspend_output(struct capi_ctr *card)
401 432
402EXPORT_SYMBOL(capi_ctr_suspend_output); 433EXPORT_SYMBOL(capi_ctr_suspend_output);
403 434
435/**
436 * capi_ctr_resume_output() - resume controller
437 * @card: controller descriptor structure.
438 *
439 * Called by hardware driver to resume data flow.
440 */
441
404void capi_ctr_resume_output(struct capi_ctr *card) 442void capi_ctr_resume_output(struct capi_ctr *card)
405{ 443{
406 if (card->blocked) { 444 if (card->blocked) {
@@ -413,6 +451,14 @@ EXPORT_SYMBOL(capi_ctr_resume_output);
413 451
414/* ------------------------------------------------------------- */ 452/* ------------------------------------------------------------- */
415 453
454/**
455 * attach_capi_ctr() - register CAPI controller
456 * @card: controller descriptor structure.
457 *
458 * Called by hardware driver to register a controller with the CAPI subsystem.
459 * Return value: 0 on success, error code < 0 on error
460 */
461
416int 462int
417attach_capi_ctr(struct capi_ctr *card) 463attach_capi_ctr(struct capi_ctr *card)
418{ 464{
@@ -459,6 +505,15 @@ attach_capi_ctr(struct capi_ctr *card)
459 505
460EXPORT_SYMBOL(attach_capi_ctr); 506EXPORT_SYMBOL(attach_capi_ctr);
461 507
508/**
509 * detach_capi_ctr() - unregister CAPI controller
510 * @card: controller descriptor structure.
511 *
512 * Called by hardware driver to remove the registration of a controller
513 * with the CAPI subsystem.
514 * Return value: 0 on success, error code < 0 on error
515 */
516
462int detach_capi_ctr(struct capi_ctr *card) 517int detach_capi_ctr(struct capi_ctr *card)
463{ 518{
464 if (card->cardstate != CARD_DETECTED) 519 if (card->cardstate != CARD_DETECTED)
@@ -479,6 +534,13 @@ int detach_capi_ctr(struct capi_ctr *card)
479 534
480EXPORT_SYMBOL(detach_capi_ctr); 535EXPORT_SYMBOL(detach_capi_ctr);
481 536
537/**
538 * register_capi_driver() - register CAPI driver
539 * @driver: driver descriptor structure.
540 *
541 * Called by hardware driver to register itself with the CAPI subsystem.
542 */
543
482void register_capi_driver(struct capi_driver *driver) 544void register_capi_driver(struct capi_driver *driver)
483{ 545{
484 unsigned long flags; 546 unsigned long flags;
@@ -490,6 +552,13 @@ void register_capi_driver(struct capi_driver *driver)
490 552
491EXPORT_SYMBOL(register_capi_driver); 553EXPORT_SYMBOL(register_capi_driver);
492 554
555/**
556 * unregister_capi_driver() - unregister CAPI driver
557 * @driver: driver descriptor structure.
558 *
559 * Called by hardware driver to unregister itself from the CAPI subsystem.
560 */
561
493void unregister_capi_driver(struct capi_driver *driver) 562void unregister_capi_driver(struct capi_driver *driver)
494{ 563{
495 unsigned long flags; 564 unsigned long flags;
@@ -505,6 +574,13 @@ EXPORT_SYMBOL(unregister_capi_driver);
505/* -------- CAPI2.0 Interface ---------------------------------- */ 574/* -------- CAPI2.0 Interface ---------------------------------- */
506/* ------------------------------------------------------------- */ 575/* ------------------------------------------------------------- */
507 576
577/**
578 * capi20_isinstalled() - CAPI 2.0 operation CAPI_INSTALLED
579 *
580 * Return value: CAPI result code (CAPI_NOERROR if at least one ISDN controller
581 * is ready for use, CAPI_REGNOTINSTALLED otherwise)
582 */
583
508u16 capi20_isinstalled(void) 584u16 capi20_isinstalled(void)
509{ 585{
510 int i; 586 int i;
@@ -517,6 +593,18 @@ u16 capi20_isinstalled(void)
517 593
518EXPORT_SYMBOL(capi20_isinstalled); 594EXPORT_SYMBOL(capi20_isinstalled);
519 595
596/**
597 * capi20_register() - CAPI 2.0 operation CAPI_REGISTER
598 * @ap: CAPI application descriptor structure.
599 *
600 * Register an application's presence with CAPI.
601 * A unique application ID is assigned and stored in @ap->applid.
602 * After this function returns successfully, the message receive
603 * callback function @ap->recv_message() may be called at any time
604 * until capi20_release() has been called for the same @ap.
605 * Return value: CAPI result code
606 */
607
520u16 capi20_register(struct capi20_appl *ap) 608u16 capi20_register(struct capi20_appl *ap)
521{ 609{
522 int i; 610 int i;
@@ -571,6 +659,16 @@ u16 capi20_register(struct capi20_appl *ap)
571 659
572EXPORT_SYMBOL(capi20_register); 660EXPORT_SYMBOL(capi20_register);
573 661
662/**
663 * capi20_release() - CAPI 2.0 operation CAPI_RELEASE
664 * @ap: CAPI application descriptor structure.
665 *
666 * Terminate an application's registration with CAPI.
667 * After this function returns successfully, the message receive
668 * callback function @ap->recv_message() will no longer be called.
669 * Return value: CAPI result code
670 */
671
574u16 capi20_release(struct capi20_appl *ap) 672u16 capi20_release(struct capi20_appl *ap)
575{ 673{
576 int i; 674 int i;
@@ -603,6 +701,15 @@ u16 capi20_release(struct capi20_appl *ap)
603 701
604EXPORT_SYMBOL(capi20_release); 702EXPORT_SYMBOL(capi20_release);
605 703
704/**
705 * capi20_put_message() - CAPI 2.0 operation CAPI_PUT_MESSAGE
706 * @ap: CAPI application descriptor structure.
707 * @skb: CAPI message.
708 *
709 * Transfer a single message to CAPI.
710 * Return value: CAPI result code
711 */
712
606u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb) 713u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
607{ 714{
608 struct capi_ctr *card; 715 struct capi_ctr *card;
@@ -668,6 +775,16 @@ u16 capi20_put_message(struct capi20_appl *ap, struct sk_buff *skb)
668 775
669EXPORT_SYMBOL(capi20_put_message); 776EXPORT_SYMBOL(capi20_put_message);
670 777
778/**
779 * capi20_get_manufacturer() - CAPI 2.0 operation CAPI_GET_MANUFACTURER
780 * @contr: controller number.
781 * @buf: result buffer (64 bytes).
782 *
783 * Retrieve information about the manufacturer of the specified ISDN controller
784 * or (for @contr == 0) the driver itself.
785 * Return value: CAPI result code
786 */
787
671u16 capi20_get_manufacturer(u32 contr, u8 *buf) 788u16 capi20_get_manufacturer(u32 contr, u8 *buf)
672{ 789{
673 struct capi_ctr *card; 790 struct capi_ctr *card;
@@ -685,6 +802,16 @@ u16 capi20_get_manufacturer(u32 contr, u8 *buf)
685 802
686EXPORT_SYMBOL(capi20_get_manufacturer); 803EXPORT_SYMBOL(capi20_get_manufacturer);
687 804
805/**
806 * capi20_get_version() - CAPI 2.0 operation CAPI_GET_VERSION
807 * @contr: controller number.
808 * @verp: result structure.
809 *
810 * Retrieve version information for the specified ISDN controller
811 * or (for @contr == 0) the driver itself.
812 * Return value: CAPI result code
813 */
814
688u16 capi20_get_version(u32 contr, struct capi_version *verp) 815u16 capi20_get_version(u32 contr, struct capi_version *verp)
689{ 816{
690 struct capi_ctr *card; 817 struct capi_ctr *card;
@@ -703,6 +830,16 @@ u16 capi20_get_version(u32 contr, struct capi_version *verp)
703 830
704EXPORT_SYMBOL(capi20_get_version); 831EXPORT_SYMBOL(capi20_get_version);
705 832
833/**
834 * capi20_get_serial() - CAPI 2.0 operation CAPI_GET_SERIAL_NUMBER
835 * @contr: controller number.
836 * @serial: result buffer (8 bytes).
837 *
838 * Retrieve the serial number of the specified ISDN controller
839 * or (for @contr == 0) the driver itself.
840 * Return value: CAPI result code
841 */
842
706u16 capi20_get_serial(u32 contr, u8 *serial) 843u16 capi20_get_serial(u32 contr, u8 *serial)
707{ 844{
708 struct capi_ctr *card; 845 struct capi_ctr *card;
@@ -721,6 +858,16 @@ u16 capi20_get_serial(u32 contr, u8 *serial)
721 858
722EXPORT_SYMBOL(capi20_get_serial); 859EXPORT_SYMBOL(capi20_get_serial);
723 860
861/**
862 * capi20_get_profile() - CAPI 2.0 operation CAPI_GET_PROFILE
863 * @contr: controller number.
864 * @profp: result structure.
865 *
866 * Retrieve capability information for the specified ISDN controller
867 * or (for @contr == 0) the number of installed controllers.
868 * Return value: CAPI result code
869 */
870
724u16 capi20_get_profile(u32 contr, struct capi_profile *profp) 871u16 capi20_get_profile(u32 contr, struct capi_profile *profp)
725{ 872{
726 struct capi_ctr *card; 873 struct capi_ctr *card;
@@ -903,6 +1050,15 @@ static int old_capi_manufacturer(unsigned int cmd, void __user *data)
903} 1050}
904#endif 1051#endif
905 1052
1053/**
1054 * capi20_manufacturer() - CAPI 2.0 operation CAPI_MANUFACTURER
1055 * @cmd: command.
1056 * @data: parameter.
1057 *
1058 * Perform manufacturer specific command.
1059 * Return value: CAPI result code
1060 */
1061
906int capi20_manufacturer(unsigned int cmd, void __user *data) 1062int capi20_manufacturer(unsigned int cmd, void __user *data)
907{ 1063{
908 struct capi_ctr *card; 1064 struct capi_ctr *card;
@@ -981,6 +1137,21 @@ int capi20_manufacturer(unsigned int cmd, void __user *data)
981EXPORT_SYMBOL(capi20_manufacturer); 1137EXPORT_SYMBOL(capi20_manufacturer);
982 1138
983/* temporary hack */ 1139/* temporary hack */
1140
1141/**
1142 * capi20_set_callback() - set CAPI application notification callback function
1143 * @ap: CAPI application descriptor structure.
1144 * @callback: callback function (NULL to remove).
1145 *
1146 * If not NULL, the callback function will be called to notify the
1147 * application of the addition or removal of a controller.
1148 * The first argument (cmd) will tell whether the controller was added
1149 * (KCI_CONTRUP) or removed (KCI_CONTRDOWN).
1150 * The second argument (contr) will be the controller number.
1151 * For cmd==KCI_CONTRUP the third argument (data) will be a pointer to the
1152 * new controller's capability profile structure.
1153 */
1154
984void capi20_set_callback(struct capi20_appl *ap, 1155void capi20_set_callback(struct capi20_appl *ap,
985 void (*callback) (unsigned int cmd, __u32 contr, void *data)) 1156 void (*callback) (unsigned int cmd, __u32 contr, void *data))
986{ 1157{
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 5c0b457c7868..0f9ee1348552 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2728,7 +2728,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2728#define E100_82552_SMARTSPEED 0x14 /* SmartSpeed Ctrl register */ 2728#define E100_82552_SMARTSPEED 0x14 /* SmartSpeed Ctrl register */
2729#define E100_82552_REV_ANEG 0x0200 /* Reverse auto-negotiation */ 2729#define E100_82552_REV_ANEG 0x0200 /* Reverse auto-negotiation */
2730#define E100_82552_ANEG_NOW 0x0400 /* Auto-negotiate now */ 2730#define E100_82552_ANEG_NOW 0x0400 /* Auto-negotiate now */
2731static int e100_suspend(struct pci_dev *pdev, pm_message_t state) 2731static void __e100_shutdown(struct pci_dev *pdev, bool *enable_wake)
2732{ 2732{
2733 struct net_device *netdev = pci_get_drvdata(pdev); 2733 struct net_device *netdev = pci_get_drvdata(pdev);
2734 struct nic *nic = netdev_priv(netdev); 2734 struct nic *nic = netdev_priv(netdev);
@@ -2749,19 +2749,32 @@ static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2749 E100_82552_SMARTSPEED, smartspeed | 2749 E100_82552_SMARTSPEED, smartspeed |
2750 E100_82552_REV_ANEG | E100_82552_ANEG_NOW); 2750 E100_82552_REV_ANEG | E100_82552_ANEG_NOW);
2751 } 2751 }
2752 if (pci_enable_wake(pdev, PCI_D3cold, true)) 2752 *enable_wake = true;
2753 pci_enable_wake(pdev, PCI_D3hot, true);
2754 } else { 2753 } else {
2755 pci_enable_wake(pdev, PCI_D3hot, false); 2754 *enable_wake = false;
2756 } 2755 }
2757 2756
2758 pci_disable_device(pdev); 2757 pci_disable_device(pdev);
2759 pci_set_power_state(pdev, PCI_D3hot); 2758}
2760 2759
2761 return 0; 2760static int __e100_power_off(struct pci_dev *pdev, bool wake)
2761{
2762 if (wake) {
2763 return pci_prepare_to_sleep(pdev);
2764 } else {
2765 pci_wake_from_d3(pdev, false);
2766 return pci_set_power_state(pdev, PCI_D3hot);
2767 }
2762} 2768}
2763 2769
2764#ifdef CONFIG_PM 2770#ifdef CONFIG_PM
2771static int e100_suspend(struct pci_dev *pdev, pm_message_t state)
2772{
2773 bool wake;
2774 __e100_shutdown(pdev, &wake);
2775 return __e100_power_off(pdev, wake);
2776}
2777
2765static int e100_resume(struct pci_dev *pdev) 2778static int e100_resume(struct pci_dev *pdev)
2766{ 2779{
2767 struct net_device *netdev = pci_get_drvdata(pdev); 2780 struct net_device *netdev = pci_get_drvdata(pdev);
@@ -2792,7 +2805,10 @@ static int e100_resume(struct pci_dev *pdev)
2792 2805
2793static void e100_shutdown(struct pci_dev *pdev) 2806static void e100_shutdown(struct pci_dev *pdev)
2794{ 2807{
2795 e100_suspend(pdev, PMSG_SUSPEND); 2808 bool wake;
2809 __e100_shutdown(pdev, &wake);
2810 if (system_state == SYSTEM_POWER_OFF)
2811 __e100_power_off(pdev, wake);
2796} 2812}
2797 2813
2798/* ------------------ PCI Error Recovery infrastructure -------------- */ 2814/* ------------------ PCI Error Recovery infrastructure -------------- */
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 11d5db16ed9c..f9a846b1b92f 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -1880,6 +1880,7 @@ static void nv_init_tx(struct net_device *dev)
1880 np->tx_pkts_in_progress = 0; 1880 np->tx_pkts_in_progress = 0;
1881 np->tx_change_owner = NULL; 1881 np->tx_change_owner = NULL;
1882 np->tx_end_flip = NULL; 1882 np->tx_end_flip = NULL;
1883 np->tx_stop = 0;
1883 1884
1884 for (i = 0; i < np->tx_ring_size; i++) { 1885 for (i = 0; i < np->tx_ring_size; i++) {
1885 if (!nv_optimized(np)) { 1886 if (!nv_optimized(np)) {
@@ -2530,6 +2531,8 @@ static void nv_tx_timeout(struct net_device *dev)
2530 struct fe_priv *np = netdev_priv(dev); 2531 struct fe_priv *np = netdev_priv(dev);
2531 u8 __iomem *base = get_hwbase(dev); 2532 u8 __iomem *base = get_hwbase(dev);
2532 u32 status; 2533 u32 status;
2534 union ring_type put_tx;
2535 int saved_tx_limit;
2533 2536
2534 if (np->msi_flags & NV_MSI_X_ENABLED) 2537 if (np->msi_flags & NV_MSI_X_ENABLED)
2535 status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK; 2538 status = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQSTAT_MASK;
@@ -2589,24 +2592,32 @@ static void nv_tx_timeout(struct net_device *dev)
2589 /* 1) stop tx engine */ 2592 /* 1) stop tx engine */
2590 nv_stop_tx(dev); 2593 nv_stop_tx(dev);
2591 2594
2592 /* 2) check that the packets were not sent already: */ 2595 /* 2) complete any outstanding tx and do not give HW any limited tx pkts */
2596 saved_tx_limit = np->tx_limit;
2597 np->tx_limit = 0; /* prevent giving HW any limited pkts */
2598 np->tx_stop = 0; /* prevent waking tx queue */
2593 if (!nv_optimized(np)) 2599 if (!nv_optimized(np))
2594 nv_tx_done(dev, np->tx_ring_size); 2600 nv_tx_done(dev, np->tx_ring_size);
2595 else 2601 else
2596 nv_tx_done_optimized(dev, np->tx_ring_size); 2602 nv_tx_done_optimized(dev, np->tx_ring_size);
2597 2603
2598 /* 3) if there are dead entries: clear everything */ 2604 /* save current HW postion */
2599 if (np->get_tx_ctx != np->put_tx_ctx) { 2605 if (np->tx_change_owner)
2600 printk(KERN_DEBUG "%s: tx_timeout: dead entries!\n", dev->name); 2606 put_tx.ex = np->tx_change_owner->first_tx_desc;
2601 nv_drain_tx(dev); 2607 else
2602 nv_init_tx(dev); 2608 put_tx = np->put_tx;
2603 setup_hw_rings(dev, NV_SETUP_TX_RING);
2604 }
2605 2609
2606 netif_wake_queue(dev); 2610 /* 3) clear all tx state */
2611 nv_drain_tx(dev);
2612 nv_init_tx(dev);
2613
2614 /* 4) restore state to current HW position */
2615 np->get_tx = np->put_tx = put_tx;
2616 np->tx_limit = saved_tx_limit;
2607 2617
2608 /* 4) restart tx engine */ 2618 /* 5) restart tx engine */
2609 nv_start_tx(dev); 2619 nv_start_tx(dev);
2620 netif_wake_queue(dev);
2610 spin_unlock_irq(&np->lock); 2621 spin_unlock_irq(&np->lock);
2611} 2622}
2612 2623
diff --git a/drivers/net/ixgbe/ixgbe_common.c b/drivers/net/ixgbe/ixgbe_common.c
index 5f2ee34e9d1d..60638e267c61 100644
--- a/drivers/net/ixgbe/ixgbe_common.c
+++ b/drivers/net/ixgbe/ixgbe_common.c
@@ -50,7 +50,6 @@ static u16 ixgbe_calc_eeprom_checksum(struct ixgbe_hw *hw);
50static void ixgbe_enable_rar(struct ixgbe_hw *hw, u32 index); 50static void ixgbe_enable_rar(struct ixgbe_hw *hw, u32 index);
51static void ixgbe_disable_rar(struct ixgbe_hw *hw, u32 index); 51static void ixgbe_disable_rar(struct ixgbe_hw *hw, u32 index);
52static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr); 52static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr);
53static void ixgbe_add_mc_addr(struct ixgbe_hw *hw, u8 *mc_addr);
54static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq); 53static void ixgbe_add_uc_addr(struct ixgbe_hw *hw, u8 *addr, u32 vmdq);
55 54
56/** 55/**
@@ -1377,8 +1376,7 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list,
1377 * Clear accounting of old secondary address list, 1376 * Clear accounting of old secondary address list,
1378 * don't count RAR[0] 1377 * don't count RAR[0]
1379 */ 1378 */
1380 uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1379 uc_addr_in_use = hw->addr_ctrl.rar_used_count - 1;
1381 hw->addr_ctrl.mc_addr_in_rar_count - 1;
1382 hw->addr_ctrl.rar_used_count -= uc_addr_in_use; 1380 hw->addr_ctrl.rar_used_count -= uc_addr_in_use;
1383 hw->addr_ctrl.overflow_promisc = 0; 1381 hw->addr_ctrl.overflow_promisc = 0;
1384 1382
@@ -1493,40 +1491,6 @@ static void ixgbe_set_mta(struct ixgbe_hw *hw, u8 *mc_addr)
1493} 1491}
1494 1492
1495/** 1493/**
1496 * ixgbe_add_mc_addr - Adds a multicast address.
1497 * @hw: pointer to hardware structure
1498 * @mc_addr: new multicast address
1499 *
1500 * Adds it to unused receive address register or to the multicast table.
1501 **/
1502static void ixgbe_add_mc_addr(struct ixgbe_hw *hw, u8 *mc_addr)
1503{
1504 u32 rar_entries = hw->mac.num_rar_entries;
1505 u32 rar;
1506
1507 hw_dbg(hw, " MC Addr =%.2X %.2X %.2X %.2X %.2X %.2X\n",
1508 mc_addr[0], mc_addr[1], mc_addr[2],
1509 mc_addr[3], mc_addr[4], mc_addr[5]);
1510
1511 /*
1512 * Place this multicast address in the RAR if there is room,
1513 * else put it in the MTA
1514 */
1515 if (hw->addr_ctrl.rar_used_count < rar_entries) {
1516 /* use RAR from the end up for multicast */
1517 rar = rar_entries - hw->addr_ctrl.mc_addr_in_rar_count - 1;
1518 hw->mac.ops.set_rar(hw, rar, mc_addr, 0, IXGBE_RAH_AV);
1519 hw_dbg(hw, "Added a multicast address to RAR[%d]\n", rar);
1520 hw->addr_ctrl.rar_used_count++;
1521 hw->addr_ctrl.mc_addr_in_rar_count++;
1522 } else {
1523 ixgbe_set_mta(hw, mc_addr);
1524 }
1525
1526 hw_dbg(hw, "ixgbe_add_mc_addr Complete\n");
1527}
1528
1529/**
1530 * ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses 1494 * ixgbe_update_mc_addr_list_generic - Updates MAC list of multicast addresses
1531 * @hw: pointer to hardware structure 1495 * @hw: pointer to hardware structure
1532 * @mc_addr_list: the list of new multicast addresses 1496 * @mc_addr_list: the list of new multicast addresses
@@ -1542,7 +1506,6 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
1542 u32 mc_addr_count, ixgbe_mc_addr_itr next) 1506 u32 mc_addr_count, ixgbe_mc_addr_itr next)
1543{ 1507{
1544 u32 i; 1508 u32 i;
1545 u32 rar_entries = hw->mac.num_rar_entries;
1546 u32 vmdq; 1509 u32 vmdq;
1547 1510
1548 /* 1511 /*
@@ -1550,18 +1513,8 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
1550 * use. 1513 * use.
1551 */ 1514 */
1552 hw->addr_ctrl.num_mc_addrs = mc_addr_count; 1515 hw->addr_ctrl.num_mc_addrs = mc_addr_count;
1553 hw->addr_ctrl.rar_used_count -= hw->addr_ctrl.mc_addr_in_rar_count;
1554 hw->addr_ctrl.mc_addr_in_rar_count = 0;
1555 hw->addr_ctrl.mta_in_use = 0; 1516 hw->addr_ctrl.mta_in_use = 0;
1556 1517
1557 /* Zero out the other receive addresses. */
1558 hw_dbg(hw, "Clearing RAR[%d-%d]\n", hw->addr_ctrl.rar_used_count,
1559 rar_entries - 1);
1560 for (i = hw->addr_ctrl.rar_used_count; i < rar_entries; i++) {
1561 IXGBE_WRITE_REG(hw, IXGBE_RAL(i), 0);
1562 IXGBE_WRITE_REG(hw, IXGBE_RAH(i), 0);
1563 }
1564
1565 /* Clear the MTA */ 1518 /* Clear the MTA */
1566 hw_dbg(hw, " Clearing MTA\n"); 1519 hw_dbg(hw, " Clearing MTA\n");
1567 for (i = 0; i < hw->mac.mcft_size; i++) 1520 for (i = 0; i < hw->mac.mcft_size; i++)
@@ -1570,7 +1523,7 @@ s32 ixgbe_update_mc_addr_list_generic(struct ixgbe_hw *hw, u8 *mc_addr_list,
1570 /* Add the new addresses */ 1523 /* Add the new addresses */
1571 for (i = 0; i < mc_addr_count; i++) { 1524 for (i = 0; i < mc_addr_count; i++) {
1572 hw_dbg(hw, " Adding the multicast addresses:\n"); 1525 hw_dbg(hw, " Adding the multicast addresses:\n");
1573 ixgbe_add_mc_addr(hw, next(hw, &mc_addr_list, &vmdq)); 1526 ixgbe_set_mta(hw, next(hw, &mc_addr_list, &vmdq));
1574 } 1527 }
1575 1528
1576 /* Enable mta */ 1529 /* Enable mta */
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 661bed64407f..be5eabce9e35 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -3749,6 +3749,8 @@ static int ixgbe_resume(struct pci_dev *pdev)
3749 3749
3750 ixgbe_reset(adapter); 3750 ixgbe_reset(adapter);
3751 3751
3752 IXGBE_WRITE_REG(&adapter->hw, IXGBE_WUS, ~0);
3753
3752 if (netif_running(netdev)) { 3754 if (netif_running(netdev)) {
3753 err = ixgbe_open(adapter->netdev); 3755 err = ixgbe_open(adapter->netdev);
3754 if (err) 3756 if (err)
@@ -4735,7 +4737,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4735 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data]; 4737 const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data];
4736 static int cards_found; 4738 static int cards_found;
4737 int i, err, pci_using_dac; 4739 int i, err, pci_using_dac;
4738 u16 pm_value = 0;
4739 u32 part_num, eec; 4740 u32 part_num, eec;
4740 4741
4741 err = pci_enable_device(pdev); 4742 err = pci_enable_device(pdev);
@@ -4940,11 +4941,8 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
4940 4941
4941 switch (pdev->device) { 4942 switch (pdev->device) {
4942 case IXGBE_DEV_ID_82599_KX4: 4943 case IXGBE_DEV_ID_82599_KX4:
4943#define IXGBE_PCIE_PMCSR 0x44 4944 adapter->wol = (IXGBE_WUFC_MAG | IXGBE_WUFC_EX |
4944 adapter->wol = IXGBE_WUFC_MAG; 4945 IXGBE_WUFC_MC | IXGBE_WUFC_BC);
4945 pci_read_config_word(pdev, IXGBE_PCIE_PMCSR, &pm_value);
4946 pci_write_config_word(pdev, IXGBE_PCIE_PMCSR,
4947 (pm_value | (1 << 8)));
4948 break; 4946 break;
4949 default: 4947 default:
4950 adapter->wol = 0; 4948 adapter->wol = 0;
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index 438678ab2a10..7bcc49de1637 100644
--- a/drivers/net/mlx4/en_netdev.c
+++ b/drivers/net/mlx4/en_netdev.c
@@ -583,7 +583,7 @@ int mlx4_en_start_port(struct net_device *dev)
583 err = mlx4_en_activate_cq(priv, cq); 583 err = mlx4_en_activate_cq(priv, cq);
584 if (err) { 584 if (err) {
585 mlx4_err(mdev, "Failed activating Rx CQ\n"); 585 mlx4_err(mdev, "Failed activating Rx CQ\n");
586 goto rx_err; 586 goto cq_err;
587 } 587 }
588 for (j = 0; j < cq->size; j++) 588 for (j = 0; j < cq->size; j++)
589 cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK; 589 cq->buf[j].owner_sr_opcode = MLX4_CQE_OWNER_MASK;
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index 0cbb78ca7b29..7942c4d3cd88 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -610,6 +610,10 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
610 used_frags = mlx4_en_complete_rx_desc(priv, rx_desc, skb_frags, 610 used_frags = mlx4_en_complete_rx_desc(priv, rx_desc, skb_frags,
611 skb_shinfo(skb)->frags, 611 skb_shinfo(skb)->frags,
612 page_alloc, length); 612 page_alloc, length);
613 if (unlikely(!used_frags)) {
614 kfree_skb(skb);
615 return NULL;
616 }
613 skb_shinfo(skb)->nr_frags = used_frags; 617 skb_shinfo(skb)->nr_frags = used_frags;
614 618
615 /* Copy headers into the skb linear buffer */ 619 /* Copy headers into the skb linear buffer */
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index b3185bf2c158..a400d7115f78 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -393,12 +393,12 @@ struct mv643xx_eth_private {
393 struct work_struct tx_timeout_task; 393 struct work_struct tx_timeout_task;
394 394
395 struct napi_struct napi; 395 struct napi_struct napi;
396 u8 oom;
396 u8 work_link; 397 u8 work_link;
397 u8 work_tx; 398 u8 work_tx;
398 u8 work_tx_end; 399 u8 work_tx_end;
399 u8 work_rx; 400 u8 work_rx;
400 u8 work_rx_refill; 401 u8 work_rx_refill;
401 u8 work_rx_oom;
402 402
403 int skb_size; 403 int skb_size;
404 struct sk_buff_head rx_recycle; 404 struct sk_buff_head rx_recycle;
@@ -661,7 +661,7 @@ static int rxq_refill(struct rx_queue *rxq, int budget)
661 dma_get_cache_alignment() - 1); 661 dma_get_cache_alignment() - 1);
662 662
663 if (skb == NULL) { 663 if (skb == NULL) {
664 mp->work_rx_oom |= 1 << rxq->index; 664 mp->oom = 1;
665 goto oom; 665 goto oom;
666 } 666 }
667 667
@@ -1255,7 +1255,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1255 1255
1256 spin_lock_bh(&mp->mib_counters_lock); 1256 spin_lock_bh(&mp->mib_counters_lock);
1257 p->good_octets_received += mib_read(mp, 0x00); 1257 p->good_octets_received += mib_read(mp, 0x00);
1258 p->good_octets_received += (u64)mib_read(mp, 0x04) << 32;
1259 p->bad_octets_received += mib_read(mp, 0x08); 1258 p->bad_octets_received += mib_read(mp, 0x08);
1260 p->internal_mac_transmit_err += mib_read(mp, 0x0c); 1259 p->internal_mac_transmit_err += mib_read(mp, 0x0c);
1261 p->good_frames_received += mib_read(mp, 0x10); 1260 p->good_frames_received += mib_read(mp, 0x10);
@@ -1269,7 +1268,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
1269 p->frames_512_to_1023_octets += mib_read(mp, 0x30); 1268 p->frames_512_to_1023_octets += mib_read(mp, 0x30);
1270 p->frames_1024_to_max_octets += mib_read(mp, 0x34); 1269 p->frames_1024_to_max_octets += mib_read(mp, 0x34);
1271 p->good_octets_sent += mib_read(mp, 0x38); 1270 p->good_octets_sent += mib_read(mp, 0x38);
1272 p->good_octets_sent += (u64)mib_read(mp, 0x3c) << 32;
1273 p->good_frames_sent += mib_read(mp, 0x40); 1271 p->good_frames_sent += mib_read(mp, 0x40);
1274 p->excessive_collision += mib_read(mp, 0x44); 1272 p->excessive_collision += mib_read(mp, 0x44);
1275 p->multicast_frames_sent += mib_read(mp, 0x48); 1273 p->multicast_frames_sent += mib_read(mp, 0x48);
@@ -2167,8 +2165,10 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2167 2165
2168 mp = container_of(napi, struct mv643xx_eth_private, napi); 2166 mp = container_of(napi, struct mv643xx_eth_private, napi);
2169 2167
2170 mp->work_rx_refill |= mp->work_rx_oom; 2168 if (unlikely(mp->oom)) {
2171 mp->work_rx_oom = 0; 2169 mp->oom = 0;
2170 del_timer(&mp->rx_oom);
2171 }
2172 2172
2173 work_done = 0; 2173 work_done = 0;
2174 while (work_done < budget) { 2174 while (work_done < budget) {
@@ -2182,8 +2182,10 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2182 continue; 2182 continue;
2183 } 2183 }
2184 2184
2185 queue_mask = mp->work_tx | mp->work_tx_end | 2185 queue_mask = mp->work_tx | mp->work_tx_end | mp->work_rx;
2186 mp->work_rx | mp->work_rx_refill; 2186 if (likely(!mp->oom))
2187 queue_mask |= mp->work_rx_refill;
2188
2187 if (!queue_mask) { 2189 if (!queue_mask) {
2188 if (mv643xx_eth_collect_events(mp)) 2190 if (mv643xx_eth_collect_events(mp))
2189 continue; 2191 continue;
@@ -2204,7 +2206,7 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2204 txq_maybe_wake(mp->txq + queue); 2206 txq_maybe_wake(mp->txq + queue);
2205 } else if (mp->work_rx & queue_mask) { 2207 } else if (mp->work_rx & queue_mask) {
2206 work_done += rxq_process(mp->rxq + queue, work_tbd); 2208 work_done += rxq_process(mp->rxq + queue, work_tbd);
2207 } else if (mp->work_rx_refill & queue_mask) { 2209 } else if (!mp->oom && (mp->work_rx_refill & queue_mask)) {
2208 work_done += rxq_refill(mp->rxq + queue, work_tbd); 2210 work_done += rxq_refill(mp->rxq + queue, work_tbd);
2209 } else { 2211 } else {
2210 BUG(); 2212 BUG();
@@ -2212,7 +2214,7 @@ static int mv643xx_eth_poll(struct napi_struct *napi, int budget)
2212 } 2214 }
2213 2215
2214 if (work_done < budget) { 2216 if (work_done < budget) {
2215 if (mp->work_rx_oom) 2217 if (mp->oom)
2216 mod_timer(&mp->rx_oom, jiffies + (HZ / 10)); 2218 mod_timer(&mp->rx_oom, jiffies + (HZ / 10));
2217 napi_complete(napi); 2219 napi_complete(napi);
2218 wrlp(mp, INT_MASK, INT_TX_END | INT_RX | INT_EXT); 2220 wrlp(mp, INT_MASK, INT_TX_END | INT_RX | INT_EXT);
@@ -2372,7 +2374,7 @@ static int mv643xx_eth_open(struct net_device *dev)
2372 rxq_refill(mp->rxq + i, INT_MAX); 2374 rxq_refill(mp->rxq + i, INT_MAX);
2373 } 2375 }
2374 2376
2375 if (mp->work_rx_oom) { 2377 if (mp->oom) {
2376 mp->rx_oom.expires = jiffies + (HZ / 10); 2378 mp->rx_oom.expires = jiffies + (HZ / 10);
2377 add_timer(&mp->rx_oom); 2379 add_timer(&mp->rx_oom);
2378 } 2380 }
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 015db1cece72..8e56fcf0a0e3 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -210,14 +210,11 @@ rx_drop:
210 210
211static struct net_device_stats *veth_get_stats(struct net_device *dev) 211static struct net_device_stats *veth_get_stats(struct net_device *dev)
212{ 212{
213 struct veth_priv *priv; 213 struct veth_priv *priv = netdev_priv(dev);
214 struct net_device_stats *dev_stats; 214 struct net_device_stats *dev_stats = &dev->stats;
215 int cpu; 215 unsigned int cpu;
216 struct veth_net_stats *stats; 216 struct veth_net_stats *stats;
217 217
218 priv = netdev_priv(dev);
219 dev_stats = &dev->stats;
220
221 dev_stats->rx_packets = 0; 218 dev_stats->rx_packets = 0;
222 dev_stats->tx_packets = 0; 219 dev_stats->tx_packets = 0;
223 dev_stats->rx_bytes = 0; 220 dev_stats->rx_bytes = 0;
@@ -225,16 +222,17 @@ static struct net_device_stats *veth_get_stats(struct net_device *dev)
225 dev_stats->tx_dropped = 0; 222 dev_stats->tx_dropped = 0;
226 dev_stats->rx_dropped = 0; 223 dev_stats->rx_dropped = 0;
227 224
228 for_each_online_cpu(cpu) { 225 if (priv->stats)
229 stats = per_cpu_ptr(priv->stats, cpu); 226 for_each_online_cpu(cpu) {
227 stats = per_cpu_ptr(priv->stats, cpu);
230 228
231 dev_stats->rx_packets += stats->rx_packets; 229 dev_stats->rx_packets += stats->rx_packets;
232 dev_stats->tx_packets += stats->tx_packets; 230 dev_stats->tx_packets += stats->tx_packets;
233 dev_stats->rx_bytes += stats->rx_bytes; 231 dev_stats->rx_bytes += stats->rx_bytes;
234 dev_stats->tx_bytes += stats->tx_bytes; 232 dev_stats->tx_bytes += stats->tx_bytes;
235 dev_stats->tx_dropped += stats->tx_dropped; 233 dev_stats->tx_dropped += stats->tx_dropped;
236 dev_stats->rx_dropped += stats->rx_dropped; 234 dev_stats->rx_dropped += stats->rx_dropped;
237 } 235 }
238 236
239 return dev_stats; 237 return dev_stats;
240} 238}
@@ -261,6 +259,8 @@ static int veth_close(struct net_device *dev)
261 netif_carrier_off(dev); 259 netif_carrier_off(dev);
262 netif_carrier_off(priv->peer); 260 netif_carrier_off(priv->peer);
263 261
262 free_percpu(priv->stats);
263 priv->stats = NULL;
264 return 0; 264 return 0;
265} 265}
266 266
@@ -291,15 +291,6 @@ static int veth_dev_init(struct net_device *dev)
291 return 0; 291 return 0;
292} 292}
293 293
294static void veth_dev_free(struct net_device *dev)
295{
296 struct veth_priv *priv;
297
298 priv = netdev_priv(dev);
299 free_percpu(priv->stats);
300 free_netdev(dev);
301}
302
303static const struct net_device_ops veth_netdev_ops = { 294static const struct net_device_ops veth_netdev_ops = {
304 .ndo_init = veth_dev_init, 295 .ndo_init = veth_dev_init,
305 .ndo_open = veth_open, 296 .ndo_open = veth_open,
@@ -317,7 +308,7 @@ static void veth_setup(struct net_device *dev)
317 dev->netdev_ops = &veth_netdev_ops; 308 dev->netdev_ops = &veth_netdev_ops;
318 dev->ethtool_ops = &veth_ethtool_ops; 309 dev->ethtool_ops = &veth_ethtool_ops;
319 dev->features |= NETIF_F_LLTX; 310 dev->features |= NETIF_F_LLTX;
320 dev->destructor = veth_dev_free; 311 dev->destructor = free_netdev;
321} 312}
322 313
323/* 314/*
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
index 9770bb3d40f9..4904a07e4b59 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -424,7 +424,7 @@ ath5k_debug_dump_bands(struct ath5k_softc *sc)
424 424
425 for (b = 0; b < IEEE80211_NUM_BANDS; b++) { 425 for (b = 0; b < IEEE80211_NUM_BANDS; b++) {
426 struct ieee80211_supported_band *band = &sc->sbands[b]; 426 struct ieee80211_supported_band *band = &sc->sbands[b];
427 char bname[5]; 427 char bname[6];
428 switch (band->band) { 428 switch (band->band) {
429 case IEEE80211_BAND_2GHZ: 429 case IEEE80211_BAND_2GHZ:
430 strcpy(bname, "2 GHz"); 430 strcpy(bname, "2 GHz");
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 799f5eb61ece..dd8766b80b34 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -814,12 +814,11 @@ void iwl_bg_scan_completed(struct work_struct *work)
814 814
815 IWL_DEBUG_SCAN(priv, "SCAN complete scan\n"); 815 IWL_DEBUG_SCAN(priv, "SCAN complete scan\n");
816 816
817 ieee80211_scan_completed(priv->hw, false);
818
817 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 819 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
818 return; 820 return;
819 821
820 priv->scan_request = NULL;
821 ieee80211_scan_completed(priv->hw, false);
822
823 /* Since setting the TXPOWER may have been deferred while 822 /* Since setting the TXPOWER may have been deferred while
824 * performing the scan, fire one off */ 823 * performing the scan, fire one off */
825 mutex_lock(&priv->mutex); 824 mutex_lock(&priv->mutex);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 84feeb70fea4..a782292ed435 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1412,7 +1412,6 @@ void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
1412 rxq->free_count = 0; 1412 rxq->free_count = 0;
1413 spin_unlock_irqrestore(&rxq->lock, flags); 1413 spin_unlock_irqrestore(&rxq->lock, flags);
1414} 1414}
1415EXPORT_SYMBOL(iwl3945_rx_queue_reset);
1416 1415
1417/* 1416/*
1418 * this should be called while priv->lock is locked 1417 * this should be called while priv->lock is locked