aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x.h2
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c9
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c20
-rw-r--r--drivers/net/ethernet/brocade/bna/bfa_ioc.c4
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad.c4
-rw-r--r--drivers/net/ethernet/brocade/bna/cna_fwimg.c7
-rw-r--r--drivers/net/ethernet/sfc/rx.c42
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-nvm-parse.c2
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/internal.h6
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c4
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c23
-rw-r--r--drivers/net/xen-netback/netback.c2
-rw-r--r--drivers/net/xen-netback/xenbus.c33
14 files changed, 94 insertions, 76 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
index a3b0f7a0c61e..1f82a04ce01a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
@@ -1774,7 +1774,7 @@ struct bnx2x {
1774 int stats_state; 1774 int stats_state;
1775 1775
1776 /* used for synchronization of concurrent threads statistics handling */ 1776 /* used for synchronization of concurrent threads statistics handling */
1777 struct mutex stats_lock; 1777 struct semaphore stats_lock;
1778 1778
1779 /* used by dmae command loader */ 1779 /* used by dmae command loader */
1780 struct dmae_command stats_dmae; 1780 struct dmae_command stats_dmae;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index fd52ce95127e..33501bcddc48 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -12054,7 +12054,7 @@ static int bnx2x_init_bp(struct bnx2x *bp)
12054 mutex_init(&bp->port.phy_mutex); 12054 mutex_init(&bp->port.phy_mutex);
12055 mutex_init(&bp->fw_mb_mutex); 12055 mutex_init(&bp->fw_mb_mutex);
12056 mutex_init(&bp->drv_info_mutex); 12056 mutex_init(&bp->drv_info_mutex);
12057 mutex_init(&bp->stats_lock); 12057 sema_init(&bp->stats_lock, 1);
12058 bp->drv_info_mng_owner = false; 12058 bp->drv_info_mng_owner = false;
12059 12059
12060 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); 12060 INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task);
@@ -13690,9 +13690,10 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
13690 cancel_delayed_work_sync(&bp->sp_task); 13690 cancel_delayed_work_sync(&bp->sp_task);
13691 cancel_delayed_work_sync(&bp->period_task); 13691 cancel_delayed_work_sync(&bp->period_task);
13692 13692
13693 mutex_lock(&bp->stats_lock); 13693 if (!down_timeout(&bp->stats_lock, HZ / 10)) {
13694 bp->stats_state = STATS_STATE_DISABLED; 13694 bp->stats_state = STATS_STATE_DISABLED;
13695 mutex_unlock(&bp->stats_lock); 13695 up(&bp->stats_lock);
13696 }
13696 13697
13697 bnx2x_save_statistics(bp); 13698 bnx2x_save_statistics(bp);
13698 13699
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
index 266b055c2360..69d699f0730a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c
@@ -1372,19 +1372,23 @@ void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event)
1372 * that context in case someone is in the middle of a transition. 1372 * that context in case someone is in the middle of a transition.
1373 * For other events, wait a bit until lock is taken. 1373 * For other events, wait a bit until lock is taken.
1374 */ 1374 */
1375 if (!mutex_trylock(&bp->stats_lock)) { 1375 if (down_trylock(&bp->stats_lock)) {
1376 if (event == STATS_EVENT_UPDATE) 1376 if (event == STATS_EVENT_UPDATE)
1377 return; 1377 return;
1378 1378
1379 DP(BNX2X_MSG_STATS, 1379 DP(BNX2X_MSG_STATS,
1380 "Unlikely stats' lock contention [event %d]\n", event); 1380 "Unlikely stats' lock contention [event %d]\n", event);
1381 mutex_lock(&bp->stats_lock); 1381 if (unlikely(down_timeout(&bp->stats_lock, HZ / 10))) {
1382 BNX2X_ERR("Failed to take stats lock [event %d]\n",
1383 event);
1384 return;
1385 }
1382 } 1386 }
1383 1387
1384 bnx2x_stats_stm[state][event].action(bp); 1388 bnx2x_stats_stm[state][event].action(bp);
1385 bp->stats_state = bnx2x_stats_stm[state][event].next_state; 1389 bp->stats_state = bnx2x_stats_stm[state][event].next_state;
1386 1390
1387 mutex_unlock(&bp->stats_lock); 1391 up(&bp->stats_lock);
1388 1392
1389 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) 1393 if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp))
1390 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", 1394 DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n",
@@ -1970,7 +1974,11 @@ int bnx2x_stats_safe_exec(struct bnx2x *bp,
1970 /* Wait for statistics to end [while blocking further requests], 1974 /* Wait for statistics to end [while blocking further requests],
1971 * then run supplied function 'safely'. 1975 * then run supplied function 'safely'.
1972 */ 1976 */
1973 mutex_lock(&bp->stats_lock); 1977 rc = down_timeout(&bp->stats_lock, HZ / 10);
1978 if (unlikely(rc)) {
1979 BNX2X_ERR("Failed to take statistics lock for safe execution\n");
1980 goto out_no_lock;
1981 }
1974 1982
1975 bnx2x_stats_comp(bp); 1983 bnx2x_stats_comp(bp);
1976 while (bp->stats_pending && cnt--) 1984 while (bp->stats_pending && cnt--)
@@ -1988,7 +1996,7 @@ out:
1988 /* No need to restart statistics - if they're enabled, the timer 1996 /* No need to restart statistics - if they're enabled, the timer
1989 * will restart the statistics. 1997 * will restart the statistics.
1990 */ 1998 */
1991 mutex_unlock(&bp->stats_lock); 1999 up(&bp->stats_lock);
1992 2000out_no_lock:
1993 return rc; 2001 return rc;
1994} 2002}
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.c b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
index 594a2ab36d31..68f3c13c9ef6 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_ioc.c
+++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.c
@@ -2414,7 +2414,7 @@ bfa_ioc_boot(struct bfa_ioc *ioc, enum bfi_fwboot_type boot_type,
2414 if (status == BFA_STATUS_OK) 2414 if (status == BFA_STATUS_OK)
2415 bfa_ioc_lpu_start(ioc); 2415 bfa_ioc_lpu_start(ioc);
2416 else 2416 else
2417 bfa_nw_iocpf_timeout(ioc); 2417 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT);
2418 2418
2419 return status; 2419 return status;
2420} 2420}
@@ -3029,7 +3029,7 @@ bfa_ioc_poll_fwinit(struct bfa_ioc *ioc)
3029 } 3029 }
3030 3030
3031 if (ioc->iocpf.poll_time >= BFA_IOC_TOV) { 3031 if (ioc->iocpf.poll_time >= BFA_IOC_TOV) {
3032 bfa_nw_iocpf_timeout(ioc); 3032 bfa_fsm_send_event(&ioc->iocpf, IOCPF_E_TIMEOUT);
3033 } else { 3033 } else {
3034 ioc->iocpf.poll_time += BFA_IOC_POLL_TOV; 3034 ioc->iocpf.poll_time += BFA_IOC_POLL_TOV;
3035 mod_timer(&ioc->iocpf_timer, jiffies + 3035 mod_timer(&ioc->iocpf_timer, jiffies +
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c
index 37072a83f9d6..caae6cb2bc1a 100644
--- a/drivers/net/ethernet/brocade/bna/bnad.c
+++ b/drivers/net/ethernet/brocade/bna/bnad.c
@@ -3701,10 +3701,6 @@ bnad_pci_probe(struct pci_dev *pdev,
3701 setup_timer(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout, 3701 setup_timer(&bnad->bna.ioceth.ioc.sem_timer, bnad_iocpf_sem_timeout,
3702 ((unsigned long)bnad)); 3702 ((unsigned long)bnad));
3703 3703
3704 /* Now start the timer before calling IOC */
3705 mod_timer(&bnad->bna.ioceth.ioc.iocpf_timer,
3706 jiffies + msecs_to_jiffies(BNA_IOC_TIMER_FREQ));
3707
3708 /* 3704 /*
3709 * Start the chip 3705 * Start the chip
3710 * If the call back comes with error, we bail out. 3706 * If the call back comes with error, we bail out.
diff --git a/drivers/net/ethernet/brocade/bna/cna_fwimg.c b/drivers/net/ethernet/brocade/bna/cna_fwimg.c
index ebf462d8082f..badea368bdc8 100644
--- a/drivers/net/ethernet/brocade/bna/cna_fwimg.c
+++ b/drivers/net/ethernet/brocade/bna/cna_fwimg.c
@@ -30,6 +30,7 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
30 u32 *bfi_image_size, char *fw_name) 30 u32 *bfi_image_size, char *fw_name)
31{ 31{
32 const struct firmware *fw; 32 const struct firmware *fw;
33 u32 n;
33 34
34 if (request_firmware(&fw, fw_name, &pdev->dev)) { 35 if (request_firmware(&fw, fw_name, &pdev->dev)) {
35 pr_alert("Can't locate firmware %s\n", fw_name); 36 pr_alert("Can't locate firmware %s\n", fw_name);
@@ -40,6 +41,12 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
40 *bfi_image_size = fw->size/sizeof(u32); 41 *bfi_image_size = fw->size/sizeof(u32);
41 bfi_fw = fw; 42 bfi_fw = fw;
42 43
44 /* Convert loaded firmware to host order as it is stored in file
45 * as sequence of LE32 integers.
46 */
47 for (n = 0; n < *bfi_image_size; n++)
48 le32_to_cpus(*bfi_image + n);
49
43 return *bfi_image; 50 return *bfi_image;
44error: 51error:
45 return NULL; 52 return NULL;
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index c0ad95d2f63d..809ea4610a77 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -224,12 +224,17 @@ static void efx_unmap_rx_buffer(struct efx_nic *efx,
224 } 224 }
225} 225}
226 226
227static void efx_free_rx_buffer(struct efx_rx_buffer *rx_buf) 227static void efx_free_rx_buffers(struct efx_rx_queue *rx_queue,
228 struct efx_rx_buffer *rx_buf,
229 unsigned int num_bufs)
228{ 230{
229 if (rx_buf->page) { 231 do {
230 put_page(rx_buf->page); 232 if (rx_buf->page) {
231 rx_buf->page = NULL; 233 put_page(rx_buf->page);
232 } 234 rx_buf->page = NULL;
235 }
236 rx_buf = efx_rx_buf_next(rx_queue, rx_buf);
237 } while (--num_bufs);
233} 238}
234 239
235/* Attempt to recycle the page if there is an RX recycle ring; the page can 240/* Attempt to recycle the page if there is an RX recycle ring; the page can
@@ -278,7 +283,7 @@ static void efx_fini_rx_buffer(struct efx_rx_queue *rx_queue,
278 /* If this is the last buffer in a page, unmap and free it. */ 283 /* If this is the last buffer in a page, unmap and free it. */
279 if (rx_buf->flags & EFX_RX_BUF_LAST_IN_PAGE) { 284 if (rx_buf->flags & EFX_RX_BUF_LAST_IN_PAGE) {
280 efx_unmap_rx_buffer(rx_queue->efx, rx_buf); 285 efx_unmap_rx_buffer(rx_queue->efx, rx_buf);
281 efx_free_rx_buffer(rx_buf); 286 efx_free_rx_buffers(rx_queue, rx_buf, 1);
282 } 287 }
283 rx_buf->page = NULL; 288 rx_buf->page = NULL;
284} 289}
@@ -304,10 +309,7 @@ static void efx_discard_rx_packet(struct efx_channel *channel,
304 309
305 efx_recycle_rx_pages(channel, rx_buf, n_frags); 310 efx_recycle_rx_pages(channel, rx_buf, n_frags);
306 311
307 do { 312 efx_free_rx_buffers(rx_queue, rx_buf, n_frags);
308 efx_free_rx_buffer(rx_buf);
309 rx_buf = efx_rx_buf_next(rx_queue, rx_buf);
310 } while (--n_frags);
311} 313}
312 314
313/** 315/**
@@ -431,11 +433,10 @@ efx_rx_packet_gro(struct efx_channel *channel, struct efx_rx_buffer *rx_buf,
431 433
432 skb = napi_get_frags(napi); 434 skb = napi_get_frags(napi);
433 if (unlikely(!skb)) { 435 if (unlikely(!skb)) {
434 while (n_frags--) { 436 struct efx_rx_queue *rx_queue;
435 put_page(rx_buf->page); 437
436 rx_buf->page = NULL; 438 rx_queue = efx_channel_get_rx_queue(channel);
437 rx_buf = efx_rx_buf_next(&channel->rx_queue, rx_buf); 439 efx_free_rx_buffers(rx_queue, rx_buf, n_frags);
438 }
439 return; 440 return;
440 } 441 }
441 442
@@ -622,7 +623,10 @@ static void efx_rx_deliver(struct efx_channel *channel, u8 *eh,
622 623
623 skb = efx_rx_mk_skb(channel, rx_buf, n_frags, eh, hdr_len); 624 skb = efx_rx_mk_skb(channel, rx_buf, n_frags, eh, hdr_len);
624 if (unlikely(skb == NULL)) { 625 if (unlikely(skb == NULL)) {
625 efx_free_rx_buffer(rx_buf); 626 struct efx_rx_queue *rx_queue;
627
628 rx_queue = efx_channel_get_rx_queue(channel);
629 efx_free_rx_buffers(rx_queue, rx_buf, n_frags);
626 return; 630 return;
627 } 631 }
628 skb_record_rx_queue(skb, channel->rx_queue.core_index); 632 skb_record_rx_queue(skb, channel->rx_queue.core_index);
@@ -661,8 +665,12 @@ void __efx_rx_packet(struct efx_channel *channel)
661 * loopback layer, and free the rx_buf here 665 * loopback layer, and free the rx_buf here
662 */ 666 */
663 if (unlikely(efx->loopback_selftest)) { 667 if (unlikely(efx->loopback_selftest)) {
668 struct efx_rx_queue *rx_queue;
669
664 efx_loopback_rx_packet(efx, eh, rx_buf->len); 670 efx_loopback_rx_packet(efx, eh, rx_buf->len);
665 efx_free_rx_buffer(rx_buf); 671 rx_queue = efx_channel_get_rx_queue(channel);
672 efx_free_rx_buffers(rx_queue, rx_buf,
673 channel->rx_pkt_n_frags);
666 goto out; 674 goto out;
667 } 675 }
668 676
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
index 4ec9811f49c8..65efb1468988 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.c
@@ -511,11 +511,9 @@ static int brcmf_msgbuf_query_dcmd(struct brcmf_pub *drvr, int ifidx,
511 msgbuf->rx_pktids, 511 msgbuf->rx_pktids,
512 msgbuf->ioctl_resp_pktid); 512 msgbuf->ioctl_resp_pktid);
513 if (msgbuf->ioctl_resp_ret_len != 0) { 513 if (msgbuf->ioctl_resp_ret_len != 0) {
514 if (!skb) { 514 if (!skb)
515 brcmf_err("Invalid packet id idx recv'd %d\n",
516 msgbuf->ioctl_resp_pktid);
517 return -EBADF; 515 return -EBADF;
518 } 516
519 memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ? 517 memcpy(buf, skb->data, (len < msgbuf->ioctl_resp_ret_len) ?
520 len : msgbuf->ioctl_resp_ret_len); 518 len : msgbuf->ioctl_resp_ret_len);
521 } 519 }
@@ -874,10 +872,8 @@ brcmf_msgbuf_process_txstatus(struct brcmf_msgbuf *msgbuf, void *buf)
874 flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS; 872 flowid -= BRCMF_NROF_H2D_COMMON_MSGRINGS;
875 skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, 873 skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
876 msgbuf->tx_pktids, idx); 874 msgbuf->tx_pktids, idx);
877 if (!skb) { 875 if (!skb)
878 brcmf_err("Invalid packet id idx recv'd %d\n", idx);
879 return; 876 return;
880 }
881 877
882 set_bit(flowid, msgbuf->txstatus_done_map); 878 set_bit(flowid, msgbuf->txstatus_done_map);
883 commonring = msgbuf->flowrings[flowid]; 879 commonring = msgbuf->flowrings[flowid];
@@ -1156,6 +1152,8 @@ brcmf_msgbuf_process_rx_complete(struct brcmf_msgbuf *msgbuf, void *buf)
1156 1152
1157 skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev, 1153 skb = brcmf_msgbuf_get_pktid(msgbuf->drvr->bus_if->dev,
1158 msgbuf->rx_pktids, idx); 1154 msgbuf->rx_pktids, idx);
1155 if (!skb)
1156 return;
1159 1157
1160 if (data_offset) 1158 if (data_offset)
1161 skb_pull(skb, data_offset); 1159 skb_pull(skb, data_offset);
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
index 75e96db6626b..8e604a3931ca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c
@@ -471,7 +471,7 @@ static int iwl_get_radio_cfg(const struct iwl_cfg *cfg, const __le16 *nvm_sw,
471 if (cfg->device_family != IWL_DEVICE_FAMILY_8000) 471 if (cfg->device_family != IWL_DEVICE_FAMILY_8000)
472 return le16_to_cpup(nvm_sw + RADIO_CFG); 472 return le16_to_cpup(nvm_sw + RADIO_CFG);
473 473
474 return le32_to_cpup((__le32 *)(nvm_sw + RADIO_CFG_FAMILY_8000)); 474 return le32_to_cpup((__le32 *)(phy_sku + RADIO_CFG_FAMILY_8000));
475 475
476} 476}
477 477
diff --git a/drivers/net/wireless/iwlwifi/pcie/internal.h b/drivers/net/wireless/iwlwifi/pcie/internal.h
index 01996c9d98a7..376b84e54ad7 100644
--- a/drivers/net/wireless/iwlwifi/pcie/internal.h
+++ b/drivers/net/wireless/iwlwifi/pcie/internal.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2015 Intel Corporation. All rights reserved.
4 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 4 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
5 * 5 *
6 * Portions of this file are derived from the ipw3945 project, as well 6 * Portions of this file are derived from the ipw3945 project, as well
7 * as portions of the ieee80211 subsystem header files. 7 * as portions of the ieee80211 subsystem header files.
@@ -320,7 +320,7 @@ struct iwl_trans_pcie {
320 320
321 /*protect hw register */ 321 /*protect hw register */
322 spinlock_t reg_lock; 322 spinlock_t reg_lock;
323 bool cmd_in_flight; 323 bool cmd_hold_nic_awake;
324 bool ref_cmd_in_flight; 324 bool ref_cmd_in_flight;
325 325
326 /* protect ref counter */ 326 /* protect ref counter */
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index d6f6515fe663..dc179094e6a0 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1372,7 +1372,7 @@ static bool iwl_trans_pcie_grab_nic_access(struct iwl_trans *trans, bool silent,
1372 1372
1373 spin_lock_irqsave(&trans_pcie->reg_lock, *flags); 1373 spin_lock_irqsave(&trans_pcie->reg_lock, *flags);
1374 1374
1375 if (trans_pcie->cmd_in_flight) 1375 if (trans_pcie->cmd_hold_nic_awake)
1376 goto out; 1376 goto out;
1377 1377
1378 /* this bit wakes up the NIC */ 1378 /* this bit wakes up the NIC */
@@ -1438,7 +1438,7 @@ static void iwl_trans_pcie_release_nic_access(struct iwl_trans *trans,
1438 */ 1438 */
1439 __acquire(&trans_pcie->reg_lock); 1439 __acquire(&trans_pcie->reg_lock);
1440 1440
1441 if (trans_pcie->cmd_in_flight) 1441 if (trans_pcie->cmd_hold_nic_awake)
1442 goto out; 1442 goto out;
1443 1443
1444 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, 1444 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 06952aadfd7b..5ef8044c2ea3 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1039,18 +1039,14 @@ static int iwl_pcie_set_cmd_in_flight(struct iwl_trans *trans,
1039 iwl_trans_pcie_ref(trans); 1039 iwl_trans_pcie_ref(trans);
1040 } 1040 }
1041 1041
1042 if (trans_pcie->cmd_in_flight)
1043 return 0;
1044
1045 trans_pcie->cmd_in_flight = true;
1046
1047 /* 1042 /*
1048 * wake up the NIC to make sure that the firmware will see the host 1043 * wake up the NIC to make sure that the firmware will see the host
1049 * command - we will let the NIC sleep once all the host commands 1044 * command - we will let the NIC sleep once all the host commands
1050 * returned. This needs to be done only on NICs that have 1045 * returned. This needs to be done only on NICs that have
1051 * apmg_wake_up_wa set. 1046 * apmg_wake_up_wa set.
1052 */ 1047 */
1053 if (trans->cfg->base_params->apmg_wake_up_wa) { 1048 if (trans->cfg->base_params->apmg_wake_up_wa &&
1049 !trans_pcie->cmd_hold_nic_awake) {
1054 __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL, 1050 __iwl_trans_pcie_set_bit(trans, CSR_GP_CNTRL,
1055 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 1051 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
1056 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000) 1052 if (trans->cfg->device_family == IWL_DEVICE_FAMILY_8000)
@@ -1064,10 +1060,10 @@ static int iwl_pcie_set_cmd_in_flight(struct iwl_trans *trans,
1064 if (ret < 0) { 1060 if (ret < 0) {
1065 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, 1061 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
1066 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 1062 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
1067 trans_pcie->cmd_in_flight = false;
1068 IWL_ERR(trans, "Failed to wake NIC for hcmd\n"); 1063 IWL_ERR(trans, "Failed to wake NIC for hcmd\n");
1069 return -EIO; 1064 return -EIO;
1070 } 1065 }
1066 trans_pcie->cmd_hold_nic_awake = true;
1071 } 1067 }
1072 1068
1073 return 0; 1069 return 0;
@@ -1085,15 +1081,14 @@ static int iwl_pcie_clear_cmd_in_flight(struct iwl_trans *trans)
1085 iwl_trans_pcie_unref(trans); 1081 iwl_trans_pcie_unref(trans);
1086 } 1082 }
1087 1083
1088 if (WARN_ON(!trans_pcie->cmd_in_flight)) 1084 if (trans->cfg->base_params->apmg_wake_up_wa) {
1089 return 0; 1085 if (WARN_ON(!trans_pcie->cmd_hold_nic_awake))
1090 1086 return 0;
1091 trans_pcie->cmd_in_flight = false;
1092 1087
1093 if (trans->cfg->base_params->apmg_wake_up_wa) 1088 trans_pcie->cmd_hold_nic_awake = false;
1094 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL, 1089 __iwl_trans_pcie_clear_bit(trans, CSR_GP_CNTRL,
1095 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); 1090 CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
1096 1091 }
1097 return 0; 1092 return 0;
1098} 1093}
1099 1094
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 4de46aa61d95..0d2594395ffb 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1250,7 +1250,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
1250 netdev_err(queue->vif->dev, 1250 netdev_err(queue->vif->dev,
1251 "txreq.offset: %x, size: %u, end: %lu\n", 1251 "txreq.offset: %x, size: %u, end: %lu\n",
1252 txreq.offset, txreq.size, 1252 txreq.offset, txreq.size,
1253 (txreq.offset&~PAGE_MASK) + txreq.size); 1253 (unsigned long)(txreq.offset&~PAGE_MASK) + txreq.size);
1254 xenvif_fatal_tx_err(queue->vif); 1254 xenvif_fatal_tx_err(queue->vif);
1255 break; 1255 break;
1256 } 1256 }
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index fee02414529e..968787abf78d 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -34,6 +34,8 @@ struct backend_info {
34 enum xenbus_state frontend_state; 34 enum xenbus_state frontend_state;
35 struct xenbus_watch hotplug_status_watch; 35 struct xenbus_watch hotplug_status_watch;
36 u8 have_hotplug_status_watch:1; 36 u8 have_hotplug_status_watch:1;
37
38 const char *hotplug_script;
37}; 39};
38 40
39static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); 41static int connect_rings(struct backend_info *be, struct xenvif_queue *queue);
@@ -238,6 +240,7 @@ static int netback_remove(struct xenbus_device *dev)
238 xenvif_free(be->vif); 240 xenvif_free(be->vif);
239 be->vif = NULL; 241 be->vif = NULL;
240 } 242 }
243 kfree(be->hotplug_script);
241 kfree(be); 244 kfree(be);
242 dev_set_drvdata(&dev->dev, NULL); 245 dev_set_drvdata(&dev->dev, NULL);
243 return 0; 246 return 0;
@@ -255,6 +258,7 @@ static int netback_probe(struct xenbus_device *dev,
255 struct xenbus_transaction xbt; 258 struct xenbus_transaction xbt;
256 int err; 259 int err;
257 int sg; 260 int sg;
261 const char *script;
258 struct backend_info *be = kzalloc(sizeof(struct backend_info), 262 struct backend_info *be = kzalloc(sizeof(struct backend_info),
259 GFP_KERNEL); 263 GFP_KERNEL);
260 if (!be) { 264 if (!be) {
@@ -347,6 +351,15 @@ static int netback_probe(struct xenbus_device *dev,
347 if (err) 351 if (err)
348 pr_debug("Error writing multi-queue-max-queues\n"); 352 pr_debug("Error writing multi-queue-max-queues\n");
349 353
354 script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL);
355 if (IS_ERR(script)) {
356 err = PTR_ERR(script);
357 xenbus_dev_fatal(dev, err, "reading script");
358 goto fail;
359 }
360
361 be->hotplug_script = script;
362
350 err = xenbus_switch_state(dev, XenbusStateInitWait); 363 err = xenbus_switch_state(dev, XenbusStateInitWait);
351 if (err) 364 if (err)
352 goto fail; 365 goto fail;
@@ -379,22 +392,14 @@ static int netback_uevent(struct xenbus_device *xdev,
379 struct kobj_uevent_env *env) 392 struct kobj_uevent_env *env)
380{ 393{
381 struct backend_info *be = dev_get_drvdata(&xdev->dev); 394 struct backend_info *be = dev_get_drvdata(&xdev->dev);
382 char *val;
383 395
384 val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL); 396 if (!be)
385 if (IS_ERR(val)) { 397 return 0;
386 int err = PTR_ERR(val); 398
387 xenbus_dev_fatal(xdev, err, "reading script"); 399 if (add_uevent_var(env, "script=%s", be->hotplug_script))
388 return err; 400 return -ENOMEM;
389 } else {
390 if (add_uevent_var(env, "script=%s", val)) {
391 kfree(val);
392 return -ENOMEM;
393 }
394 kfree(val);
395 }
396 401
397 if (!be || !be->vif) 402 if (!be->vif)
398 return 0; 403 return 0;
399 404
400 return add_uevent_var(env, "vif=%s", be->vif->dev->name); 405 return add_uevent_var(env, "vif=%s", be->vif->dev->name);