diff options
32 files changed, 174 insertions, 119 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index af802b357b6a..e30871880fdb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -10587,8 +10587,7 @@ F: drivers/virtio/virtio_input.c | |||
10587 | F: include/uapi/linux/virtio_input.h | 10587 | F: include/uapi/linux/virtio_input.h |
10588 | 10588 | ||
10589 | VIA RHINE NETWORK DRIVER | 10589 | VIA RHINE NETWORK DRIVER |
10590 | M: Roger Luethi <rl@hellgate.ch> | 10590 | S: Orphan |
10591 | S: Maintained | ||
10592 | F: drivers/net/ethernet/via/via-rhine.c | 10591 | F: drivers/net/ethernet/via/via-rhine.c |
10593 | 10592 | ||
10594 | VIA SD/MMC CARD CONTROLLER DRIVER | 10593 | VIA SD/MMC CARD CONTROLLER DRIVER |
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 | 2000 | out_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; |
44 | error: | 51 | error: |
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 | ||
227 | static void efx_free_rx_buffer(struct efx_rx_buffer *rx_buf) | 227 | static 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 | ||
39 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); | 41 | static 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); |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 497bc14cdb85..0320bbb7d7b5 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -98,7 +98,8 @@ struct inet_connection_sock { | |||
98 | const struct tcp_congestion_ops *icsk_ca_ops; | 98 | const struct tcp_congestion_ops *icsk_ca_ops; |
99 | const struct inet_connection_sock_af_ops *icsk_af_ops; | 99 | const struct inet_connection_sock_af_ops *icsk_af_ops; |
100 | unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); | 100 | unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); |
101 | __u8 icsk_ca_state:7, | 101 | __u8 icsk_ca_state:6, |
102 | icsk_ca_setsockopt:1, | ||
102 | icsk_ca_dst_locked:1; | 103 | icsk_ca_dst_locked:1; |
103 | __u8 icsk_retransmits; | 104 | __u8 icsk_retransmits; |
104 | __u8 icsk_pending; | 105 | __u8 icsk_pending; |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 8e3668b44c29..fc57f6b82fc5 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -354,7 +354,7 @@ enum ieee80211_rssi_event_data { | |||
354 | }; | 354 | }; |
355 | 355 | ||
356 | /** | 356 | /** |
357 | * enum ieee80211_rssi_event - data attached to an %RSSI_EVENT | 357 | * struct ieee80211_rssi_event - data attached to an %RSSI_EVENT |
358 | * @data: See &enum ieee80211_rssi_event_data | 358 | * @data: See &enum ieee80211_rssi_event_data |
359 | */ | 359 | */ |
360 | struct ieee80211_rssi_event { | 360 | struct ieee80211_rssi_event { |
@@ -388,7 +388,7 @@ enum ieee80211_mlme_event_status { | |||
388 | }; | 388 | }; |
389 | 389 | ||
390 | /** | 390 | /** |
391 | * enum ieee80211_mlme_event - data attached to an %MLME_EVENT | 391 | * struct ieee80211_mlme_event - data attached to an %MLME_EVENT |
392 | * @data: See &enum ieee80211_mlme_event_data | 392 | * @data: See &enum ieee80211_mlme_event_data |
393 | * @status: See &enum ieee80211_mlme_event_status | 393 | * @status: See &enum ieee80211_mlme_event_status |
394 | * @reason: the reason code if applicable | 394 | * @reason: the reason code if applicable |
@@ -401,9 +401,10 @@ struct ieee80211_mlme_event { | |||
401 | 401 | ||
402 | /** | 402 | /** |
403 | * struct ieee80211_event - event to be sent to the driver | 403 | * struct ieee80211_event - event to be sent to the driver |
404 | * @type The event itself. See &enum ieee80211_event_type. | 404 | * @type: The event itself. See &enum ieee80211_event_type. |
405 | * @rssi: relevant if &type is %RSSI_EVENT | 405 | * @rssi: relevant if &type is %RSSI_EVENT |
406 | * @mlme: relevant if &type is %AUTH_EVENT | 406 | * @mlme: relevant if &type is %AUTH_EVENT |
407 | * @u: union holding the above two fields | ||
407 | */ | 408 | */ |
408 | struct ieee80211_event { | 409 | struct ieee80211_event { |
409 | enum ieee80211_event_type type; | 410 | enum ieee80211_event_type type; |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index a3abe6ed111e..22fd0419b314 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1822,7 +1822,7 @@ static void br_multicast_query_expired(struct net_bridge *br, | |||
1822 | if (query->startup_sent < br->multicast_startup_query_count) | 1822 | if (query->startup_sent < br->multicast_startup_query_count) |
1823 | query->startup_sent++; | 1823 | query->startup_sent++; |
1824 | 1824 | ||
1825 | RCU_INIT_POINTER(querier, NULL); | 1825 | RCU_INIT_POINTER(querier->port, NULL); |
1826 | br_multicast_send_query(br, NULL, query); | 1826 | br_multicast_send_query(br, NULL, query); |
1827 | spin_unlock(&br->multicast_lock); | 1827 | spin_unlock(&br->multicast_lock); |
1828 | } | 1828 | } |
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 24c7c96bf5f8..91180a7fc943 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -1117,8 +1117,6 @@ static int do_replace(struct net *net, const void __user *user, | |||
1117 | return -ENOMEM; | 1117 | return -ENOMEM; |
1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
1119 | return -ENOMEM; | 1119 | return -ENOMEM; |
1120 | if (tmp.num_counters == 0) | ||
1121 | return -EINVAL; | ||
1122 | 1120 | ||
1123 | tmp.name[sizeof(tmp.name) - 1] = 0; | 1121 | tmp.name[sizeof(tmp.name) - 1] = 0; |
1124 | 1122 | ||
@@ -2161,8 +2159,6 @@ static int compat_copy_ebt_replace_from_user(struct ebt_replace *repl, | |||
2161 | return -ENOMEM; | 2159 | return -ENOMEM; |
2162 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 2160 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
2163 | return -ENOMEM; | 2161 | return -ENOMEM; |
2164 | if (tmp.num_counters == 0) | ||
2165 | return -EINVAL; | ||
2166 | 2162 | ||
2167 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); | 2163 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); |
2168 | 2164 | ||
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 1347e11f5cc9..1d00b8922902 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -359,15 +359,7 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) | |||
359 | int err; | 359 | int err; |
360 | struct ethtool_cmd cmd; | 360 | struct ethtool_cmd cmd; |
361 | 361 | ||
362 | if (!dev->ethtool_ops->get_settings) | 362 | err = __ethtool_get_settings(dev, &cmd); |
363 | return -EOPNOTSUPP; | ||
364 | |||
365 | if (copy_from_user(&cmd, useraddr, sizeof(cmd))) | ||
366 | return -EFAULT; | ||
367 | |||
368 | cmd.cmd = ETHTOOL_GSET; | ||
369 | |||
370 | err = dev->ethtool_ops->get_settings(dev, &cmd); | ||
371 | if (err < 0) | 363 | if (err < 0) |
372 | return err; | 364 | return err; |
373 | 365 | ||
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index e6f6cc3a1bcf..392e29a0227d 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -359,7 +359,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
359 | */ | 359 | */ |
360 | ds = kzalloc(sizeof(*ds) + drv->priv_size, GFP_KERNEL); | 360 | ds = kzalloc(sizeof(*ds) + drv->priv_size, GFP_KERNEL); |
361 | if (ds == NULL) | 361 | if (ds == NULL) |
362 | return NULL; | 362 | return ERR_PTR(-ENOMEM); |
363 | 363 | ||
364 | ds->dst = dst; | 364 | ds->dst = dst; |
365 | ds->index = index; | 365 | ds->index = index; |
@@ -370,7 +370,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
370 | 370 | ||
371 | ret = dsa_switch_setup_one(ds, parent); | 371 | ret = dsa_switch_setup_one(ds, parent); |
372 | if (ret) | 372 | if (ret) |
373 | return NULL; | 373 | return ERR_PTR(ret); |
374 | 374 | ||
375 | return ds; | 375 | return ds; |
376 | } | 376 | } |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index 421a80b09b62..30b544f025ac 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -256,7 +256,8 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb) | |||
256 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); | 256 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); |
257 | aead_givcrypt_set_assoc(req, asg, assoclen); | 257 | aead_givcrypt_set_assoc(req, asg, assoclen); |
258 | aead_givcrypt_set_giv(req, esph->enc_data, | 258 | aead_givcrypt_set_giv(req, esph->enc_data, |
259 | XFRM_SKB_CB(skb)->seq.output.low); | 259 | XFRM_SKB_CB(skb)->seq.output.low + |
260 | ((u64)XFRM_SKB_CB(skb)->seq.output.hi << 32)); | ||
260 | 261 | ||
261 | ESP_SKB_CB(skb)->tmp = tmp; | 262 | ESP_SKB_CB(skb)->tmp = tmp; |
262 | err = crypto_aead_givencrypt(req); | 263 | err = crypto_aead_givencrypt(req); |
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index 9f7269f3c54a..0c152087ca15 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c | |||
@@ -65,7 +65,6 @@ static int vti_input(struct sk_buff *skb, int nexthdr, __be32 spi, | |||
65 | goto drop; | 65 | goto drop; |
66 | 66 | ||
67 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; | 67 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4 = tunnel; |
68 | skb->mark = be32_to_cpu(tunnel->parms.i_key); | ||
69 | 68 | ||
70 | return xfrm_input(skb, nexthdr, spi, encap_type); | 69 | return xfrm_input(skb, nexthdr, spi, encap_type); |
71 | } | 70 | } |
@@ -91,6 +90,8 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) | |||
91 | struct pcpu_sw_netstats *tstats; | 90 | struct pcpu_sw_netstats *tstats; |
92 | struct xfrm_state *x; | 91 | struct xfrm_state *x; |
93 | struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; | 92 | struct ip_tunnel *tunnel = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4; |
93 | u32 orig_mark = skb->mark; | ||
94 | int ret; | ||
94 | 95 | ||
95 | if (!tunnel) | 96 | if (!tunnel) |
96 | return 1; | 97 | return 1; |
@@ -107,7 +108,11 @@ static int vti_rcv_cb(struct sk_buff *skb, int err) | |||
107 | x = xfrm_input_state(skb); | 108 | x = xfrm_input_state(skb); |
108 | family = x->inner_mode->afinfo->family; | 109 | family = x->inner_mode->afinfo->family; |
109 | 110 | ||
110 | if (!xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family)) | 111 | skb->mark = be32_to_cpu(tunnel->parms.i_key); |
112 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); | ||
113 | skb->mark = orig_mark; | ||
114 | |||
115 | if (!ret) | ||
111 | return -EPERM; | 116 | return -EPERM; |
112 | 117 | ||
113 | skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(skb->dev))); | 118 | skb_scrub_packet(skb, !net_eq(tunnel->net, dev_net(skb->dev))); |
@@ -216,8 +221,6 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
216 | 221 | ||
217 | memset(&fl, 0, sizeof(fl)); | 222 | memset(&fl, 0, sizeof(fl)); |
218 | 223 | ||
219 | skb->mark = be32_to_cpu(tunnel->parms.o_key); | ||
220 | |||
221 | switch (skb->protocol) { | 224 | switch (skb->protocol) { |
222 | case htons(ETH_P_IP): | 225 | case htons(ETH_P_IP): |
223 | xfrm_decode_session(skb, &fl, AF_INET); | 226 | xfrm_decode_session(skb, &fl, AF_INET); |
@@ -233,6 +236,9 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
233 | return NETDEV_TX_OK; | 236 | return NETDEV_TX_OK; |
234 | } | 237 | } |
235 | 238 | ||
239 | /* override mark with tunnel output key */ | ||
240 | fl.flowi_mark = be32_to_cpu(tunnel->parms.o_key); | ||
241 | |||
236 | return vti_xmit(skb, dev, &fl); | 242 | return vti_xmit(skb, dev, &fl); |
237 | } | 243 | } |
238 | 244 | ||
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 7a5ae50c80c8..84be008c945c 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -187,6 +187,7 @@ static void tcp_reinit_congestion_control(struct sock *sk, | |||
187 | 187 | ||
188 | tcp_cleanup_congestion_control(sk); | 188 | tcp_cleanup_congestion_control(sk); |
189 | icsk->icsk_ca_ops = ca; | 189 | icsk->icsk_ca_ops = ca; |
190 | icsk->icsk_ca_setsockopt = 1; | ||
190 | 191 | ||
191 | if (sk->sk_state != TCP_CLOSE && icsk->icsk_ca_ops->init) | 192 | if (sk->sk_state != TCP_CLOSE && icsk->icsk_ca_ops->init) |
192 | icsk->icsk_ca_ops->init(sk); | 193 | icsk->icsk_ca_ops->init(sk); |
@@ -335,8 +336,10 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) | |||
335 | rcu_read_lock(); | 336 | rcu_read_lock(); |
336 | ca = __tcp_ca_find_autoload(name); | 337 | ca = __tcp_ca_find_autoload(name); |
337 | /* No change asking for existing value */ | 338 | /* No change asking for existing value */ |
338 | if (ca == icsk->icsk_ca_ops) | 339 | if (ca == icsk->icsk_ca_ops) { |
340 | icsk->icsk_ca_setsockopt = 1; | ||
339 | goto out; | 341 | goto out; |
342 | } | ||
340 | if (!ca) | 343 | if (!ca) |
341 | err = -ENOENT; | 344 | err = -ENOENT; |
342 | else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || | 345 | else if (!((ca->flags & TCP_CONG_NON_RESTRICTED) || |
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index b5732a54f2ad..17e7339ee5ca 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -420,7 +420,10 @@ void tcp_ca_openreq_child(struct sock *sk, const struct dst_entry *dst) | |||
420 | rcu_read_unlock(); | 420 | rcu_read_unlock(); |
421 | } | 421 | } |
422 | 422 | ||
423 | if (!ca_got_dst && !try_module_get(icsk->icsk_ca_ops->owner)) | 423 | /* If no valid choice made yet, assign current system default ca. */ |
424 | if (!ca_got_dst && | ||
425 | (!icsk->icsk_ca_setsockopt || | ||
426 | !try_module_get(icsk->icsk_ca_ops->owner))) | ||
424 | tcp_assign_congestion_control(sk); | 427 | tcp_assign_congestion_control(sk); |
425 | 428 | ||
426 | tcp_set_ca_state(sk, TCP_CA_Open); | 429 | tcp_set_ca_state(sk, TCP_CA_Open); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index d10b7e0112eb..1c92ea67baef 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1345,10 +1345,8 @@ csum_copy_err: | |||
1345 | } | 1345 | } |
1346 | unlock_sock_fast(sk, slow); | 1346 | unlock_sock_fast(sk, slow); |
1347 | 1347 | ||
1348 | if (noblock) | 1348 | /* starting over for a new packet, but check if we need to yield */ |
1349 | return -EAGAIN; | 1349 | cond_resched(); |
1350 | |||
1351 | /* starting over for a new packet */ | ||
1352 | msg->msg_flags &= ~MSG_TRUNC; | 1350 | msg->msg_flags &= ~MSG_TRUNC; |
1353 | goto try_again; | 1351 | goto try_again; |
1354 | } | 1352 | } |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 31f1b5d5e2ef..7c07ce36aae2 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -248,7 +248,8 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb) | |||
248 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); | 248 | aead_givcrypt_set_crypt(req, sg, sg, clen, iv); |
249 | aead_givcrypt_set_assoc(req, asg, assoclen); | 249 | aead_givcrypt_set_assoc(req, asg, assoclen); |
250 | aead_givcrypt_set_giv(req, esph->enc_data, | 250 | aead_givcrypt_set_giv(req, esph->enc_data, |
251 | XFRM_SKB_CB(skb)->seq.output.low); | 251 | XFRM_SKB_CB(skb)->seq.output.low + |
252 | ((u64)XFRM_SKB_CB(skb)->seq.output.hi << 32)); | ||
252 | 253 | ||
253 | ESP_SKB_CB(skb)->tmp = tmp; | 254 | ESP_SKB_CB(skb)->tmp = tmp; |
254 | err = crypto_aead_givencrypt(req); | 255 | err = crypto_aead_givencrypt(req); |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index ed9d681207fa..0224c032dca5 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -322,7 +322,6 @@ static int vti6_rcv(struct sk_buff *skb) | |||
322 | } | 322 | } |
323 | 323 | ||
324 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; | 324 | XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = t; |
325 | skb->mark = be32_to_cpu(t->parms.i_key); | ||
326 | 325 | ||
327 | rcu_read_unlock(); | 326 | rcu_read_unlock(); |
328 | 327 | ||
@@ -342,6 +341,8 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) | |||
342 | struct pcpu_sw_netstats *tstats; | 341 | struct pcpu_sw_netstats *tstats; |
343 | struct xfrm_state *x; | 342 | struct xfrm_state *x; |
344 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; | 343 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; |
344 | u32 orig_mark = skb->mark; | ||
345 | int ret; | ||
345 | 346 | ||
346 | if (!t) | 347 | if (!t) |
347 | return 1; | 348 | return 1; |
@@ -358,7 +359,11 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) | |||
358 | x = xfrm_input_state(skb); | 359 | x = xfrm_input_state(skb); |
359 | family = x->inner_mode->afinfo->family; | 360 | family = x->inner_mode->afinfo->family; |
360 | 361 | ||
361 | if (!xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family)) | 362 | skb->mark = be32_to_cpu(t->parms.i_key); |
363 | ret = xfrm_policy_check(NULL, XFRM_POLICY_IN, skb, family); | ||
364 | skb->mark = orig_mark; | ||
365 | |||
366 | if (!ret) | ||
362 | return -EPERM; | 367 | return -EPERM; |
363 | 368 | ||
364 | skb_scrub_packet(skb, !net_eq(t->net, dev_net(skb->dev))); | 369 | skb_scrub_packet(skb, !net_eq(t->net, dev_net(skb->dev))); |
@@ -430,6 +435,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) | |||
430 | struct net_device *tdev; | 435 | struct net_device *tdev; |
431 | struct xfrm_state *x; | 436 | struct xfrm_state *x; |
432 | int err = -1; | 437 | int err = -1; |
438 | int mtu; | ||
433 | 439 | ||
434 | if (!dst) | 440 | if (!dst) |
435 | goto tx_err_link_failure; | 441 | goto tx_err_link_failure; |
@@ -463,6 +469,19 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) | |||
463 | skb_dst_set(skb, dst); | 469 | skb_dst_set(skb, dst); |
464 | skb->dev = skb_dst(skb)->dev; | 470 | skb->dev = skb_dst(skb)->dev; |
465 | 471 | ||
472 | mtu = dst_mtu(dst); | ||
473 | if (!skb->ignore_df && skb->len > mtu) { | ||
474 | skb_dst(skb)->ops->update_pmtu(dst, NULL, skb, mtu); | ||
475 | |||
476 | if (skb->protocol == htons(ETH_P_IPV6)) | ||
477 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); | ||
478 | else | ||
479 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, | ||
480 | htonl(mtu)); | ||
481 | |||
482 | return -EMSGSIZE; | ||
483 | } | ||
484 | |||
466 | err = dst_output(skb); | 485 | err = dst_output(skb); |
467 | if (net_xmit_eval(err) == 0) { | 486 | if (net_xmit_eval(err) == 0) { |
468 | struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); | 487 | struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); |
@@ -495,7 +514,6 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
495 | int ret; | 514 | int ret; |
496 | 515 | ||
497 | memset(&fl, 0, sizeof(fl)); | 516 | memset(&fl, 0, sizeof(fl)); |
498 | skb->mark = be32_to_cpu(t->parms.o_key); | ||
499 | 517 | ||
500 | switch (skb->protocol) { | 518 | switch (skb->protocol) { |
501 | case htons(ETH_P_IPV6): | 519 | case htons(ETH_P_IPV6): |
@@ -516,6 +534,9 @@ vti6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
516 | goto tx_err; | 534 | goto tx_err; |
517 | } | 535 | } |
518 | 536 | ||
537 | /* override mark with tunnel output key */ | ||
538 | fl.flowi_mark = be32_to_cpu(t->parms.o_key); | ||
539 | |||
519 | ret = vti6_xmit(skb, dev, &fl); | 540 | ret = vti6_xmit(skb, dev, &fl); |
520 | if (ret < 0) | 541 | if (ret < 0) |
521 | goto tx_err; | 542 | goto tx_err; |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index c2ec41617a35..e51fc3eee6db 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -525,10 +525,8 @@ csum_copy_err: | |||
525 | } | 525 | } |
526 | unlock_sock_fast(sk, slow); | 526 | unlock_sock_fast(sk, slow); |
527 | 527 | ||
528 | if (noblock) | 528 | /* starting over for a new packet, but check if we need to yield */ |
529 | return -EAGAIN; | 529 | cond_resched(); |
530 | |||
531 | /* starting over for a new packet */ | ||
532 | msg->msg_flags &= ~MSG_TRUNC; | 530 | msg->msg_flags &= ~MSG_TRUNC; |
533 | goto try_again; | 531 | goto try_again; |
534 | } | 532 | } |
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c index 526c4feb3b50..b58286ecd156 100644 --- a/net/xfrm/xfrm_input.c +++ b/net/xfrm/xfrm_input.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <net/dst.h> | 13 | #include <net/dst.h> |
14 | #include <net/ip.h> | 14 | #include <net/ip.h> |
15 | #include <net/xfrm.h> | 15 | #include <net/xfrm.h> |
16 | #include <net/ip_tunnels.h> | ||
17 | #include <net/ip6_tunnel.h> | ||
16 | 18 | ||
17 | static struct kmem_cache *secpath_cachep __read_mostly; | 19 | static struct kmem_cache *secpath_cachep __read_mostly; |
18 | 20 | ||
@@ -186,6 +188,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
186 | struct xfrm_state *x = NULL; | 188 | struct xfrm_state *x = NULL; |
187 | xfrm_address_t *daddr; | 189 | xfrm_address_t *daddr; |
188 | struct xfrm_mode *inner_mode; | 190 | struct xfrm_mode *inner_mode; |
191 | u32 mark = skb->mark; | ||
189 | unsigned int family; | 192 | unsigned int family; |
190 | int decaps = 0; | 193 | int decaps = 0; |
191 | int async = 0; | 194 | int async = 0; |
@@ -203,6 +206,18 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
203 | XFRM_SPI_SKB_CB(skb)->daddroff); | 206 | XFRM_SPI_SKB_CB(skb)->daddroff); |
204 | family = XFRM_SPI_SKB_CB(skb)->family; | 207 | family = XFRM_SPI_SKB_CB(skb)->family; |
205 | 208 | ||
209 | /* if tunnel is present override skb->mark value with tunnel i_key */ | ||
210 | if (XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4) { | ||
211 | switch (family) { | ||
212 | case AF_INET: | ||
213 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip4->parms.i_key); | ||
214 | break; | ||
215 | case AF_INET6: | ||
216 | mark = be32_to_cpu(XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6->parms.i_key); | ||
217 | break; | ||
218 | } | ||
219 | } | ||
220 | |||
206 | /* Allocate new secpath or COW existing one. */ | 221 | /* Allocate new secpath or COW existing one. */ |
207 | if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) { | 222 | if (!skb->sp || atomic_read(&skb->sp->refcnt) != 1) { |
208 | struct sec_path *sp; | 223 | struct sec_path *sp; |
@@ -229,7 +244,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type) | |||
229 | goto drop; | 244 | goto drop; |
230 | } | 245 | } |
231 | 246 | ||
232 | x = xfrm_state_lookup(net, skb->mark, daddr, spi, nexthdr, family); | 247 | x = xfrm_state_lookup(net, mark, daddr, spi, nexthdr, family); |
233 | if (x == NULL) { | 248 | if (x == NULL) { |
234 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES); | 249 | XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES); |
235 | xfrm_audit_state_notfound(skb, family, spi, seq); | 250 | xfrm_audit_state_notfound(skb, family, spi, seq); |
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index dab57daae408..4fd725a0c500 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c | |||
@@ -99,6 +99,7 @@ static int xfrm_replay_overflow(struct xfrm_state *x, struct sk_buff *skb) | |||
99 | 99 | ||
100 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { | 100 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { |
101 | XFRM_SKB_CB(skb)->seq.output.low = ++x->replay.oseq; | 101 | XFRM_SKB_CB(skb)->seq.output.low = ++x->replay.oseq; |
102 | XFRM_SKB_CB(skb)->seq.output.hi = 0; | ||
102 | if (unlikely(x->replay.oseq == 0)) { | 103 | if (unlikely(x->replay.oseq == 0)) { |
103 | x->replay.oseq--; | 104 | x->replay.oseq--; |
104 | xfrm_audit_state_replay_overflow(x, skb); | 105 | xfrm_audit_state_replay_overflow(x, skb); |
@@ -177,6 +178,7 @@ static int xfrm_replay_overflow_bmp(struct xfrm_state *x, struct sk_buff *skb) | |||
177 | 178 | ||
178 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { | 179 | if (x->type->flags & XFRM_TYPE_REPLAY_PROT) { |
179 | XFRM_SKB_CB(skb)->seq.output.low = ++replay_esn->oseq; | 180 | XFRM_SKB_CB(skb)->seq.output.low = ++replay_esn->oseq; |
181 | XFRM_SKB_CB(skb)->seq.output.hi = 0; | ||
180 | if (unlikely(replay_esn->oseq == 0)) { | 182 | if (unlikely(replay_esn->oseq == 0)) { |
181 | replay_esn->oseq--; | 183 | replay_esn->oseq--; |
182 | xfrm_audit_state_replay_overflow(x, skb); | 184 | xfrm_audit_state_replay_overflow(x, skb); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index f5e39e35d73a..96688cd0f6f1 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -927,8 +927,8 @@ struct xfrm_state *xfrm_state_lookup_byspi(struct net *net, __be32 spi, | |||
927 | x->id.spi != spi) | 927 | x->id.spi != spi) |
928 | continue; | 928 | continue; |
929 | 929 | ||
930 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); | ||
931 | xfrm_state_hold(x); | 930 | xfrm_state_hold(x); |
931 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); | ||
932 | return x; | 932 | return x; |
933 | } | 933 | } |
934 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); | 934 | spin_unlock_bh(&net->xfrm.xfrm_state_lock); |