diff options
80 files changed, 651 insertions, 377 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 7cacc88dc79c..b8045c7f78c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -5581,9 +5581,9 @@ S: Maintained | |||
| 5581 | F: drivers/media/tuners/mxl5007t.* | 5581 | F: drivers/media/tuners/mxl5007t.* |
| 5582 | 5582 | ||
| 5583 | MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) | 5583 | MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) |
| 5584 | M: Andrew Gallatin <gallatin@myri.com> | 5584 | M: Hyong-Youb Kim <hykim@myri.com> |
| 5585 | L: netdev@vger.kernel.org | 5585 | L: netdev@vger.kernel.org |
| 5586 | W: http://www.myri.com/scs/download-Myri10GE.html | 5586 | W: https://www.myricom.com/support/downloads/myri10ge.html |
| 5587 | S: Supported | 5587 | S: Supported |
| 5588 | F: drivers/net/ethernet/myricom/myri10ge/ | 5588 | F: drivers/net/ethernet/myricom/myri10ge/ |
| 5589 | 5589 | ||
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 07f257d44a1e..e48cb339c0c6 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -3714,11 +3714,17 @@ static int bond_neigh_init(struct neighbour *n) | |||
| 3714 | * The bonding ndo_neigh_setup is called at init time beofre any | 3714 | * The bonding ndo_neigh_setup is called at init time beofre any |
| 3715 | * slave exists. So we must declare proxy setup function which will | 3715 | * slave exists. So we must declare proxy setup function which will |
| 3716 | * be used at run time to resolve the actual slave neigh param setup. | 3716 | * be used at run time to resolve the actual slave neigh param setup. |
| 3717 | * | ||
| 3718 | * It's also called by master devices (such as vlans) to setup their | ||
| 3719 | * underlying devices. In that case - do nothing, we're already set up from | ||
| 3720 | * our init. | ||
| 3717 | */ | 3721 | */ |
| 3718 | static int bond_neigh_setup(struct net_device *dev, | 3722 | static int bond_neigh_setup(struct net_device *dev, |
| 3719 | struct neigh_parms *parms) | 3723 | struct neigh_parms *parms) |
| 3720 | { | 3724 | { |
| 3721 | parms->neigh_setup = bond_neigh_init; | 3725 | /* modify only our neigh_parms */ |
| 3726 | if (parms->dev == dev) | ||
| 3727 | parms->neigh_setup = bond_neigh_init; | ||
| 3722 | 3728 | ||
| 3723 | return 0; | 3729 | return 0; |
| 3724 | } | 3730 | } |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb.c b/drivers/net/can/usb/peak_usb/pcan_usb.c index 25723d8ee201..925ab8ec9329 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb.c | |||
| @@ -649,7 +649,7 @@ static int pcan_usb_decode_data(struct pcan_usb_msg_context *mc, u8 status_len) | |||
| 649 | if ((mc->ptr + rec_len) > mc->end) | 649 | if ((mc->ptr + rec_len) > mc->end) |
| 650 | goto decode_failed; | 650 | goto decode_failed; |
| 651 | 651 | ||
| 652 | memcpy(cf->data, mc->ptr, rec_len); | 652 | memcpy(cf->data, mc->ptr, cf->can_dlc); |
| 653 | mc->ptr += rec_len; | 653 | mc->ptr += rec_len; |
| 654 | } | 654 | } |
| 655 | 655 | ||
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index f1b121ee5525..55d79cb53a79 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c | |||
| @@ -199,7 +199,7 @@ static int arc_emac_rx(struct net_device *ndev, int budget) | |||
| 199 | struct arc_emac_priv *priv = netdev_priv(ndev); | 199 | struct arc_emac_priv *priv = netdev_priv(ndev); |
| 200 | unsigned int work_done; | 200 | unsigned int work_done; |
| 201 | 201 | ||
| 202 | for (work_done = 0; work_done <= budget; work_done++) { | 202 | for (work_done = 0; work_done < budget; work_done++) { |
| 203 | unsigned int *last_rx_bd = &priv->last_rx_bd; | 203 | unsigned int *last_rx_bd = &priv->last_rx_bd; |
| 204 | struct net_device_stats *stats = &priv->stats; | 204 | struct net_device_stats *stats = &priv->stats; |
| 205 | struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd]; | 205 | struct buffer_state *rx_buff = &priv->rx_buff[*last_rx_bd]; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index d80e34b8285f..ce9b387b5a19 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
| @@ -1502,6 +1502,7 @@ struct bnx2x { | |||
| 1502 | #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21) | 1502 | #define BC_SUPPORTS_DCBX_MSG_NON_PMF (1 << 21) |
| 1503 | #define IS_VF_FLAG (1 << 22) | 1503 | #define IS_VF_FLAG (1 << 22) |
| 1504 | #define INTERRUPTS_ENABLED_FLAG (1 << 23) | 1504 | #define INTERRUPTS_ENABLED_FLAG (1 << 23) |
| 1505 | #define BC_SUPPORTS_RMMOD_CMD (1 << 24) | ||
| 1505 | 1506 | ||
| 1506 | #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) | 1507 | #define BP_NOMCP(bp) ((bp)->flags & NO_MCP_FLAG) |
| 1507 | 1508 | ||
| @@ -1830,6 +1831,8 @@ struct bnx2x { | |||
| 1830 | 1831 | ||
| 1831 | int fp_array_size; | 1832 | int fp_array_size; |
| 1832 | u32 dump_preset_idx; | 1833 | u32 dump_preset_idx; |
| 1834 | bool stats_started; | ||
| 1835 | struct semaphore stats_sema; | ||
| 1833 | }; | 1836 | }; |
| 1834 | 1837 | ||
| 1835 | /* Tx queues may be less or equal to Rx queues */ | 1838 | /* Tx queues may be less or equal to Rx queues */ |
| @@ -2451,4 +2454,6 @@ enum bnx2x_pci_bus_speed { | |||
| 2451 | BNX2X_PCI_LINK_SPEED_5000 = 5000, | 2454 | BNX2X_PCI_LINK_SPEED_5000 = 5000, |
| 2452 | BNX2X_PCI_LINK_SPEED_8000 = 8000 | 2455 | BNX2X_PCI_LINK_SPEED_8000 = 8000 |
| 2453 | }; | 2456 | }; |
| 2457 | |||
| 2458 | void bnx2x_set_local_cmng(struct bnx2x *bp); | ||
| 2454 | #endif /* bnx2x.h */ | 2459 | #endif /* bnx2x.h */ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c index 0c94df47e0e8..f9122f2d6b65 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_dcb.c | |||
| @@ -753,6 +753,10 @@ void bnx2x_dcbx_set_params(struct bnx2x *bp, u32 state) | |||
| 753 | bnx2x_pfc_set_pfc(bp); | 753 | bnx2x_pfc_set_pfc(bp); |
| 754 | 754 | ||
| 755 | bnx2x_dcbx_update_ets_params(bp); | 755 | bnx2x_dcbx_update_ets_params(bp); |
| 756 | |||
| 757 | /* ets may affect cmng configuration: reinit it in hw */ | ||
| 758 | bnx2x_set_local_cmng(bp); | ||
| 759 | |||
| 756 | bnx2x_dcbx_resume_hw_tx(bp); | 760 | bnx2x_dcbx_resume_hw_tx(bp); |
| 757 | 761 | ||
| 758 | return; | 762 | return; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 5018e52ae2ad..32767f6aa33f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
| @@ -1300,6 +1300,9 @@ struct drv_func_mb { | |||
| 1300 | 1300 | ||
| 1301 | #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000 | 1301 | #define DRV_MSG_CODE_EEE_RESULTS_ACK 0xda000000 |
| 1302 | 1302 | ||
| 1303 | #define DRV_MSG_CODE_RMMOD 0xdb000000 | ||
| 1304 | #define REQ_BC_VER_4_RMMOD_CMD 0x0007080f | ||
| 1305 | |||
| 1303 | #define DRV_MSG_CODE_SET_MF_BW 0xe0000000 | 1306 | #define DRV_MSG_CODE_SET_MF_BW 0xe0000000 |
| 1304 | #define REQ_BC_VER_4_SET_MF_BW 0x00060202 | 1307 | #define REQ_BC_VER_4_SET_MF_BW 0x00060202 |
| 1305 | #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000 | 1308 | #define DRV_MSG_CODE_SET_MF_BW_ACK 0xe1000000 |
| @@ -1372,6 +1375,8 @@ struct drv_func_mb { | |||
| 1372 | 1375 | ||
| 1373 | #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000 | 1376 | #define FW_MSG_CODE_EEE_RESULS_ACK 0xda100000 |
| 1374 | 1377 | ||
| 1378 | #define FW_MSG_CODE_RMMOD_ACK 0xdb100000 | ||
| 1379 | |||
| 1375 | #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000 | 1380 | #define FW_MSG_CODE_SET_MF_BW_SENT 0xe0000000 |
| 1376 | #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000 | 1381 | #define FW_MSG_CODE_SET_MF_BW_DONE 0xe1000000 |
| 1377 | 1382 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e06186c305d8..955d6cfd9cb7 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
| @@ -2476,7 +2476,7 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type) | |||
| 2476 | 2476 | ||
| 2477 | input.port_rate = bp->link_vars.line_speed; | 2477 | input.port_rate = bp->link_vars.line_speed; |
| 2478 | 2478 | ||
| 2479 | if (cmng_type == CMNG_FNS_MINMAX) { | 2479 | if (cmng_type == CMNG_FNS_MINMAX && input.port_rate) { |
| 2480 | int vn; | 2480 | int vn; |
| 2481 | 2481 | ||
| 2482 | /* read mf conf from shmem */ | 2482 | /* read mf conf from shmem */ |
| @@ -2533,6 +2533,21 @@ static void storm_memset_cmng(struct bnx2x *bp, | |||
| 2533 | } | 2533 | } |
| 2534 | } | 2534 | } |
| 2535 | 2535 | ||
| 2536 | /* init cmng mode in HW according to local configuration */ | ||
| 2537 | void bnx2x_set_local_cmng(struct bnx2x *bp) | ||
| 2538 | { | ||
| 2539 | int cmng_fns = bnx2x_get_cmng_fns_mode(bp); | ||
| 2540 | |||
| 2541 | if (cmng_fns != CMNG_FNS_NONE) { | ||
| 2542 | bnx2x_cmng_fns_init(bp, false, cmng_fns); | ||
| 2543 | storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); | ||
| 2544 | } else { | ||
| 2545 | /* rate shaping and fairness are disabled */ | ||
| 2546 | DP(NETIF_MSG_IFUP, | ||
| 2547 | "single function mode without fairness\n"); | ||
| 2548 | } | ||
| 2549 | } | ||
| 2550 | |||
| 2536 | /* This function is called upon link interrupt */ | 2551 | /* This function is called upon link interrupt */ |
| 2537 | static void bnx2x_link_attn(struct bnx2x *bp) | 2552 | static void bnx2x_link_attn(struct bnx2x *bp) |
| 2538 | { | 2553 | { |
| @@ -2568,17 +2583,8 @@ static void bnx2x_link_attn(struct bnx2x *bp) | |||
| 2568 | bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); | 2583 | bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); |
| 2569 | } | 2584 | } |
| 2570 | 2585 | ||
| 2571 | if (bp->link_vars.link_up && bp->link_vars.line_speed) { | 2586 | if (bp->link_vars.link_up && bp->link_vars.line_speed) |
| 2572 | int cmng_fns = bnx2x_get_cmng_fns_mode(bp); | 2587 | bnx2x_set_local_cmng(bp); |
| 2573 | |||
| 2574 | if (cmng_fns != CMNG_FNS_NONE) { | ||
| 2575 | bnx2x_cmng_fns_init(bp, false, cmng_fns); | ||
| 2576 | storm_memset_cmng(bp, &bp->cmng, BP_PORT(bp)); | ||
| 2577 | } else | ||
| 2578 | /* rate shaping and fairness are disabled */ | ||
| 2579 | DP(NETIF_MSG_IFUP, | ||
| 2580 | "single function mode without fairness\n"); | ||
| 2581 | } | ||
| 2582 | 2588 | ||
| 2583 | __bnx2x_link_report(bp); | 2589 | __bnx2x_link_report(bp); |
| 2584 | 2590 | ||
| @@ -10362,6 +10368,10 @@ static void bnx2x_get_common_hwinfo(struct bnx2x *bp) | |||
| 10362 | 10368 | ||
| 10363 | bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ? | 10369 | bp->flags |= (val >= REQ_BC_VER_4_DCBX_ADMIN_MSG_NON_PMF) ? |
| 10364 | BC_SUPPORTS_DCBX_MSG_NON_PMF : 0; | 10370 | BC_SUPPORTS_DCBX_MSG_NON_PMF : 0; |
| 10371 | |||
| 10372 | bp->flags |= (val >= REQ_BC_VER_4_RMMOD_CMD) ? | ||
| 10373 | BC_SUPPORTS_RMMOD_CMD : 0; | ||
| 10374 | |||
| 10365 | boot_mode = SHMEM_RD(bp, | 10375 | boot_mode = SHMEM_RD(bp, |
| 10366 | dev_info.port_feature_config[BP_PORT(bp)].mba_config) & | 10376 | dev_info.port_feature_config[BP_PORT(bp)].mba_config) & |
| 10367 | PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK; | 10377 | PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK; |
| @@ -11524,6 +11534,7 @@ static int bnx2x_init_bp(struct bnx2x *bp) | |||
| 11524 | mutex_init(&bp->port.phy_mutex); | 11534 | mutex_init(&bp->port.phy_mutex); |
| 11525 | mutex_init(&bp->fw_mb_mutex); | 11535 | mutex_init(&bp->fw_mb_mutex); |
| 11526 | spin_lock_init(&bp->stats_lock); | 11536 | spin_lock_init(&bp->stats_lock); |
| 11537 | sema_init(&bp->stats_sema, 1); | ||
| 11527 | 11538 | ||
| 11528 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); | 11539 | INIT_DELAYED_WORK(&bp->sp_task, bnx2x_sp_task); |
| 11529 | INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task); | 11540 | INIT_DELAYED_WORK(&bp->sp_rtnl_task, bnx2x_sp_rtnl_task); |
| @@ -12817,13 +12828,17 @@ static void __bnx2x_remove(struct pci_dev *pdev, | |||
| 12817 | bnx2x_dcbnl_update_applist(bp, true); | 12828 | bnx2x_dcbnl_update_applist(bp, true); |
| 12818 | #endif | 12829 | #endif |
| 12819 | 12830 | ||
| 12831 | if (IS_PF(bp) && | ||
| 12832 | !BP_NOMCP(bp) && | ||
| 12833 | (bp->flags & BC_SUPPORTS_RMMOD_CMD)) | ||
| 12834 | bnx2x_fw_command(bp, DRV_MSG_CODE_RMMOD, 0); | ||
| 12835 | |||
| 12820 | /* Close the interface - either directly or implicitly */ | 12836 | /* Close the interface - either directly or implicitly */ |
| 12821 | if (remove_netdev) { | 12837 | if (remove_netdev) { |
| 12822 | unregister_netdev(dev); | 12838 | unregister_netdev(dev); |
| 12823 | } else { | 12839 | } else { |
| 12824 | rtnl_lock(); | 12840 | rtnl_lock(); |
| 12825 | if (netif_running(dev)) | 12841 | dev_close(dev); |
| 12826 | bnx2x_close(dev); | ||
| 12827 | rtnl_unlock(); | 12842 | rtnl_unlock(); |
| 12828 | } | 12843 | } |
| 12829 | 12844 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c index 95861efb5051..44104fb27947 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c | |||
| @@ -3463,7 +3463,7 @@ int bnx2x_vf_pci_alloc(struct bnx2x *bp) | |||
| 3463 | alloc_mem_err: | 3463 | alloc_mem_err: |
| 3464 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, | 3464 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, |
| 3465 | sizeof(struct bnx2x_vf_mbx_msg)); | 3465 | sizeof(struct bnx2x_vf_mbx_msg)); |
| 3466 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->vf2pf_mbox_mapping, | 3466 | BNX2X_PCI_FREE(bp->vf2pf_mbox, bp->pf2vf_bulletin_mapping, |
| 3467 | sizeof(union pf_vf_bulletin)); | 3467 | sizeof(union pf_vf_bulletin)); |
| 3468 | return -ENOMEM; | 3468 | return -ENOMEM; |
| 3469 | } | 3469 | } |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c index 98366abd02bd..d63d1327b051 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_stats.c | |||
| @@ -221,7 +221,8 @@ static int bnx2x_stats_comp(struct bnx2x *bp) | |||
| 221 | * Statistics service functions | 221 | * Statistics service functions |
| 222 | */ | 222 | */ |
| 223 | 223 | ||
| 224 | static void bnx2x_stats_pmf_update(struct bnx2x *bp) | 224 | /* should be called under stats_sema */ |
| 225 | static void __bnx2x_stats_pmf_update(struct bnx2x *bp) | ||
| 225 | { | 226 | { |
| 226 | struct dmae_command *dmae; | 227 | struct dmae_command *dmae; |
| 227 | u32 opcode; | 228 | u32 opcode; |
| @@ -518,7 +519,8 @@ static void bnx2x_func_stats_init(struct bnx2x *bp) | |||
| 518 | *stats_comp = 0; | 519 | *stats_comp = 0; |
| 519 | } | 520 | } |
| 520 | 521 | ||
| 521 | static void bnx2x_stats_start(struct bnx2x *bp) | 522 | /* should be called under stats_sema */ |
| 523 | static void __bnx2x_stats_start(struct bnx2x *bp) | ||
| 522 | { | 524 | { |
| 523 | /* vfs travel through here as part of the statistics FSM, but no action | 525 | /* vfs travel through here as part of the statistics FSM, but no action |
| 524 | * is required | 526 | * is required |
| @@ -534,13 +536,34 @@ static void bnx2x_stats_start(struct bnx2x *bp) | |||
| 534 | 536 | ||
| 535 | bnx2x_hw_stats_post(bp); | 537 | bnx2x_hw_stats_post(bp); |
| 536 | bnx2x_storm_stats_post(bp); | 538 | bnx2x_storm_stats_post(bp); |
| 539 | |||
| 540 | bp->stats_started = true; | ||
| 541 | } | ||
| 542 | |||
| 543 | static void bnx2x_stats_start(struct bnx2x *bp) | ||
| 544 | { | ||
| 545 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
| 546 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
| 547 | __bnx2x_stats_start(bp); | ||
| 548 | up(&bp->stats_sema); | ||
| 537 | } | 549 | } |
| 538 | 550 | ||
| 539 | static void bnx2x_stats_pmf_start(struct bnx2x *bp) | 551 | static void bnx2x_stats_pmf_start(struct bnx2x *bp) |
| 540 | { | 552 | { |
| 553 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
| 554 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
| 541 | bnx2x_stats_comp(bp); | 555 | bnx2x_stats_comp(bp); |
| 542 | bnx2x_stats_pmf_update(bp); | 556 | __bnx2x_stats_pmf_update(bp); |
| 543 | bnx2x_stats_start(bp); | 557 | __bnx2x_stats_start(bp); |
| 558 | up(&bp->stats_sema); | ||
| 559 | } | ||
| 560 | |||
| 561 | static void bnx2x_stats_pmf_update(struct bnx2x *bp) | ||
| 562 | { | ||
| 563 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
| 564 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
| 565 | __bnx2x_stats_pmf_update(bp); | ||
| 566 | up(&bp->stats_sema); | ||
| 544 | } | 567 | } |
| 545 | 568 | ||
| 546 | static void bnx2x_stats_restart(struct bnx2x *bp) | 569 | static void bnx2x_stats_restart(struct bnx2x *bp) |
| @@ -550,8 +573,11 @@ static void bnx2x_stats_restart(struct bnx2x *bp) | |||
| 550 | */ | 573 | */ |
| 551 | if (IS_VF(bp)) | 574 | if (IS_VF(bp)) |
| 552 | return; | 575 | return; |
| 576 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
| 577 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
| 553 | bnx2x_stats_comp(bp); | 578 | bnx2x_stats_comp(bp); |
| 554 | bnx2x_stats_start(bp); | 579 | __bnx2x_stats_start(bp); |
| 580 | up(&bp->stats_sema); | ||
| 555 | } | 581 | } |
| 556 | 582 | ||
| 557 | static void bnx2x_bmac_stats_update(struct bnx2x *bp) | 583 | static void bnx2x_bmac_stats_update(struct bnx2x *bp) |
| @@ -888,9 +914,7 @@ static int bnx2x_storm_stats_validate_counters(struct bnx2x *bp) | |||
| 888 | /* Make sure we use the value of the counter | 914 | /* Make sure we use the value of the counter |
| 889 | * used for sending the last stats ramrod. | 915 | * used for sending the last stats ramrod. |
| 890 | */ | 916 | */ |
| 891 | spin_lock_bh(&bp->stats_lock); | ||
| 892 | cur_stats_counter = bp->stats_counter - 1; | 917 | cur_stats_counter = bp->stats_counter - 1; |
| 893 | spin_unlock_bh(&bp->stats_lock); | ||
| 894 | 918 | ||
| 895 | /* are storm stats valid? */ | 919 | /* are storm stats valid? */ |
| 896 | if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) { | 920 | if (le16_to_cpu(counters->xstats_counter) != cur_stats_counter) { |
| @@ -1227,12 +1251,18 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
| 1227 | { | 1251 | { |
| 1228 | u32 *stats_comp = bnx2x_sp(bp, stats_comp); | 1252 | u32 *stats_comp = bnx2x_sp(bp, stats_comp); |
| 1229 | 1253 | ||
| 1230 | if (bnx2x_edebug_stats_stopped(bp)) | 1254 | /* we run update from timer context, so give up |
| 1255 | * if somebody is in the middle of transition | ||
| 1256 | */ | ||
| 1257 | if (down_trylock(&bp->stats_sema)) | ||
| 1231 | return; | 1258 | return; |
| 1232 | 1259 | ||
| 1260 | if (bnx2x_edebug_stats_stopped(bp) || !bp->stats_started) | ||
| 1261 | goto out; | ||
| 1262 | |||
| 1233 | if (IS_PF(bp)) { | 1263 | if (IS_PF(bp)) { |
| 1234 | if (*stats_comp != DMAE_COMP_VAL) | 1264 | if (*stats_comp != DMAE_COMP_VAL) |
| 1235 | return; | 1265 | goto out; |
| 1236 | 1266 | ||
| 1237 | if (bp->port.pmf) | 1267 | if (bp->port.pmf) |
| 1238 | bnx2x_hw_stats_update(bp); | 1268 | bnx2x_hw_stats_update(bp); |
| @@ -1242,7 +1272,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
| 1242 | BNX2X_ERR("storm stats were not updated for 3 times\n"); | 1272 | BNX2X_ERR("storm stats were not updated for 3 times\n"); |
| 1243 | bnx2x_panic(); | 1273 | bnx2x_panic(); |
| 1244 | } | 1274 | } |
| 1245 | return; | 1275 | goto out; |
| 1246 | } | 1276 | } |
| 1247 | } else { | 1277 | } else { |
| 1248 | /* vf doesn't collect HW statistics, and doesn't get completions | 1278 | /* vf doesn't collect HW statistics, and doesn't get completions |
| @@ -1256,7 +1286,7 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
| 1256 | 1286 | ||
| 1257 | /* vf is done */ | 1287 | /* vf is done */ |
| 1258 | if (IS_VF(bp)) | 1288 | if (IS_VF(bp)) |
| 1259 | return; | 1289 | goto out; |
| 1260 | 1290 | ||
| 1261 | if (netif_msg_timer(bp)) { | 1291 | if (netif_msg_timer(bp)) { |
| 1262 | struct bnx2x_eth_stats *estats = &bp->eth_stats; | 1292 | struct bnx2x_eth_stats *estats = &bp->eth_stats; |
| @@ -1267,6 +1297,9 @@ static void bnx2x_stats_update(struct bnx2x *bp) | |||
| 1267 | 1297 | ||
| 1268 | bnx2x_hw_stats_post(bp); | 1298 | bnx2x_hw_stats_post(bp); |
| 1269 | bnx2x_storm_stats_post(bp); | 1299 | bnx2x_storm_stats_post(bp); |
| 1300 | |||
| 1301 | out: | ||
| 1302 | up(&bp->stats_sema); | ||
| 1270 | } | 1303 | } |
| 1271 | 1304 | ||
| 1272 | static void bnx2x_port_stats_stop(struct bnx2x *bp) | 1305 | static void bnx2x_port_stats_stop(struct bnx2x *bp) |
| @@ -1332,6 +1365,11 @@ static void bnx2x_stats_stop(struct bnx2x *bp) | |||
| 1332 | { | 1365 | { |
| 1333 | int update = 0; | 1366 | int update = 0; |
| 1334 | 1367 | ||
| 1368 | if (down_timeout(&bp->stats_sema, HZ/10)) | ||
| 1369 | BNX2X_ERR("Unable to acquire stats lock\n"); | ||
| 1370 | |||
| 1371 | bp->stats_started = false; | ||
| 1372 | |||
| 1335 | bnx2x_stats_comp(bp); | 1373 | bnx2x_stats_comp(bp); |
| 1336 | 1374 | ||
| 1337 | if (bp->port.pmf) | 1375 | if (bp->port.pmf) |
| @@ -1348,6 +1386,8 @@ static void bnx2x_stats_stop(struct bnx2x *bp) | |||
| 1348 | bnx2x_hw_stats_post(bp); | 1386 | bnx2x_hw_stats_post(bp); |
| 1349 | bnx2x_stats_comp(bp); | 1387 | bnx2x_stats_comp(bp); |
| 1350 | } | 1388 | } |
| 1389 | |||
| 1390 | up(&bp->stats_sema); | ||
| 1351 | } | 1391 | } |
| 1352 | 1392 | ||
| 1353 | static void bnx2x_stats_do_nothing(struct bnx2x *bp) | 1393 | static void bnx2x_stats_do_nothing(struct bnx2x *bp) |
| @@ -1376,15 +1416,17 @@ static const struct { | |||
| 1376 | void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) | 1416 | void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) |
| 1377 | { | 1417 | { |
| 1378 | enum bnx2x_stats_state state; | 1418 | enum bnx2x_stats_state state; |
| 1419 | void (*action)(struct bnx2x *bp); | ||
| 1379 | if (unlikely(bp->panic)) | 1420 | if (unlikely(bp->panic)) |
| 1380 | return; | 1421 | return; |
| 1381 | 1422 | ||
| 1382 | spin_lock_bh(&bp->stats_lock); | 1423 | spin_lock_bh(&bp->stats_lock); |
| 1383 | state = bp->stats_state; | 1424 | state = bp->stats_state; |
| 1384 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; | 1425 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; |
| 1426 | action = bnx2x_stats_stm[state][event].action; | ||
| 1385 | spin_unlock_bh(&bp->stats_lock); | 1427 | spin_unlock_bh(&bp->stats_lock); |
| 1386 | 1428 | ||
| 1387 | bnx2x_stats_stm[state][event].action(bp); | 1429 | action(bp); |
| 1388 | 1430 | ||
| 1389 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) | 1431 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) |
| 1390 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", | 1432 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index ddebc7a5dda0..0da2214ef1b9 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -17796,8 +17796,10 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | |||
| 17796 | 17796 | ||
| 17797 | done: | 17797 | done: |
| 17798 | if (state == pci_channel_io_perm_failure) { | 17798 | if (state == pci_channel_io_perm_failure) { |
| 17799 | tg3_napi_enable(tp); | 17799 | if (netdev) { |
| 17800 | dev_close(netdev); | 17800 | tg3_napi_enable(tp); |
| 17801 | dev_close(netdev); | ||
| 17802 | } | ||
| 17801 | err = PCI_ERS_RESULT_DISCONNECT; | 17803 | err = PCI_ERS_RESULT_DISCONNECT; |
| 17802 | } else { | 17804 | } else { |
| 17803 | pci_disable_device(pdev); | 17805 | pci_disable_device(pdev); |
| @@ -17827,7 +17829,8 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) | |||
| 17827 | rtnl_lock(); | 17829 | rtnl_lock(); |
| 17828 | 17830 | ||
| 17829 | if (pci_enable_device(pdev)) { | 17831 | if (pci_enable_device(pdev)) { |
| 17830 | netdev_err(netdev, "Cannot re-enable PCI device after reset.\n"); | 17832 | dev_err(&pdev->dev, |
| 17833 | "Cannot re-enable PCI device after reset.\n"); | ||
| 17831 | goto done; | 17834 | goto done; |
| 17832 | } | 17835 | } |
| 17833 | 17836 | ||
| @@ -17835,7 +17838,7 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) | |||
| 17835 | pci_restore_state(pdev); | 17838 | pci_restore_state(pdev); |
| 17836 | pci_save_state(pdev); | 17839 | pci_save_state(pdev); |
| 17837 | 17840 | ||
| 17838 | if (!netif_running(netdev)) { | 17841 | if (!netdev || !netif_running(netdev)) { |
| 17839 | rc = PCI_ERS_RESULT_RECOVERED; | 17842 | rc = PCI_ERS_RESULT_RECOVERED; |
| 17840 | goto done; | 17843 | goto done; |
| 17841 | } | 17844 | } |
| @@ -17847,7 +17850,7 @@ static pci_ers_result_t tg3_io_slot_reset(struct pci_dev *pdev) | |||
| 17847 | rc = PCI_ERS_RESULT_RECOVERED; | 17850 | rc = PCI_ERS_RESULT_RECOVERED; |
| 17848 | 17851 | ||
| 17849 | done: | 17852 | done: |
| 17850 | if (rc != PCI_ERS_RESULT_RECOVERED && netif_running(netdev)) { | 17853 | if (rc != PCI_ERS_RESULT_RECOVERED && netdev && netif_running(netdev)) { |
| 17851 | tg3_napi_enable(tp); | 17854 | tg3_napi_enable(tp); |
| 17852 | dev_close(netdev); | 17855 | dev_close(netdev); |
| 17853 | } | 17856 | } |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c index 687ec4a8bb48..9c89dc8fe105 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c | |||
| @@ -455,11 +455,6 @@ static int alloc_pg_chunk(struct adapter *adapter, struct sge_fl *q, | |||
| 455 | q->pg_chunk.offset = 0; | 455 | q->pg_chunk.offset = 0; |
| 456 | mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, | 456 | mapping = pci_map_page(adapter->pdev, q->pg_chunk.page, |
| 457 | 0, q->alloc_size, PCI_DMA_FROMDEVICE); | 457 | 0, q->alloc_size, PCI_DMA_FROMDEVICE); |
| 458 | if (unlikely(pci_dma_mapping_error(adapter->pdev, mapping))) { | ||
| 459 | __free_pages(q->pg_chunk.page, order); | ||
| 460 | q->pg_chunk.page = NULL; | ||
| 461 | return -EIO; | ||
| 462 | } | ||
| 463 | q->pg_chunk.mapping = mapping; | 458 | q->pg_chunk.mapping = mapping; |
| 464 | } | 459 | } |
| 465 | sd->pg_chunk = q->pg_chunk; | 460 | sd->pg_chunk = q->pg_chunk; |
| @@ -954,75 +949,40 @@ static inline unsigned int calc_tx_descs(const struct sk_buff *skb) | |||
| 954 | return flits_to_desc(flits); | 949 | return flits_to_desc(flits); |
| 955 | } | 950 | } |
| 956 | 951 | ||
| 957 | |||
| 958 | /* map_skb - map a packet main body and its page fragments | ||
| 959 | * @pdev: the PCI device | ||
| 960 | * @skb: the packet | ||
| 961 | * @addr: placeholder to save the mapped addresses | ||
| 962 | * | ||
| 963 | * map the main body of an sk_buff and its page fragments, if any. | ||
| 964 | */ | ||
| 965 | static int map_skb(struct pci_dev *pdev, const struct sk_buff *skb, | ||
| 966 | dma_addr_t *addr) | ||
| 967 | { | ||
| 968 | const skb_frag_t *fp, *end; | ||
| 969 | const struct skb_shared_info *si; | ||
| 970 | |||
| 971 | *addr = pci_map_single(pdev, skb->data, skb_headlen(skb), | ||
| 972 | PCI_DMA_TODEVICE); | ||
| 973 | if (pci_dma_mapping_error(pdev, *addr)) | ||
| 974 | goto out_err; | ||
| 975 | |||
| 976 | si = skb_shinfo(skb); | ||
| 977 | end = &si->frags[si->nr_frags]; | ||
| 978 | |||
| 979 | for (fp = si->frags; fp < end; fp++) { | ||
| 980 | *++addr = skb_frag_dma_map(&pdev->dev, fp, 0, skb_frag_size(fp), | ||
| 981 | DMA_TO_DEVICE); | ||
| 982 | if (pci_dma_mapping_error(pdev, *addr)) | ||
| 983 | goto unwind; | ||
| 984 | } | ||
| 985 | return 0; | ||
| 986 | |||
| 987 | unwind: | ||
| 988 | while (fp-- > si->frags) | ||
| 989 | dma_unmap_page(&pdev->dev, *--addr, skb_frag_size(fp), | ||
| 990 | DMA_TO_DEVICE); | ||
| 991 | |||
| 992 | pci_unmap_single(pdev, addr[-1], skb_headlen(skb), PCI_DMA_TODEVICE); | ||
| 993 | out_err: | ||
| 994 | return -ENOMEM; | ||
| 995 | } | ||
| 996 | |||
| 997 | /** | 952 | /** |
| 998 | * write_sgl - populate a scatter/gather list for a packet | 953 | * make_sgl - populate a scatter/gather list for a packet |
| 999 | * @skb: the packet | 954 | * @skb: the packet |
| 1000 | * @sgp: the SGL to populate | 955 | * @sgp: the SGL to populate |
| 1001 | * @start: start address of skb main body data to include in the SGL | 956 | * @start: start address of skb main body data to include in the SGL |
| 1002 | * @len: length of skb main body data to include in the SGL | 957 | * @len: length of skb main body data to include in the SGL |
| 1003 | * @addr: the list of the mapped addresses | 958 | * @pdev: the PCI device |
| 1004 | * | 959 | * |
| 1005 | * Copies the scatter/gather list for the buffers that make up a packet | 960 | * Generates a scatter/gather list for the buffers that make up a packet |
| 1006 | * and returns the SGL size in 8-byte words. The caller must size the SGL | 961 | * and returns the SGL size in 8-byte words. The caller must size the SGL |
| 1007 | * appropriately. | 962 | * appropriately. |
| 1008 | */ | 963 | */ |
| 1009 | static inline unsigned int write_sgl(const struct sk_buff *skb, | 964 | static inline unsigned int make_sgl(const struct sk_buff *skb, |
| 1010 | struct sg_ent *sgp, unsigned char *start, | 965 | struct sg_ent *sgp, unsigned char *start, |
| 1011 | unsigned int len, const dma_addr_t *addr) | 966 | unsigned int len, struct pci_dev *pdev) |
| 1012 | { | 967 | { |
| 1013 | unsigned int i, j = 0, k = 0, nfrags; | 968 | dma_addr_t mapping; |
| 969 | unsigned int i, j = 0, nfrags; | ||
| 1014 | 970 | ||
| 1015 | if (len) { | 971 | if (len) { |
| 972 | mapping = pci_map_single(pdev, start, len, PCI_DMA_TODEVICE); | ||
| 1016 | sgp->len[0] = cpu_to_be32(len); | 973 | sgp->len[0] = cpu_to_be32(len); |
| 1017 | sgp->addr[j++] = cpu_to_be64(addr[k++]); | 974 | sgp->addr[0] = cpu_to_be64(mapping); |
| 975 | j = 1; | ||
| 1018 | } | 976 | } |
| 1019 | 977 | ||
| 1020 | nfrags = skb_shinfo(skb)->nr_frags; | 978 | nfrags = skb_shinfo(skb)->nr_frags; |
| 1021 | for (i = 0; i < nfrags; i++) { | 979 | for (i = 0; i < nfrags; i++) { |
| 1022 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 980 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
| 1023 | 981 | ||
| 982 | mapping = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag), | ||
| 983 | DMA_TO_DEVICE); | ||
| 1024 | sgp->len[j] = cpu_to_be32(skb_frag_size(frag)); | 984 | sgp->len[j] = cpu_to_be32(skb_frag_size(frag)); |
| 1025 | sgp->addr[j] = cpu_to_be64(addr[k++]); | 985 | sgp->addr[j] = cpu_to_be64(mapping); |
| 1026 | j ^= 1; | 986 | j ^= 1; |
| 1027 | if (j == 0) | 987 | if (j == 0) |
| 1028 | ++sgp; | 988 | ++sgp; |
| @@ -1178,7 +1138,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
| 1178 | const struct port_info *pi, | 1138 | const struct port_info *pi, |
| 1179 | unsigned int pidx, unsigned int gen, | 1139 | unsigned int pidx, unsigned int gen, |
| 1180 | struct sge_txq *q, unsigned int ndesc, | 1140 | struct sge_txq *q, unsigned int ndesc, |
| 1181 | unsigned int compl, const dma_addr_t *addr) | 1141 | unsigned int compl) |
| 1182 | { | 1142 | { |
| 1183 | unsigned int flits, sgl_flits, cntrl, tso_info; | 1143 | unsigned int flits, sgl_flits, cntrl, tso_info; |
| 1184 | struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1]; | 1144 | struct sg_ent *sgp, sgl[MAX_SKB_FRAGS / 2 + 1]; |
| @@ -1236,7 +1196,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
| 1236 | } | 1196 | } |
| 1237 | 1197 | ||
| 1238 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 1198 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; |
| 1239 | sgl_flits = write_sgl(skb, sgp, skb->data, skb_headlen(skb), addr); | 1199 | sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev); |
| 1240 | 1200 | ||
| 1241 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen, | 1201 | write_wr_hdr_sgl(ndesc, skb, d, pidx, q, sgl, flits, sgl_flits, gen, |
| 1242 | htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl), | 1202 | htonl(V_WR_OP(FW_WROPCODE_TUNNEL_TX_PKT) | compl), |
| @@ -1267,7 +1227,6 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1267 | struct netdev_queue *txq; | 1227 | struct netdev_queue *txq; |
| 1268 | struct sge_qset *qs; | 1228 | struct sge_qset *qs; |
| 1269 | struct sge_txq *q; | 1229 | struct sge_txq *q; |
| 1270 | dma_addr_t addr[MAX_SKB_FRAGS + 1]; | ||
| 1271 | 1230 | ||
| 1272 | /* | 1231 | /* |
| 1273 | * The chip min packet length is 9 octets but play safe and reject | 1232 | * The chip min packet length is 9 octets but play safe and reject |
| @@ -1296,11 +1255,6 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1296 | return NETDEV_TX_BUSY; | 1255 | return NETDEV_TX_BUSY; |
| 1297 | } | 1256 | } |
| 1298 | 1257 | ||
| 1299 | if (unlikely(map_skb(adap->pdev, skb, addr) < 0)) { | ||
| 1300 | dev_kfree_skb(skb); | ||
| 1301 | return NETDEV_TX_OK; | ||
| 1302 | } | ||
| 1303 | |||
| 1304 | q->in_use += ndesc; | 1258 | q->in_use += ndesc; |
| 1305 | if (unlikely(credits - ndesc < q->stop_thres)) { | 1259 | if (unlikely(credits - ndesc < q->stop_thres)) { |
| 1306 | t3_stop_tx_queue(txq, qs, q); | 1260 | t3_stop_tx_queue(txq, qs, q); |
| @@ -1358,7 +1312,7 @@ netdev_tx_t t3_eth_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1358 | if (likely(!skb_shared(skb))) | 1312 | if (likely(!skb_shared(skb))) |
| 1359 | skb_orphan(skb); | 1313 | skb_orphan(skb); |
| 1360 | 1314 | ||
| 1361 | write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl, addr); | 1315 | write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl); |
| 1362 | check_ring_tx_db(adap, q); | 1316 | check_ring_tx_db(adap, q); |
| 1363 | return NETDEV_TX_OK; | 1317 | return NETDEV_TX_OK; |
| 1364 | } | 1318 | } |
| @@ -1623,8 +1577,7 @@ static void setup_deferred_unmapping(struct sk_buff *skb, struct pci_dev *pdev, | |||
| 1623 | */ | 1577 | */ |
| 1624 | static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | 1578 | static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, |
| 1625 | struct sge_txq *q, unsigned int pidx, | 1579 | struct sge_txq *q, unsigned int pidx, |
| 1626 | unsigned int gen, unsigned int ndesc, | 1580 | unsigned int gen, unsigned int ndesc) |
| 1627 | const dma_addr_t *addr) | ||
| 1628 | { | 1581 | { |
| 1629 | unsigned int sgl_flits, flits; | 1582 | unsigned int sgl_flits, flits; |
| 1630 | struct work_request_hdr *from; | 1583 | struct work_request_hdr *from; |
| @@ -1645,9 +1598,9 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, | |||
| 1645 | 1598 | ||
| 1646 | flits = skb_transport_offset(skb) / 8; | 1599 | flits = skb_transport_offset(skb) / 8; |
| 1647 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; | 1600 | sgp = ndesc == 1 ? (struct sg_ent *)&d->flit[flits] : sgl; |
| 1648 | sgl_flits = write_sgl(skb, sgp, skb_transport_header(skb), | 1601 | sgl_flits = make_sgl(skb, sgp, skb_transport_header(skb), |
| 1649 | skb_tail_pointer(skb) - | 1602 | skb->tail - skb->transport_header, |
| 1650 | skb_transport_header(skb), addr); | 1603 | adap->pdev); |
| 1651 | if (need_skb_unmap()) { | 1604 | if (need_skb_unmap()) { |
| 1652 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); | 1605 | setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); |
| 1653 | skb->destructor = deferred_unmap_destructor; | 1606 | skb->destructor = deferred_unmap_destructor; |
| @@ -1705,11 +1658,6 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
| 1705 | goto again; | 1658 | goto again; |
| 1706 | } | 1659 | } |
| 1707 | 1660 | ||
| 1708 | if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) { | ||
| 1709 | spin_unlock(&q->lock); | ||
| 1710 | return NET_XMIT_SUCCESS; | ||
| 1711 | } | ||
| 1712 | |||
| 1713 | gen = q->gen; | 1661 | gen = q->gen; |
| 1714 | q->in_use += ndesc; | 1662 | q->in_use += ndesc; |
| 1715 | pidx = q->pidx; | 1663 | pidx = q->pidx; |
| @@ -1720,7 +1668,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
| 1720 | } | 1668 | } |
| 1721 | spin_unlock(&q->lock); | 1669 | spin_unlock(&q->lock); |
| 1722 | 1670 | ||
| 1723 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc, (dma_addr_t *)skb->head); | 1671 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc); |
| 1724 | check_ring_tx_db(adap, q); | 1672 | check_ring_tx_db(adap, q); |
| 1725 | return NET_XMIT_SUCCESS; | 1673 | return NET_XMIT_SUCCESS; |
| 1726 | } | 1674 | } |
| @@ -1738,7 +1686,6 @@ static void restart_offloadq(unsigned long data) | |||
| 1738 | struct sge_txq *q = &qs->txq[TXQ_OFLD]; | 1686 | struct sge_txq *q = &qs->txq[TXQ_OFLD]; |
| 1739 | const struct port_info *pi = netdev_priv(qs->netdev); | 1687 | const struct port_info *pi = netdev_priv(qs->netdev); |
| 1740 | struct adapter *adap = pi->adapter; | 1688 | struct adapter *adap = pi->adapter; |
| 1741 | unsigned int written = 0; | ||
| 1742 | 1689 | ||
| 1743 | spin_lock(&q->lock); | 1690 | spin_lock(&q->lock); |
| 1744 | again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | 1691 | again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); |
| @@ -1758,14 +1705,10 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
| 1758 | break; | 1705 | break; |
| 1759 | } | 1706 | } |
| 1760 | 1707 | ||
| 1761 | if (map_skb(adap->pdev, skb, (dma_addr_t *)skb->head)) | ||
| 1762 | break; | ||
| 1763 | |||
| 1764 | gen = q->gen; | 1708 | gen = q->gen; |
| 1765 | q->in_use += ndesc; | 1709 | q->in_use += ndesc; |
| 1766 | pidx = q->pidx; | 1710 | pidx = q->pidx; |
| 1767 | q->pidx += ndesc; | 1711 | q->pidx += ndesc; |
| 1768 | written += ndesc; | ||
| 1769 | if (q->pidx >= q->size) { | 1712 | if (q->pidx >= q->size) { |
| 1770 | q->pidx -= q->size; | 1713 | q->pidx -= q->size; |
| 1771 | q->gen ^= 1; | 1714 | q->gen ^= 1; |
| @@ -1773,8 +1716,7 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
| 1773 | __skb_unlink(skb, &q->sendq); | 1716 | __skb_unlink(skb, &q->sendq); |
| 1774 | spin_unlock(&q->lock); | 1717 | spin_unlock(&q->lock); |
| 1775 | 1718 | ||
| 1776 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc, | 1719 | write_ofld_wr(adap, skb, q, pidx, gen, ndesc); |
| 1777 | (dma_addr_t *)skb->head); | ||
| 1778 | spin_lock(&q->lock); | 1720 | spin_lock(&q->lock); |
| 1779 | } | 1721 | } |
| 1780 | spin_unlock(&q->lock); | 1722 | spin_unlock(&q->lock); |
| @@ -1784,9 +1726,8 @@ again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); | |||
| 1784 | set_bit(TXQ_LAST_PKT_DB, &q->flags); | 1726 | set_bit(TXQ_LAST_PKT_DB, &q->flags); |
| 1785 | #endif | 1727 | #endif |
| 1786 | wmb(); | 1728 | wmb(); |
| 1787 | if (likely(written)) | 1729 | t3_write_reg(adap, A_SG_KDOORBELL, |
| 1788 | t3_write_reg(adap, A_SG_KDOORBELL, | 1730 | F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); |
| 1789 | F_SELEGRCNTX | V_EGRCNTX(q->cntxt_id)); | ||
| 1790 | } | 1731 | } |
| 1791 | 1732 | ||
| 1792 | /** | 1733 | /** |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 6e6e0a117ee2..8ec5d74ad44d 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
| @@ -3048,6 +3048,9 @@ int be_cmd_get_func_config(struct be_adapter *adapter) | |||
| 3048 | 3048 | ||
| 3049 | adapter->max_event_queues = le16_to_cpu(desc->eq_count); | 3049 | adapter->max_event_queues = le16_to_cpu(desc->eq_count); |
| 3050 | adapter->if_cap_flags = le32_to_cpu(desc->cap_flags); | 3050 | adapter->if_cap_flags = le32_to_cpu(desc->cap_flags); |
| 3051 | |||
| 3052 | /* Clear flags that driver is not interested in */ | ||
| 3053 | adapter->if_cap_flags &= BE_IF_CAP_FLAGS_WANT; | ||
| 3051 | } | 3054 | } |
| 3052 | err: | 3055 | err: |
| 3053 | mutex_unlock(&adapter->mbox_lock); | 3056 | mutex_unlock(&adapter->mbox_lock); |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 5228d88c5a02..1b3b9e886412 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
| @@ -563,6 +563,12 @@ enum be_if_flags { | |||
| 563 | BE_IF_FLAGS_MULTICAST = 0x1000 | 563 | BE_IF_FLAGS_MULTICAST = 0x1000 |
| 564 | }; | 564 | }; |
| 565 | 565 | ||
| 566 | #define BE_IF_CAP_FLAGS_WANT (BE_IF_FLAGS_RSS | BE_IF_FLAGS_PROMISCUOUS |\ | ||
| 567 | BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_VLAN_PROMISCUOUS |\ | ||
| 568 | BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\ | ||
| 569 | BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\ | ||
| 570 | BE_IF_FLAGS_UNTAGGED) | ||
| 571 | |||
| 566 | /* An RX interface is an object with one or more MAC addresses and | 572 | /* An RX interface is an object with one or more MAC addresses and |
| 567 | * filtering capabilities. */ | 573 | * filtering capabilities. */ |
| 568 | struct be_cmd_req_if_create { | 574 | struct be_cmd_req_if_create { |
diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c index c896079728e1..ef94a591f9e5 100644 --- a/drivers/net/ethernet/marvell/skge.c +++ b/drivers/net/ethernet/marvell/skge.c | |||
| @@ -931,17 +931,20 @@ static int skge_ring_alloc(struct skge_ring *ring, void *vaddr, u32 base) | |||
| 931 | } | 931 | } |
| 932 | 932 | ||
| 933 | /* Allocate and setup a new buffer for receiving */ | 933 | /* Allocate and setup a new buffer for receiving */ |
| 934 | static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, | 934 | static int skge_rx_setup(struct skge_port *skge, struct skge_element *e, |
| 935 | struct sk_buff *skb, unsigned int bufsize) | 935 | struct sk_buff *skb, unsigned int bufsize) |
| 936 | { | 936 | { |
| 937 | struct skge_rx_desc *rd = e->desc; | 937 | struct skge_rx_desc *rd = e->desc; |
| 938 | u64 map; | 938 | dma_addr_t map; |
| 939 | 939 | ||
| 940 | map = pci_map_single(skge->hw->pdev, skb->data, bufsize, | 940 | map = pci_map_single(skge->hw->pdev, skb->data, bufsize, |
| 941 | PCI_DMA_FROMDEVICE); | 941 | PCI_DMA_FROMDEVICE); |
| 942 | 942 | ||
| 943 | rd->dma_lo = map; | 943 | if (pci_dma_mapping_error(skge->hw->pdev, map)) |
| 944 | rd->dma_hi = map >> 32; | 944 | return -1; |
| 945 | |||
| 946 | rd->dma_lo = lower_32_bits(map); | ||
| 947 | rd->dma_hi = upper_32_bits(map); | ||
| 945 | e->skb = skb; | 948 | e->skb = skb; |
| 946 | rd->csum1_start = ETH_HLEN; | 949 | rd->csum1_start = ETH_HLEN; |
| 947 | rd->csum2_start = ETH_HLEN; | 950 | rd->csum2_start = ETH_HLEN; |
| @@ -953,6 +956,7 @@ static void skge_rx_setup(struct skge_port *skge, struct skge_element *e, | |||
| 953 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; | 956 | rd->control = BMU_OWN | BMU_STF | BMU_IRQ_EOF | BMU_TCP_CHECK | bufsize; |
| 954 | dma_unmap_addr_set(e, mapaddr, map); | 957 | dma_unmap_addr_set(e, mapaddr, map); |
| 955 | dma_unmap_len_set(e, maplen, bufsize); | 958 | dma_unmap_len_set(e, maplen, bufsize); |
| 959 | return 0; | ||
| 956 | } | 960 | } |
| 957 | 961 | ||
| 958 | /* Resume receiving using existing skb, | 962 | /* Resume receiving using existing skb, |
| @@ -1014,7 +1018,10 @@ static int skge_rx_fill(struct net_device *dev) | |||
| 1014 | return -ENOMEM; | 1018 | return -ENOMEM; |
| 1015 | 1019 | ||
| 1016 | skb_reserve(skb, NET_IP_ALIGN); | 1020 | skb_reserve(skb, NET_IP_ALIGN); |
| 1017 | skge_rx_setup(skge, e, skb, skge->rx_buf_size); | 1021 | if (skge_rx_setup(skge, e, skb, skge->rx_buf_size) < 0) { |
| 1022 | dev_kfree_skb(skb); | ||
| 1023 | return -EIO; | ||
| 1024 | } | ||
| 1018 | } while ((e = e->next) != ring->start); | 1025 | } while ((e = e->next) != ring->start); |
| 1019 | 1026 | ||
| 1020 | ring->to_clean = ring->start; | 1027 | ring->to_clean = ring->start; |
| @@ -2544,7 +2551,7 @@ static int skge_up(struct net_device *dev) | |||
| 2544 | 2551 | ||
| 2545 | BUG_ON(skge->dma & 7); | 2552 | BUG_ON(skge->dma & 7); |
| 2546 | 2553 | ||
| 2547 | if ((u64)skge->dma >> 32 != ((u64) skge->dma + skge->mem_size) >> 32) { | 2554 | if (upper_32_bits(skge->dma) != upper_32_bits(skge->dma + skge->mem_size)) { |
| 2548 | dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n"); | 2555 | dev_err(&hw->pdev->dev, "pci_alloc_consistent region crosses 4G boundary\n"); |
| 2549 | err = -EINVAL; | 2556 | err = -EINVAL; |
| 2550 | goto free_pci_mem; | 2557 | goto free_pci_mem; |
| @@ -2729,7 +2736,7 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
| 2729 | struct skge_tx_desc *td; | 2736 | struct skge_tx_desc *td; |
| 2730 | int i; | 2737 | int i; |
| 2731 | u32 control, len; | 2738 | u32 control, len; |
| 2732 | u64 map; | 2739 | dma_addr_t map; |
| 2733 | 2740 | ||
| 2734 | if (skb_padto(skb, ETH_ZLEN)) | 2741 | if (skb_padto(skb, ETH_ZLEN)) |
| 2735 | return NETDEV_TX_OK; | 2742 | return NETDEV_TX_OK; |
| @@ -2743,11 +2750,14 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
| 2743 | e->skb = skb; | 2750 | e->skb = skb; |
| 2744 | len = skb_headlen(skb); | 2751 | len = skb_headlen(skb); |
| 2745 | map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); | 2752 | map = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE); |
| 2753 | if (pci_dma_mapping_error(hw->pdev, map)) | ||
| 2754 | goto mapping_error; | ||
| 2755 | |||
| 2746 | dma_unmap_addr_set(e, mapaddr, map); | 2756 | dma_unmap_addr_set(e, mapaddr, map); |
| 2747 | dma_unmap_len_set(e, maplen, len); | 2757 | dma_unmap_len_set(e, maplen, len); |
| 2748 | 2758 | ||
| 2749 | td->dma_lo = map; | 2759 | td->dma_lo = lower_32_bits(map); |
| 2750 | td->dma_hi = map >> 32; | 2760 | td->dma_hi = upper_32_bits(map); |
| 2751 | 2761 | ||
| 2752 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2762 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
| 2753 | const int offset = skb_checksum_start_offset(skb); | 2763 | const int offset = skb_checksum_start_offset(skb); |
| @@ -2778,14 +2788,16 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
| 2778 | 2788 | ||
| 2779 | map = skb_frag_dma_map(&hw->pdev->dev, frag, 0, | 2789 | map = skb_frag_dma_map(&hw->pdev->dev, frag, 0, |
| 2780 | skb_frag_size(frag), DMA_TO_DEVICE); | 2790 | skb_frag_size(frag), DMA_TO_DEVICE); |
| 2791 | if (dma_mapping_error(&hw->pdev->dev, map)) | ||
| 2792 | goto mapping_unwind; | ||
| 2781 | 2793 | ||
| 2782 | e = e->next; | 2794 | e = e->next; |
| 2783 | e->skb = skb; | 2795 | e->skb = skb; |
| 2784 | tf = e->desc; | 2796 | tf = e->desc; |
| 2785 | BUG_ON(tf->control & BMU_OWN); | 2797 | BUG_ON(tf->control & BMU_OWN); |
| 2786 | 2798 | ||
| 2787 | tf->dma_lo = map; | 2799 | tf->dma_lo = lower_32_bits(map); |
| 2788 | tf->dma_hi = (u64) map >> 32; | 2800 | tf->dma_hi = upper_32_bits(map); |
| 2789 | dma_unmap_addr_set(e, mapaddr, map); | 2801 | dma_unmap_addr_set(e, mapaddr, map); |
| 2790 | dma_unmap_len_set(e, maplen, skb_frag_size(frag)); | 2802 | dma_unmap_len_set(e, maplen, skb_frag_size(frag)); |
| 2791 | 2803 | ||
| @@ -2815,6 +2827,26 @@ static netdev_tx_t skge_xmit_frame(struct sk_buff *skb, | |||
| 2815 | } | 2827 | } |
| 2816 | 2828 | ||
| 2817 | return NETDEV_TX_OK; | 2829 | return NETDEV_TX_OK; |
| 2830 | |||
| 2831 | mapping_unwind: | ||
| 2832 | e = skge->tx_ring.to_use; | ||
| 2833 | pci_unmap_single(hw->pdev, | ||
| 2834 | dma_unmap_addr(e, mapaddr), | ||
| 2835 | dma_unmap_len(e, maplen), | ||
| 2836 | PCI_DMA_TODEVICE); | ||
| 2837 | while (i-- > 0) { | ||
| 2838 | e = e->next; | ||
| 2839 | pci_unmap_page(hw->pdev, | ||
| 2840 | dma_unmap_addr(e, mapaddr), | ||
| 2841 | dma_unmap_len(e, maplen), | ||
| 2842 | PCI_DMA_TODEVICE); | ||
| 2843 | } | ||
| 2844 | |||
| 2845 | mapping_error: | ||
| 2846 | if (net_ratelimit()) | ||
| 2847 | dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name); | ||
| 2848 | dev_kfree_skb(skb); | ||
| 2849 | return NETDEV_TX_OK; | ||
| 2818 | } | 2850 | } |
| 2819 | 2851 | ||
| 2820 | 2852 | ||
| @@ -3045,11 +3077,13 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
| 3045 | 3077 | ||
| 3046 | pci_dma_sync_single_for_cpu(skge->hw->pdev, | 3078 | pci_dma_sync_single_for_cpu(skge->hw->pdev, |
| 3047 | dma_unmap_addr(e, mapaddr), | 3079 | dma_unmap_addr(e, mapaddr), |
| 3048 | len, PCI_DMA_FROMDEVICE); | 3080 | dma_unmap_len(e, maplen), |
| 3081 | PCI_DMA_FROMDEVICE); | ||
| 3049 | skb_copy_from_linear_data(e->skb, skb->data, len); | 3082 | skb_copy_from_linear_data(e->skb, skb->data, len); |
| 3050 | pci_dma_sync_single_for_device(skge->hw->pdev, | 3083 | pci_dma_sync_single_for_device(skge->hw->pdev, |
| 3051 | dma_unmap_addr(e, mapaddr), | 3084 | dma_unmap_addr(e, mapaddr), |
| 3052 | len, PCI_DMA_FROMDEVICE); | 3085 | dma_unmap_len(e, maplen), |
| 3086 | PCI_DMA_FROMDEVICE); | ||
| 3053 | skge_rx_reuse(e, skge->rx_buf_size); | 3087 | skge_rx_reuse(e, skge->rx_buf_size); |
| 3054 | } else { | 3088 | } else { |
| 3055 | struct sk_buff *nskb; | 3089 | struct sk_buff *nskb; |
| @@ -3058,13 +3092,17 @@ static struct sk_buff *skge_rx_get(struct net_device *dev, | |||
| 3058 | if (!nskb) | 3092 | if (!nskb) |
| 3059 | goto resubmit; | 3093 | goto resubmit; |
| 3060 | 3094 | ||
| 3095 | if (skge_rx_setup(skge, e, nskb, skge->rx_buf_size) < 0) { | ||
| 3096 | dev_kfree_skb(nskb); | ||
| 3097 | goto resubmit; | ||
| 3098 | } | ||
| 3099 | |||
| 3061 | pci_unmap_single(skge->hw->pdev, | 3100 | pci_unmap_single(skge->hw->pdev, |
| 3062 | dma_unmap_addr(e, mapaddr), | 3101 | dma_unmap_addr(e, mapaddr), |
| 3063 | dma_unmap_len(e, maplen), | 3102 | dma_unmap_len(e, maplen), |
| 3064 | PCI_DMA_FROMDEVICE); | 3103 | PCI_DMA_FROMDEVICE); |
| 3065 | skb = e->skb; | 3104 | skb = e->skb; |
| 3066 | prefetch(skb->data); | 3105 | prefetch(skb->data); |
| 3067 | skge_rx_setup(skge, e, nskb, skge->rx_buf_size); | ||
| 3068 | } | 3106 | } |
| 3069 | 3107 | ||
| 3070 | skb_put(skb, len); | 3108 | skb_put(skb, len); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index c571de85d0f9..5472cbd34028 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | #include "mlx5_core.h" | 46 | #include "mlx5_core.h" |
| 47 | 47 | ||
| 48 | enum { | 48 | enum { |
| 49 | CMD_IF_REV = 4, | 49 | CMD_IF_REV = 5, |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | enum { | 52 | enum { |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index c02cbcfd0fb8..443cc4d7b024 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c | |||
| @@ -268,7 +268,7 @@ static int mlx5_eq_int(struct mlx5_core_dev *dev, struct mlx5_eq *eq) | |||
| 268 | case MLX5_EVENT_TYPE_PAGE_REQUEST: | 268 | case MLX5_EVENT_TYPE_PAGE_REQUEST: |
| 269 | { | 269 | { |
| 270 | u16 func_id = be16_to_cpu(eqe->data.req_pages.func_id); | 270 | u16 func_id = be16_to_cpu(eqe->data.req_pages.func_id); |
| 271 | s16 npages = be16_to_cpu(eqe->data.req_pages.num_pages); | 271 | s32 npages = be32_to_cpu(eqe->data.req_pages.num_pages); |
| 272 | 272 | ||
| 273 | mlx5_core_dbg(dev, "page request for func 0x%x, napges %d\n", func_id, npages); | 273 | mlx5_core_dbg(dev, "page request for func 0x%x, napges %d\n", func_id, npages); |
| 274 | mlx5_core_req_pages_handler(dev, func_id, npages); | 274 | mlx5_core_req_pages_handler(dev, func_id, npages); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fw.c b/drivers/net/ethernet/mellanox/mlx5/core/fw.c index 72a5222447f5..f012658b6a92 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fw.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fw.c | |||
| @@ -113,7 +113,7 @@ int mlx5_cmd_query_hca_cap(struct mlx5_core_dev *dev, | |||
| 113 | caps->log_max_srq = out->hca_cap.log_max_srqs & 0x1f; | 113 | caps->log_max_srq = out->hca_cap.log_max_srqs & 0x1f; |
| 114 | caps->local_ca_ack_delay = out->hca_cap.local_ca_ack_delay & 0x1f; | 114 | caps->local_ca_ack_delay = out->hca_cap.local_ca_ack_delay & 0x1f; |
| 115 | caps->log_max_mcg = out->hca_cap.log_max_mcg; | 115 | caps->log_max_mcg = out->hca_cap.log_max_mcg; |
| 116 | caps->max_qp_mcg = be16_to_cpu(out->hca_cap.max_qp_mcg); | 116 | caps->max_qp_mcg = be32_to_cpu(out->hca_cap.max_qp_mcg) & 0xffffff; |
| 117 | caps->max_ra_res_qp = 1 << (out->hca_cap.log_max_ra_res_qp & 0x3f); | 117 | caps->max_ra_res_qp = 1 << (out->hca_cap.log_max_ra_res_qp & 0x3f); |
| 118 | caps->max_ra_req_qp = 1 << (out->hca_cap.log_max_ra_req_qp & 0x3f); | 118 | caps->max_ra_req_qp = 1 << (out->hca_cap.log_max_ra_req_qp & 0x3f); |
| 119 | caps->max_srq_wqes = 1 << out->hca_cap.log_max_srq_sz; | 119 | caps->max_srq_wqes = 1 << out->hca_cap.log_max_srq_sz; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c index 748f10a155c4..3e6670c4a7cd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/health.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c | |||
| @@ -55,33 +55,9 @@ enum { | |||
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | static DEFINE_SPINLOCK(health_lock); | 57 | static DEFINE_SPINLOCK(health_lock); |
| 58 | |||
| 59 | static LIST_HEAD(health_list); | 58 | static LIST_HEAD(health_list); |
| 60 | static struct work_struct health_work; | 59 | static struct work_struct health_work; |
| 61 | 60 | ||
| 62 | static health_handler_t reg_handler; | ||
| 63 | int mlx5_register_health_report_handler(health_handler_t handler) | ||
| 64 | { | ||
| 65 | spin_lock_irq(&health_lock); | ||
| 66 | if (reg_handler) { | ||
| 67 | spin_unlock_irq(&health_lock); | ||
| 68 | return -EEXIST; | ||
| 69 | } | ||
| 70 | reg_handler = handler; | ||
| 71 | spin_unlock_irq(&health_lock); | ||
| 72 | |||
| 73 | return 0; | ||
| 74 | } | ||
| 75 | EXPORT_SYMBOL(mlx5_register_health_report_handler); | ||
| 76 | |||
| 77 | void mlx5_unregister_health_report_handler(void) | ||
| 78 | { | ||
| 79 | spin_lock_irq(&health_lock); | ||
| 80 | reg_handler = NULL; | ||
| 81 | spin_unlock_irq(&health_lock); | ||
| 82 | } | ||
| 83 | EXPORT_SYMBOL(mlx5_unregister_health_report_handler); | ||
| 84 | |||
| 85 | static void health_care(struct work_struct *work) | 61 | static void health_care(struct work_struct *work) |
| 86 | { | 62 | { |
| 87 | struct mlx5_core_health *health, *n; | 63 | struct mlx5_core_health *health, *n; |
| @@ -98,11 +74,8 @@ static void health_care(struct work_struct *work) | |||
| 98 | priv = container_of(health, struct mlx5_priv, health); | 74 | priv = container_of(health, struct mlx5_priv, health); |
| 99 | dev = container_of(priv, struct mlx5_core_dev, priv); | 75 | dev = container_of(priv, struct mlx5_core_dev, priv); |
| 100 | mlx5_core_warn(dev, "handling bad device here\n"); | 76 | mlx5_core_warn(dev, "handling bad device here\n"); |
| 77 | /* nothing yet */ | ||
| 101 | spin_lock_irq(&health_lock); | 78 | spin_lock_irq(&health_lock); |
| 102 | if (reg_handler) | ||
| 103 | reg_handler(dev->pdev, health->health, | ||
| 104 | sizeof(health->health)); | ||
| 105 | |||
| 106 | list_del_init(&health->list); | 79 | list_del_init(&health->list); |
| 107 | spin_unlock_irq(&health_lock); | 80 | spin_unlock_irq(&health_lock); |
| 108 | } | 81 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index 4a3e137931a3..3a2408d44820 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | |||
| @@ -43,10 +43,16 @@ enum { | |||
| 43 | MLX5_PAGES_TAKE = 2 | 43 | MLX5_PAGES_TAKE = 2 |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | enum { | ||
| 47 | MLX5_BOOT_PAGES = 1, | ||
| 48 | MLX5_INIT_PAGES = 2, | ||
| 49 | MLX5_POST_INIT_PAGES = 3 | ||
| 50 | }; | ||
| 51 | |||
| 46 | struct mlx5_pages_req { | 52 | struct mlx5_pages_req { |
| 47 | struct mlx5_core_dev *dev; | 53 | struct mlx5_core_dev *dev; |
| 48 | u32 func_id; | 54 | u32 func_id; |
| 49 | s16 npages; | 55 | s32 npages; |
| 50 | struct work_struct work; | 56 | struct work_struct work; |
| 51 | }; | 57 | }; |
| 52 | 58 | ||
| @@ -64,27 +70,23 @@ struct mlx5_query_pages_inbox { | |||
| 64 | 70 | ||
| 65 | struct mlx5_query_pages_outbox { | 71 | struct mlx5_query_pages_outbox { |
| 66 | struct mlx5_outbox_hdr hdr; | 72 | struct mlx5_outbox_hdr hdr; |
| 67 | __be16 num_boot_pages; | 73 | __be16 rsvd; |
| 68 | __be16 func_id; | 74 | __be16 func_id; |
| 69 | __be16 init_pages; | 75 | __be32 num_pages; |
| 70 | __be16 num_pages; | ||
| 71 | }; | 76 | }; |
| 72 | 77 | ||
| 73 | struct mlx5_manage_pages_inbox { | 78 | struct mlx5_manage_pages_inbox { |
| 74 | struct mlx5_inbox_hdr hdr; | 79 | struct mlx5_inbox_hdr hdr; |
| 75 | __be16 rsvd0; | 80 | __be16 rsvd; |
| 76 | __be16 func_id; | 81 | __be16 func_id; |
| 77 | __be16 rsvd1; | 82 | __be32 num_entries; |
| 78 | __be16 num_entries; | ||
| 79 | u8 rsvd2[16]; | ||
| 80 | __be64 pas[0]; | 83 | __be64 pas[0]; |
| 81 | }; | 84 | }; |
| 82 | 85 | ||
| 83 | struct mlx5_manage_pages_outbox { | 86 | struct mlx5_manage_pages_outbox { |
| 84 | struct mlx5_outbox_hdr hdr; | 87 | struct mlx5_outbox_hdr hdr; |
| 85 | u8 rsvd0[2]; | 88 | __be32 num_entries; |
| 86 | __be16 num_entries; | 89 | u8 rsvd[4]; |
| 87 | u8 rsvd1[20]; | ||
| 88 | __be64 pas[0]; | 90 | __be64 pas[0]; |
| 89 | }; | 91 | }; |
| 90 | 92 | ||
| @@ -146,7 +148,7 @@ static struct page *remove_page(struct mlx5_core_dev *dev, u64 addr) | |||
| 146 | } | 148 | } |
| 147 | 149 | ||
| 148 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | 150 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, |
| 149 | s16 *pages, s16 *init_pages, u16 *boot_pages) | 151 | s32 *npages, int boot) |
| 150 | { | 152 | { |
| 151 | struct mlx5_query_pages_inbox in; | 153 | struct mlx5_query_pages_inbox in; |
| 152 | struct mlx5_query_pages_outbox out; | 154 | struct mlx5_query_pages_outbox out; |
| @@ -155,6 +157,8 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | |||
| 155 | memset(&in, 0, sizeof(in)); | 157 | memset(&in, 0, sizeof(in)); |
| 156 | memset(&out, 0, sizeof(out)); | 158 | memset(&out, 0, sizeof(out)); |
| 157 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_PAGES); | 159 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_QUERY_PAGES); |
| 160 | in.hdr.opmod = boot ? cpu_to_be16(MLX5_BOOT_PAGES) : cpu_to_be16(MLX5_INIT_PAGES); | ||
| 161 | |||
| 158 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | 162 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); |
| 159 | if (err) | 163 | if (err) |
| 160 | return err; | 164 | return err; |
| @@ -162,15 +166,7 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | |||
| 162 | if (out.hdr.status) | 166 | if (out.hdr.status) |
| 163 | return mlx5_cmd_status_to_err(&out.hdr); | 167 | return mlx5_cmd_status_to_err(&out.hdr); |
| 164 | 168 | ||
| 165 | if (pages) | 169 | *npages = be32_to_cpu(out.num_pages); |
| 166 | *pages = be16_to_cpu(out.num_pages); | ||
| 167 | |||
| 168 | if (init_pages) | ||
| 169 | *init_pages = be16_to_cpu(out.init_pages); | ||
| 170 | |||
| 171 | if (boot_pages) | ||
| 172 | *boot_pages = be16_to_cpu(out.num_boot_pages); | ||
| 173 | |||
| 174 | *func_id = be16_to_cpu(out.func_id); | 170 | *func_id = be16_to_cpu(out.func_id); |
| 175 | 171 | ||
| 176 | return err; | 172 | return err; |
| @@ -224,7 +220,7 @@ static int give_pages(struct mlx5_core_dev *dev, u16 func_id, int npages, | |||
| 224 | in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); | 220 | in->hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); |
| 225 | in->hdr.opmod = cpu_to_be16(MLX5_PAGES_GIVE); | 221 | in->hdr.opmod = cpu_to_be16(MLX5_PAGES_GIVE); |
| 226 | in->func_id = cpu_to_be16(func_id); | 222 | in->func_id = cpu_to_be16(func_id); |
| 227 | in->num_entries = cpu_to_be16(npages); | 223 | in->num_entries = cpu_to_be32(npages); |
| 228 | err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); | 224 | err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out)); |
| 229 | mlx5_core_dbg(dev, "err %d\n", err); | 225 | mlx5_core_dbg(dev, "err %d\n", err); |
| 230 | if (err) { | 226 | if (err) { |
| @@ -292,7 +288,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, | |||
| 292 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); | 288 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_MANAGE_PAGES); |
| 293 | in.hdr.opmod = cpu_to_be16(MLX5_PAGES_TAKE); | 289 | in.hdr.opmod = cpu_to_be16(MLX5_PAGES_TAKE); |
| 294 | in.func_id = cpu_to_be16(func_id); | 290 | in.func_id = cpu_to_be16(func_id); |
| 295 | in.num_entries = cpu_to_be16(npages); | 291 | in.num_entries = cpu_to_be32(npages); |
| 296 | mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); | 292 | mlx5_core_dbg(dev, "npages %d, outlen %d\n", npages, outlen); |
| 297 | err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen); | 293 | err = mlx5_cmd_exec(dev, &in, sizeof(in), out, outlen); |
| 298 | if (err) { | 294 | if (err) { |
| @@ -306,7 +302,7 @@ static int reclaim_pages(struct mlx5_core_dev *dev, u32 func_id, int npages, | |||
| 306 | goto out_free; | 302 | goto out_free; |
| 307 | } | 303 | } |
| 308 | 304 | ||
| 309 | num_claimed = be16_to_cpu(out->num_entries); | 305 | num_claimed = be32_to_cpu(out->num_entries); |
| 310 | if (nclaimed) | 306 | if (nclaimed) |
| 311 | *nclaimed = num_claimed; | 307 | *nclaimed = num_claimed; |
| 312 | 308 | ||
| @@ -345,7 +341,7 @@ static void pages_work_handler(struct work_struct *work) | |||
| 345 | } | 341 | } |
| 346 | 342 | ||
| 347 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | 343 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, |
| 348 | s16 npages) | 344 | s32 npages) |
| 349 | { | 345 | { |
| 350 | struct mlx5_pages_req *req; | 346 | struct mlx5_pages_req *req; |
| 351 | 347 | ||
| @@ -364,20 +360,18 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | |||
| 364 | 360 | ||
| 365 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) | 361 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) |
| 366 | { | 362 | { |
| 367 | u16 uninitialized_var(boot_pages); | ||
| 368 | s16 uninitialized_var(init_pages); | ||
| 369 | u16 uninitialized_var(func_id); | 363 | u16 uninitialized_var(func_id); |
| 364 | s32 uninitialized_var(npages); | ||
| 370 | int err; | 365 | int err; |
| 371 | 366 | ||
| 372 | err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages, | 367 | err = mlx5_cmd_query_pages(dev, &func_id, &npages, boot); |
| 373 | &boot_pages); | ||
| 374 | if (err) | 368 | if (err) |
| 375 | return err; | 369 | return err; |
| 376 | 370 | ||
| 371 | mlx5_core_dbg(dev, "requested %d %s pages for func_id 0x%x\n", | ||
| 372 | npages, boot ? "boot" : "init", func_id); | ||
| 377 | 373 | ||
| 378 | mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n", | 374 | return give_pages(dev, func_id, npages, 0); |
| 379 | init_pages, boot_pages, func_id); | ||
| 380 | return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0); | ||
| 381 | } | 375 | } |
| 382 | 376 | ||
| 383 | static int optimal_reclaimed_pages(void) | 377 | static int optimal_reclaimed_pages(void) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 92da9980a0a0..9d4bb7f83904 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
| @@ -3266,6 +3266,11 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev) | |||
| 3266 | u8 val; | 3266 | u8 val; |
| 3267 | int ret, max_sds_rings = adapter->max_sds_rings; | 3267 | int ret, max_sds_rings = adapter->max_sds_rings; |
| 3268 | 3268 | ||
| 3269 | if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { | ||
| 3270 | netdev_info(netdev, "Device is resetting\n"); | ||
| 3271 | return -EBUSY; | ||
| 3272 | } | ||
| 3273 | |||
| 3269 | if (qlcnic_get_diag_lock(adapter)) { | 3274 | if (qlcnic_get_diag_lock(adapter)) { |
| 3270 | netdev_info(netdev, "Device in diagnostics mode\n"); | 3275 | netdev_info(netdev, "Device in diagnostics mode\n"); |
| 3271 | return -EBUSY; | 3276 | return -EBUSY; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 9f4b8d5f0865..345d987aede4 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
| @@ -629,7 +629,8 @@ int qlcnic_83xx_idc_reattach_driver(struct qlcnic_adapter *adapter) | |||
| 629 | return -EIO; | 629 | return -EIO; |
| 630 | } | 630 | } |
| 631 | 631 | ||
| 632 | qlcnic_set_drv_version(adapter); | 632 | if (adapter->portnum == 0) |
| 633 | qlcnic_set_drv_version(adapter); | ||
| 633 | qlcnic_83xx_idc_attach_driver(adapter); | 634 | qlcnic_83xx_idc_attach_driver(adapter); |
| 634 | 635 | ||
| 635 | return 0; | 636 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index ee013fcc3322..bc05d016c859 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
| @@ -2165,7 +2165,8 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2165 | if (err) | 2165 | if (err) |
| 2166 | goto err_out_disable_mbx_intr; | 2166 | goto err_out_disable_mbx_intr; |
| 2167 | 2167 | ||
| 2168 | qlcnic_set_drv_version(adapter); | 2168 | if (adapter->portnum == 0) |
| 2169 | qlcnic_set_drv_version(adapter); | ||
| 2169 | 2170 | ||
| 2170 | pci_set_drvdata(pdev, adapter); | 2171 | pci_set_drvdata(pdev, adapter); |
| 2171 | 2172 | ||
| @@ -3085,7 +3086,8 @@ done: | |||
| 3085 | adapter->fw_fail_cnt = 0; | 3086 | adapter->fw_fail_cnt = 0; |
| 3086 | adapter->flags &= ~QLCNIC_FW_HANG; | 3087 | adapter->flags &= ~QLCNIC_FW_HANG; |
| 3087 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | 3088 | clear_bit(__QLCNIC_RESETTING, &adapter->state); |
| 3088 | qlcnic_set_drv_version(adapter); | 3089 | if (adapter->portnum == 0) |
| 3090 | qlcnic_set_drv_version(adapter); | ||
| 3089 | 3091 | ||
| 3090 | if (!qlcnic_clr_drv_state(adapter)) | 3092 | if (!qlcnic_clr_drv_state(adapter)) |
| 3091 | qlcnic_schedule_work(adapter, qlcnic_fw_poll_work, | 3093 | qlcnic_schedule_work(adapter, qlcnic_fw_poll_work, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c index 10ed82b3baca..660c3f5b2237 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | |||
| @@ -170,9 +170,9 @@ static int qlcnic_82xx_store_beacon(struct qlcnic_adapter *adapter, | |||
| 170 | 170 | ||
| 171 | if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) { | 171 | if (ahw->extra_capability[0] & QLCNIC_FW_CAPABILITY_2_BEACON) { |
| 172 | err = qlcnic_get_beacon_state(adapter, &h_beacon_state); | 172 | err = qlcnic_get_beacon_state(adapter, &h_beacon_state); |
| 173 | if (!err) { | 173 | if (err) { |
| 174 | dev_info(&adapter->pdev->dev, | 174 | netdev_err(adapter->netdev, |
| 175 | "Failed to get current beacon state\n"); | 175 | "Failed to get current beacon state\n"); |
| 176 | } else { | 176 | } else { |
| 177 | if (h_beacon_state == QLCNIC_BEACON_DISABLE) | 177 | if (h_beacon_state == QLCNIC_BEACON_DISABLE) |
| 178 | ahw->beacon_state = 0; | 178 | ahw->beacon_state = 0; |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 6f35f8404d68..d2e591955bdd 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
| @@ -524,6 +524,7 @@ rx_status_loop: | |||
| 524 | PCI_DMA_FROMDEVICE); | 524 | PCI_DMA_FROMDEVICE); |
| 525 | if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { | 525 | if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { |
| 526 | dev->stats.rx_dropped++; | 526 | dev->stats.rx_dropped++; |
| 527 | kfree_skb(new_skb); | ||
| 527 | goto rx_next; | 528 | goto rx_next; |
| 528 | } | 529 | } |
| 529 | 530 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index c9d942a5c335..1ef9d8a555aa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c | |||
| @@ -33,10 +33,15 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
| 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
| 34 | unsigned int txsize = priv->dma_tx_size; | 34 | unsigned int txsize = priv->dma_tx_size; |
| 35 | unsigned int entry = priv->cur_tx % txsize; | 35 | unsigned int entry = priv->cur_tx % txsize; |
| 36 | struct dma_desc *desc = priv->dma_tx + entry; | 36 | struct dma_desc *desc; |
| 37 | unsigned int nopaged_len = skb_headlen(skb); | 37 | unsigned int nopaged_len = skb_headlen(skb); |
| 38 | unsigned int bmax, len; | 38 | unsigned int bmax, len; |
| 39 | 39 | ||
| 40 | if (priv->extend_desc) | ||
| 41 | desc = (struct dma_desc *)(priv->dma_etx + entry); | ||
| 42 | else | ||
| 43 | desc = priv->dma_tx + entry; | ||
| 44 | |||
| 40 | if (priv->plat->enh_desc) | 45 | if (priv->plat->enh_desc) |
| 41 | bmax = BUF_SIZE_8KiB; | 46 | bmax = BUF_SIZE_8KiB; |
| 42 | else | 47 | else |
| @@ -54,7 +59,11 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
| 54 | STMMAC_RING_MODE); | 59 | STMMAC_RING_MODE); |
| 55 | wmb(); | 60 | wmb(); |
| 56 | entry = (++priv->cur_tx) % txsize; | 61 | entry = (++priv->cur_tx) % txsize; |
| 57 | desc = priv->dma_tx + entry; | 62 | |
| 63 | if (priv->extend_desc) | ||
| 64 | desc = (struct dma_desc *)(priv->dma_etx + entry); | ||
| 65 | else | ||
| 66 | desc = priv->dma_tx + entry; | ||
| 58 | 67 | ||
| 59 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, | 68 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, |
| 60 | len, DMA_TO_DEVICE); | 69 | len, DMA_TO_DEVICE); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f2ccb36e8685..0a9bb9d30c3f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -939,15 +939,20 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | |||
| 939 | 939 | ||
| 940 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, | 940 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, |
| 941 | GFP_KERNEL); | 941 | GFP_KERNEL); |
| 942 | if (unlikely(skb == NULL)) { | 942 | if (!skb) { |
| 943 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); | 943 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); |
| 944 | return 1; | 944 | return -ENOMEM; |
| 945 | } | 945 | } |
| 946 | skb_reserve(skb, NET_IP_ALIGN); | 946 | skb_reserve(skb, NET_IP_ALIGN); |
| 947 | priv->rx_skbuff[i] = skb; | 947 | priv->rx_skbuff[i] = skb; |
| 948 | priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data, | 948 | priv->rx_skbuff_dma[i] = dma_map_single(priv->device, skb->data, |
| 949 | priv->dma_buf_sz, | 949 | priv->dma_buf_sz, |
| 950 | DMA_FROM_DEVICE); | 950 | DMA_FROM_DEVICE); |
| 951 | if (dma_mapping_error(priv->device, priv->rx_skbuff_dma[i])) { | ||
| 952 | pr_err("%s: DMA mapping error\n", __func__); | ||
| 953 | dev_kfree_skb_any(skb); | ||
| 954 | return -EINVAL; | ||
| 955 | } | ||
| 951 | 956 | ||
| 952 | p->des2 = priv->rx_skbuff_dma[i]; | 957 | p->des2 = priv->rx_skbuff_dma[i]; |
| 953 | 958 | ||
| @@ -958,6 +963,16 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | |||
| 958 | return 0; | 963 | return 0; |
| 959 | } | 964 | } |
| 960 | 965 | ||
| 966 | static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i) | ||
| 967 | { | ||
| 968 | if (priv->rx_skbuff[i]) { | ||
| 969 | dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], | ||
| 970 | priv->dma_buf_sz, DMA_FROM_DEVICE); | ||
| 971 | dev_kfree_skb_any(priv->rx_skbuff[i]); | ||
| 972 | } | ||
| 973 | priv->rx_skbuff[i] = NULL; | ||
| 974 | } | ||
| 975 | |||
| 961 | /** | 976 | /** |
| 962 | * init_dma_desc_rings - init the RX/TX descriptor rings | 977 | * init_dma_desc_rings - init the RX/TX descriptor rings |
| 963 | * @dev: net device structure | 978 | * @dev: net device structure |
| @@ -965,13 +980,14 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | |||
| 965 | * and allocates the socket buffers. It suppors the chained and ring | 980 | * and allocates the socket buffers. It suppors the chained and ring |
| 966 | * modes. | 981 | * modes. |
| 967 | */ | 982 | */ |
| 968 | static void init_dma_desc_rings(struct net_device *dev) | 983 | static int init_dma_desc_rings(struct net_device *dev) |
| 969 | { | 984 | { |
| 970 | int i; | 985 | int i; |
| 971 | struct stmmac_priv *priv = netdev_priv(dev); | 986 | struct stmmac_priv *priv = netdev_priv(dev); |
| 972 | unsigned int txsize = priv->dma_tx_size; | 987 | unsigned int txsize = priv->dma_tx_size; |
| 973 | unsigned int rxsize = priv->dma_rx_size; | 988 | unsigned int rxsize = priv->dma_rx_size; |
| 974 | unsigned int bfsize = 0; | 989 | unsigned int bfsize = 0; |
| 990 | int ret = -ENOMEM; | ||
| 975 | 991 | ||
| 976 | /* Set the max buffer size according to the DESC mode | 992 | /* Set the max buffer size according to the DESC mode |
| 977 | * and the MTU. Note that RING mode allows 16KiB bsize. | 993 | * and the MTU. Note that RING mode allows 16KiB bsize. |
| @@ -992,34 +1008,60 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
| 992 | dma_extended_desc), | 1008 | dma_extended_desc), |
| 993 | &priv->dma_rx_phy, | 1009 | &priv->dma_rx_phy, |
| 994 | GFP_KERNEL); | 1010 | GFP_KERNEL); |
| 1011 | if (!priv->dma_erx) | ||
| 1012 | goto err_dma; | ||
| 1013 | |||
| 995 | priv->dma_etx = dma_alloc_coherent(priv->device, txsize * | 1014 | priv->dma_etx = dma_alloc_coherent(priv->device, txsize * |
| 996 | sizeof(struct | 1015 | sizeof(struct |
| 997 | dma_extended_desc), | 1016 | dma_extended_desc), |
| 998 | &priv->dma_tx_phy, | 1017 | &priv->dma_tx_phy, |
| 999 | GFP_KERNEL); | 1018 | GFP_KERNEL); |
| 1000 | if ((!priv->dma_erx) || (!priv->dma_etx)) | 1019 | if (!priv->dma_etx) { |
| 1001 | return; | 1020 | dma_free_coherent(priv->device, priv->dma_rx_size * |
| 1021 | sizeof(struct dma_extended_desc), | ||
| 1022 | priv->dma_erx, priv->dma_rx_phy); | ||
| 1023 | goto err_dma; | ||
| 1024 | } | ||
| 1002 | } else { | 1025 | } else { |
| 1003 | priv->dma_rx = dma_alloc_coherent(priv->device, rxsize * | 1026 | priv->dma_rx = dma_alloc_coherent(priv->device, rxsize * |
| 1004 | sizeof(struct dma_desc), | 1027 | sizeof(struct dma_desc), |
| 1005 | &priv->dma_rx_phy, | 1028 | &priv->dma_rx_phy, |
| 1006 | GFP_KERNEL); | 1029 | GFP_KERNEL); |
| 1030 | if (!priv->dma_rx) | ||
| 1031 | goto err_dma; | ||
| 1032 | |||
| 1007 | priv->dma_tx = dma_alloc_coherent(priv->device, txsize * | 1033 | priv->dma_tx = dma_alloc_coherent(priv->device, txsize * |
| 1008 | sizeof(struct dma_desc), | 1034 | sizeof(struct dma_desc), |
| 1009 | &priv->dma_tx_phy, | 1035 | &priv->dma_tx_phy, |
| 1010 | GFP_KERNEL); | 1036 | GFP_KERNEL); |
| 1011 | if ((!priv->dma_rx) || (!priv->dma_tx)) | 1037 | if (!priv->dma_tx) { |
| 1012 | return; | 1038 | dma_free_coherent(priv->device, priv->dma_rx_size * |
| 1039 | sizeof(struct dma_desc), | ||
| 1040 | priv->dma_rx, priv->dma_rx_phy); | ||
| 1041 | goto err_dma; | ||
| 1042 | } | ||
| 1013 | } | 1043 | } |
| 1014 | 1044 | ||
| 1015 | priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t), | 1045 | priv->rx_skbuff_dma = kmalloc_array(rxsize, sizeof(dma_addr_t), |
| 1016 | GFP_KERNEL); | 1046 | GFP_KERNEL); |
| 1047 | if (!priv->rx_skbuff_dma) | ||
| 1048 | goto err_rx_skbuff_dma; | ||
| 1049 | |||
| 1017 | priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *), | 1050 | priv->rx_skbuff = kmalloc_array(rxsize, sizeof(struct sk_buff *), |
| 1018 | GFP_KERNEL); | 1051 | GFP_KERNEL); |
| 1052 | if (!priv->rx_skbuff) | ||
| 1053 | goto err_rx_skbuff; | ||
| 1054 | |||
| 1019 | priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), | 1055 | priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), |
| 1020 | GFP_KERNEL); | 1056 | GFP_KERNEL); |
| 1057 | if (!priv->tx_skbuff_dma) | ||
| 1058 | goto err_tx_skbuff_dma; | ||
| 1059 | |||
| 1021 | priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *), | 1060 | priv->tx_skbuff = kmalloc_array(txsize, sizeof(struct sk_buff *), |
| 1022 | GFP_KERNEL); | 1061 | GFP_KERNEL); |
| 1062 | if (!priv->tx_skbuff) | ||
| 1063 | goto err_tx_skbuff; | ||
| 1064 | |||
| 1023 | if (netif_msg_probe(priv)) { | 1065 | if (netif_msg_probe(priv)) { |
| 1024 | pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__, | 1066 | pr_debug("(%s) dma_rx_phy=0x%08x dma_tx_phy=0x%08x\n", __func__, |
| 1025 | (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy); | 1067 | (u32) priv->dma_rx_phy, (u32) priv->dma_tx_phy); |
| @@ -1034,8 +1076,9 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
| 1034 | else | 1076 | else |
| 1035 | p = priv->dma_rx + i; | 1077 | p = priv->dma_rx + i; |
| 1036 | 1078 | ||
| 1037 | if (stmmac_init_rx_buffers(priv, p, i)) | 1079 | ret = stmmac_init_rx_buffers(priv, p, i); |
| 1038 | break; | 1080 | if (ret) |
| 1081 | goto err_init_rx_buffers; | ||
| 1039 | 1082 | ||
| 1040 | if (netif_msg_probe(priv)) | 1083 | if (netif_msg_probe(priv)) |
| 1041 | pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i], | 1084 | pr_debug("[%p]\t[%p]\t[%x]\n", priv->rx_skbuff[i], |
| @@ -1081,20 +1124,44 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
| 1081 | 1124 | ||
| 1082 | if (netif_msg_hw(priv)) | 1125 | if (netif_msg_hw(priv)) |
| 1083 | stmmac_display_rings(priv); | 1126 | stmmac_display_rings(priv); |
| 1127 | |||
| 1128 | return 0; | ||
| 1129 | err_init_rx_buffers: | ||
| 1130 | while (--i >= 0) | ||
| 1131 | stmmac_free_rx_buffers(priv, i); | ||
| 1132 | kfree(priv->tx_skbuff); | ||
| 1133 | err_tx_skbuff: | ||
| 1134 | kfree(priv->tx_skbuff_dma); | ||
| 1135 | err_tx_skbuff_dma: | ||
| 1136 | kfree(priv->rx_skbuff); | ||
| 1137 | err_rx_skbuff: | ||
| 1138 | kfree(priv->rx_skbuff_dma); | ||
| 1139 | err_rx_skbuff_dma: | ||
| 1140 | if (priv->extend_desc) { | ||
| 1141 | dma_free_coherent(priv->device, priv->dma_tx_size * | ||
| 1142 | sizeof(struct dma_extended_desc), | ||
| 1143 | priv->dma_etx, priv->dma_tx_phy); | ||
| 1144 | dma_free_coherent(priv->device, priv->dma_rx_size * | ||
| 1145 | sizeof(struct dma_extended_desc), | ||
| 1146 | priv->dma_erx, priv->dma_rx_phy); | ||
| 1147 | } else { | ||
| 1148 | dma_free_coherent(priv->device, | ||
| 1149 | priv->dma_tx_size * sizeof(struct dma_desc), | ||
| 1150 | priv->dma_tx, priv->dma_tx_phy); | ||
| 1151 | dma_free_coherent(priv->device, | ||
| 1152 | priv->dma_rx_size * sizeof(struct dma_desc), | ||
| 1153 | priv->dma_rx, priv->dma_rx_phy); | ||
| 1154 | } | ||
| 1155 | err_dma: | ||
| 1156 | return ret; | ||
| 1084 | } | 1157 | } |
| 1085 | 1158 | ||
| 1086 | static void dma_free_rx_skbufs(struct stmmac_priv *priv) | 1159 | static void dma_free_rx_skbufs(struct stmmac_priv *priv) |
| 1087 | { | 1160 | { |
| 1088 | int i; | 1161 | int i; |
| 1089 | 1162 | ||
| 1090 | for (i = 0; i < priv->dma_rx_size; i++) { | 1163 | for (i = 0; i < priv->dma_rx_size; i++) |
| 1091 | if (priv->rx_skbuff[i]) { | 1164 | stmmac_free_rx_buffers(priv, i); |
| 1092 | dma_unmap_single(priv->device, priv->rx_skbuff_dma[i], | ||
| 1093 | priv->dma_buf_sz, DMA_FROM_DEVICE); | ||
| 1094 | dev_kfree_skb_any(priv->rx_skbuff[i]); | ||
| 1095 | } | ||
| 1096 | priv->rx_skbuff[i] = NULL; | ||
| 1097 | } | ||
| 1098 | } | 1165 | } |
| 1099 | 1166 | ||
| 1100 | static void dma_free_tx_skbufs(struct stmmac_priv *priv) | 1167 | static void dma_free_tx_skbufs(struct stmmac_priv *priv) |
| @@ -1560,12 +1627,17 @@ static int stmmac_open(struct net_device *dev) | |||
| 1560 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); | 1627 | priv->dma_tx_size = STMMAC_ALIGN(dma_txsize); |
| 1561 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); | 1628 | priv->dma_rx_size = STMMAC_ALIGN(dma_rxsize); |
| 1562 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); | 1629 | priv->dma_buf_sz = STMMAC_ALIGN(buf_sz); |
| 1563 | init_dma_desc_rings(dev); | 1630 | |
| 1631 | ret = init_dma_desc_rings(dev); | ||
| 1632 | if (ret < 0) { | ||
| 1633 | pr_err("%s: DMA descriptors initialization failed\n", __func__); | ||
| 1634 | goto dma_desc_error; | ||
| 1635 | } | ||
| 1564 | 1636 | ||
| 1565 | /* DMA initialization and SW reset */ | 1637 | /* DMA initialization and SW reset */ |
| 1566 | ret = stmmac_init_dma_engine(priv); | 1638 | ret = stmmac_init_dma_engine(priv); |
| 1567 | if (ret < 0) { | 1639 | if (ret < 0) { |
| 1568 | pr_err("%s: DMA initialization failed\n", __func__); | 1640 | pr_err("%s: DMA engine initialization failed\n", __func__); |
| 1569 | goto init_error; | 1641 | goto init_error; |
| 1570 | } | 1642 | } |
| 1571 | 1643 | ||
| @@ -1672,6 +1744,7 @@ wolirq_error: | |||
| 1672 | 1744 | ||
| 1673 | init_error: | 1745 | init_error: |
| 1674 | free_dma_desc_resources(priv); | 1746 | free_dma_desc_resources(priv); |
| 1747 | dma_desc_error: | ||
| 1675 | if (priv->phydev) | 1748 | if (priv->phydev) |
| 1676 | phy_disconnect(priv->phydev); | 1749 | phy_disconnect(priv->phydev); |
| 1677 | phy_error: | 1750 | phy_error: |
diff --git a/drivers/net/ethernet/via/via-velocity.c b/drivers/net/ethernet/via/via-velocity.c index 1d6dc41f755d..d01cacf8a7c2 100644 --- a/drivers/net/ethernet/via/via-velocity.c +++ b/drivers/net/ethernet/via/via-velocity.c | |||
| @@ -2100,7 +2100,7 @@ static int velocity_receive_frame(struct velocity_info *vptr, int idx) | |||
| 2100 | 2100 | ||
| 2101 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); | 2101 | __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid); |
| 2102 | } | 2102 | } |
| 2103 | netif_rx(skb); | 2103 | netif_receive_skb(skb); |
| 2104 | 2104 | ||
| 2105 | stats->rx_bytes += pkt_len; | 2105 | stats->rx_bytes += pkt_len; |
| 2106 | stats->rx_packets++; | 2106 | stats->rx_packets++; |
| @@ -2884,6 +2884,7 @@ out: | |||
| 2884 | return ret; | 2884 | return ret; |
| 2885 | 2885 | ||
| 2886 | err_iounmap: | 2886 | err_iounmap: |
| 2887 | netif_napi_del(&vptr->napi); | ||
| 2887 | iounmap(regs); | 2888 | iounmap(regs); |
| 2888 | err_free_dev: | 2889 | err_free_dev: |
| 2889 | free_netdev(netdev); | 2890 | free_netdev(netdev); |
| @@ -2904,6 +2905,7 @@ static int velocity_remove(struct device *dev) | |||
| 2904 | struct velocity_info *vptr = netdev_priv(netdev); | 2905 | struct velocity_info *vptr = netdev_priv(netdev); |
| 2905 | 2906 | ||
| 2906 | unregister_netdev(netdev); | 2907 | unregister_netdev(netdev); |
| 2908 | netif_napi_del(&vptr->napi); | ||
| 2907 | iounmap(vptr->mac_regs); | 2909 | iounmap(vptr->mac_regs); |
| 2908 | free_netdev(netdev); | 2910 | free_netdev(netdev); |
| 2909 | velocity_nics--; | 2911 | velocity_nics--; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index d0f9c2fd1d4f..16b43bf544b7 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
| @@ -739,6 +739,10 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[]) | |||
| 739 | return -EADDRNOTAVAIL; | 739 | return -EADDRNOTAVAIL; |
| 740 | } | 740 | } |
| 741 | 741 | ||
| 742 | if (data && data[IFLA_MACVLAN_FLAGS] && | ||
| 743 | nla_get_u16(data[IFLA_MACVLAN_FLAGS]) & ~MACVLAN_FLAG_NOPROMISC) | ||
| 744 | return -EINVAL; | ||
| 745 | |||
| 742 | if (data && data[IFLA_MACVLAN_MODE]) { | 746 | if (data && data[IFLA_MACVLAN_MODE]) { |
| 743 | switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) { | 747 | switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) { |
| 744 | case MACVLAN_MODE_PRIVATE: | 748 | case MACVLAN_MODE_PRIVATE: |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index a98fb0ed6aef..b51db2abfe44 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
| @@ -818,10 +818,13 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, | |||
| 818 | skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; | 818 | skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; |
| 819 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; | 819 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; |
| 820 | } | 820 | } |
| 821 | if (vlan) | 821 | if (vlan) { |
| 822 | local_bh_disable(); | ||
| 822 | macvlan_start_xmit(skb, vlan->dev); | 823 | macvlan_start_xmit(skb, vlan->dev); |
| 823 | else | 824 | local_bh_enable(); |
| 825 | } else { | ||
| 824 | kfree_skb(skb); | 826 | kfree_skb(skb); |
| 827 | } | ||
| 825 | rcu_read_unlock(); | 828 | rcu_read_unlock(); |
| 826 | 829 | ||
| 827 | return total_len; | 830 | return total_len; |
| @@ -912,8 +915,11 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, | |||
| 912 | done: | 915 | done: |
| 913 | rcu_read_lock(); | 916 | rcu_read_lock(); |
| 914 | vlan = rcu_dereference(q->vlan); | 917 | vlan = rcu_dereference(q->vlan); |
| 915 | if (vlan) | 918 | if (vlan) { |
| 919 | preempt_disable(); | ||
| 916 | macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); | 920 | macvlan_count_rx(vlan, copied - vnet_hdr_len, ret == 0, 0); |
| 921 | preempt_enable(); | ||
| 922 | } | ||
| 917 | rcu_read_unlock(); | 923 | rcu_read_unlock(); |
| 918 | 924 | ||
| 919 | return ret ? ret : copied; | 925 | return ret ? ret : copied; |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index db690a372260..71af122edf2d 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
| @@ -1074,8 +1074,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1074 | u32 rxhash; | 1074 | u32 rxhash; |
| 1075 | 1075 | ||
| 1076 | if (!(tun->flags & TUN_NO_PI)) { | 1076 | if (!(tun->flags & TUN_NO_PI)) { |
| 1077 | if ((len -= sizeof(pi)) > total_len) | 1077 | if (len < sizeof(pi)) |
| 1078 | return -EINVAL; | 1078 | return -EINVAL; |
| 1079 | len -= sizeof(pi); | ||
| 1079 | 1080 | ||
| 1080 | if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) | 1081 | if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) |
| 1081 | return -EFAULT; | 1082 | return -EFAULT; |
| @@ -1083,8 +1084,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1083 | } | 1084 | } |
| 1084 | 1085 | ||
| 1085 | if (tun->flags & TUN_VNET_HDR) { | 1086 | if (tun->flags & TUN_VNET_HDR) { |
| 1086 | if ((len -= tun->vnet_hdr_sz) > total_len) | 1087 | if (len < tun->vnet_hdr_sz) |
| 1087 | return -EINVAL; | 1088 | return -EINVAL; |
| 1089 | len -= tun->vnet_hdr_sz; | ||
| 1088 | 1090 | ||
| 1089 | if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) | 1091 | if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) |
| 1090 | return -EFAULT; | 1092 | return -EFAULT; |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index f4c6db419ddb..767f7af3bd40 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
| @@ -1386,7 +1386,7 @@ static int vxlan_open(struct net_device *dev) | |||
| 1386 | return -ENOTCONN; | 1386 | return -ENOTCONN; |
| 1387 | 1387 | ||
| 1388 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && | 1388 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && |
| 1389 | ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { | 1389 | vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { |
| 1390 | vxlan_sock_hold(vs); | 1390 | vxlan_sock_hold(vs); |
| 1391 | dev_hold(dev); | 1391 | dev_hold(dev); |
| 1392 | queue_work(vxlan_wq, &vxlan->igmp_join); | 1392 | queue_work(vxlan_wq, &vxlan->igmp_join); |
| @@ -1793,8 +1793,6 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head) | |||
| 1793 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); | 1793 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); |
| 1794 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1794 | struct vxlan_dev *vxlan = netdev_priv(dev); |
| 1795 | 1795 | ||
| 1796 | flush_workqueue(vxlan_wq); | ||
| 1797 | |||
| 1798 | spin_lock(&vn->sock_lock); | 1796 | spin_lock(&vn->sock_lock); |
| 1799 | hlist_del_rcu(&vxlan->hlist); | 1797 | hlist_del_rcu(&vxlan->hlist); |
| 1800 | spin_unlock(&vn->sock_lock); | 1798 | spin_unlock(&vn->sock_lock); |
diff --git a/drivers/net/wireless/cw1200/sta.c b/drivers/net/wireless/cw1200/sta.c index 7365674366f4..010b252be584 100644 --- a/drivers/net/wireless/cw1200/sta.c +++ b/drivers/net/wireless/cw1200/sta.c | |||
| @@ -1406,11 +1406,8 @@ static void cw1200_do_unjoin(struct cw1200_common *priv) | |||
| 1406 | if (!priv->join_status) | 1406 | if (!priv->join_status) |
| 1407 | goto done; | 1407 | goto done; |
| 1408 | 1408 | ||
| 1409 | if (priv->join_status > CW1200_JOIN_STATUS_IBSS) { | 1409 | if (priv->join_status == CW1200_JOIN_STATUS_AP) |
| 1410 | wiphy_err(priv->hw->wiphy, "Unexpected: join status: %d\n", | 1410 | goto done; |
| 1411 | priv->join_status); | ||
| 1412 | BUG_ON(1); | ||
| 1413 | } | ||
| 1414 | 1411 | ||
| 1415 | cancel_work_sync(&priv->update_filtering_work); | 1412 | cancel_work_sync(&priv->update_filtering_work); |
| 1416 | cancel_work_sync(&priv->set_beacon_wakeup_period_work); | 1413 | cancel_work_sync(&priv->set_beacon_wakeup_period_work); |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index b9b2bb51e605..f2ed62e37340 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
| @@ -4460,12 +4460,12 @@ il4965_irq_tasklet(struct il_priv *il) | |||
| 4460 | * is killed. Hence update the killswitch state here. The | 4460 | * is killed. Hence update the killswitch state here. The |
| 4461 | * rfkill handler will care about restarting if needed. | 4461 | * rfkill handler will care about restarting if needed. |
| 4462 | */ | 4462 | */ |
| 4463 | if (!test_bit(S_ALIVE, &il->status)) { | 4463 | if (hw_rf_kill) { |
| 4464 | if (hw_rf_kill) | 4464 | set_bit(S_RFKILL, &il->status); |
| 4465 | set_bit(S_RFKILL, &il->status); | 4465 | } else { |
| 4466 | else | 4466 | clear_bit(S_RFKILL, &il->status); |
| 4467 | clear_bit(S_RFKILL, &il->status); | ||
| 4468 | wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); | 4467 | wiphy_rfkill_set_hw_state(il->hw->wiphy, hw_rf_kill); |
| 4468 | il_force_reset(il, true); | ||
| 4469 | } | 4469 | } |
| 4470 | 4470 | ||
| 4471 | handled |= CSR_INT_BIT_RF_KILL; | 4471 | handled |= CSR_INT_BIT_RF_KILL; |
| @@ -5334,6 +5334,9 @@ il4965_alive_start(struct il_priv *il) | |||
| 5334 | 5334 | ||
| 5335 | il->active_rate = RATES_MASK; | 5335 | il->active_rate = RATES_MASK; |
| 5336 | 5336 | ||
| 5337 | il_power_update_mode(il, true); | ||
| 5338 | D_INFO("Updated power mode\n"); | ||
| 5339 | |||
| 5337 | if (il_is_associated(il)) { | 5340 | if (il_is_associated(il)) { |
| 5338 | struct il_rxon_cmd *active_rxon = | 5341 | struct il_rxon_cmd *active_rxon = |
| 5339 | (struct il_rxon_cmd *)&il->active; | 5342 | (struct il_rxon_cmd *)&il->active; |
| @@ -5364,9 +5367,6 @@ il4965_alive_start(struct il_priv *il) | |||
| 5364 | D_INFO("ALIVE processing complete.\n"); | 5367 | D_INFO("ALIVE processing complete.\n"); |
| 5365 | wake_up(&il->wait_command_queue); | 5368 | wake_up(&il->wait_command_queue); |
| 5366 | 5369 | ||
| 5367 | il_power_update_mode(il, true); | ||
| 5368 | D_INFO("Updated power mode\n"); | ||
| 5369 | |||
| 5370 | return; | 5370 | return; |
| 5371 | 5371 | ||
| 5372 | restart: | 5372 | restart: |
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 3195aad440dd..b03e22ef5462 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
| @@ -4660,6 +4660,7 @@ il_force_reset(struct il_priv *il, bool external) | |||
| 4660 | 4660 | ||
| 4661 | return 0; | 4661 | return 0; |
| 4662 | } | 4662 | } |
| 4663 | EXPORT_SYMBOL(il_force_reset); | ||
| 4663 | 4664 | ||
| 4664 | int | 4665 | int |
| 4665 | il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 4666 | il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h index 737685e9e852..68029b30c3dc 100644 --- a/include/linux/mlx5/device.h +++ b/include/linux/mlx5/device.h | |||
| @@ -309,21 +309,20 @@ struct mlx5_hca_cap { | |||
| 309 | __be16 max_desc_sz_rq; | 309 | __be16 max_desc_sz_rq; |
| 310 | u8 rsvd21[2]; | 310 | u8 rsvd21[2]; |
| 311 | __be16 max_desc_sz_sq_dc; | 311 | __be16 max_desc_sz_sq_dc; |
| 312 | u8 rsvd22[4]; | 312 | __be32 max_qp_mcg; |
| 313 | __be16 max_qp_mcg; | 313 | u8 rsvd22[3]; |
| 314 | u8 rsvd23; | ||
| 315 | u8 log_max_mcg; | 314 | u8 log_max_mcg; |
| 316 | u8 rsvd24; | 315 | u8 rsvd23; |
| 317 | u8 log_max_pd; | 316 | u8 log_max_pd; |
| 318 | u8 rsvd25; | 317 | u8 rsvd24; |
| 319 | u8 log_max_xrcd; | 318 | u8 log_max_xrcd; |
| 320 | u8 rsvd26[42]; | 319 | u8 rsvd25[42]; |
| 321 | __be16 log_uar_page_sz; | 320 | __be16 log_uar_page_sz; |
| 322 | u8 rsvd27[28]; | 321 | u8 rsvd26[28]; |
| 323 | u8 log_msx_atomic_size_qp; | 322 | u8 log_msx_atomic_size_qp; |
| 324 | u8 rsvd28[2]; | 323 | u8 rsvd27[2]; |
| 325 | u8 log_msx_atomic_size_dc; | 324 | u8 log_msx_atomic_size_dc; |
| 326 | u8 rsvd29[76]; | 325 | u8 rsvd28[76]; |
| 327 | }; | 326 | }; |
| 328 | 327 | ||
| 329 | 328 | ||
| @@ -472,9 +471,8 @@ struct mlx5_eqe_cmd { | |||
| 472 | struct mlx5_eqe_page_req { | 471 | struct mlx5_eqe_page_req { |
| 473 | u8 rsvd0[2]; | 472 | u8 rsvd0[2]; |
| 474 | __be16 func_id; | 473 | __be16 func_id; |
| 475 | u8 rsvd1[2]; | 474 | __be32 num_pages; |
| 476 | __be16 num_pages; | 475 | __be32 rsvd1[5]; |
| 477 | __be32 rsvd2[5]; | ||
| 478 | }; | 476 | }; |
| 479 | 477 | ||
| 480 | union ev_data { | 478 | union ev_data { |
diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 2aa258b0ced1..8888381fc150 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h | |||
| @@ -358,7 +358,7 @@ struct mlx5_caps { | |||
| 358 | u32 reserved_lkey; | 358 | u32 reserved_lkey; |
| 359 | u8 local_ca_ack_delay; | 359 | u8 local_ca_ack_delay; |
| 360 | u8 log_max_mcg; | 360 | u8 log_max_mcg; |
| 361 | u16 max_qp_mcg; | 361 | u32 max_qp_mcg; |
| 362 | int min_page_sz; | 362 | int min_page_sz; |
| 363 | }; | 363 | }; |
| 364 | 364 | ||
| @@ -691,7 +691,7 @@ void mlx5_pagealloc_cleanup(struct mlx5_core_dev *dev); | |||
| 691 | int mlx5_pagealloc_start(struct mlx5_core_dev *dev); | 691 | int mlx5_pagealloc_start(struct mlx5_core_dev *dev); |
| 692 | void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); | 692 | void mlx5_pagealloc_stop(struct mlx5_core_dev *dev); |
| 693 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | 693 | void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, |
| 694 | s16 npages); | 694 | s32 npages); |
| 695 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); | 695 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot); |
| 696 | int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); | 696 | int mlx5_reclaim_startup_pages(struct mlx5_core_dev *dev); |
| 697 | void mlx5_register_debugfs(void); | 697 | void mlx5_register_debugfs(void); |
| @@ -731,9 +731,6 @@ void mlx5_cq_debugfs_cleanup(struct mlx5_core_dev *dev); | |||
| 731 | int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); | 731 | int mlx5_db_alloc(struct mlx5_core_dev *dev, struct mlx5_db *db); |
| 732 | void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); | 732 | void mlx5_db_free(struct mlx5_core_dev *dev, struct mlx5_db *db); |
| 733 | 733 | ||
| 734 | typedef void (*health_handler_t)(struct pci_dev *pdev, struct health_buffer __iomem *buf, int size); | ||
| 735 | int mlx5_register_health_report_handler(health_handler_t handler); | ||
| 736 | void mlx5_unregister_health_report_handler(void); | ||
| 737 | const char *mlx5_command_str(int command); | 734 | const char *mlx5_command_str(int command); |
| 738 | int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); | 735 | int mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev); |
| 739 | void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); | 736 | void mlx5_cmdif_debugfs_cleanup(struct mlx5_core_dev *dev); |
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index f18b91966d3d..8a358a2c97e6 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h | |||
| @@ -122,7 +122,7 @@ static inline bool sk_busy_loop(struct sock *sk, int nonblock) | |||
| 122 | if (rc > 0) | 122 | if (rc > 0) |
| 123 | /* local bh are disabled so it is ok to use _BH */ | 123 | /* local bh are disabled so it is ok to use _BH */ |
| 124 | NET_ADD_STATS_BH(sock_net(sk), | 124 | NET_ADD_STATS_BH(sock_net(sk), |
| 125 | LINUX_MIB_LOWLATENCYRXPACKETS, rc); | 125 | LINUX_MIB_BUSYPOLLRXPACKETS, rc); |
| 126 | 126 | ||
| 127 | } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) && | 127 | } while (!nonblock && skb_queue_empty(&sk->sk_receive_queue) && |
| 128 | !need_resched() && !busy_loop_timeout(end_time)); | 128 | !need_resched() && !busy_loop_timeout(end_time)); |
| @@ -162,11 +162,6 @@ static inline bool sk_can_busy_loop(struct sock *sk) | |||
| 162 | return false; | 162 | return false; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | static inline bool sk_busy_poll(struct sock *sk, int nonblock) | ||
| 166 | { | ||
| 167 | return false; | ||
| 168 | } | ||
| 169 | |||
| 170 | static inline void skb_mark_napi_id(struct sk_buff *skb, | 165 | static inline void skb_mark_napi_id(struct sk_buff *skb, |
| 171 | struct napi_struct *napi) | 166 | struct napi_struct *napi) |
| 172 | { | 167 | { |
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h index 781b3cf86a2f..a354db5b7662 100644 --- a/include/net/ip_tunnels.h +++ b/include/net/ip_tunnels.h | |||
| @@ -145,20 +145,6 @@ static inline u8 ip_tunnel_ecn_encap(u8 tos, const struct iphdr *iph, | |||
| 145 | return INET_ECN_encapsulate(tos, inner); | 145 | return INET_ECN_encapsulate(tos, inner); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static inline void tunnel_ip_select_ident(struct sk_buff *skb, | ||
| 149 | const struct iphdr *old_iph, | ||
| 150 | struct dst_entry *dst) | ||
| 151 | { | ||
| 152 | struct iphdr *iph = ip_hdr(skb); | ||
| 153 | |||
| 154 | /* Use inner packet iph-id if possible. */ | ||
| 155 | if (skb->protocol == htons(ETH_P_IP) && old_iph->id) | ||
| 156 | iph->id = old_iph->id; | ||
| 157 | else | ||
| 158 | __ip_select_ident(iph, dst, | ||
| 159 | (skb_shinfo(skb)->gso_segs ?: 1) - 1); | ||
| 160 | } | ||
| 161 | |||
| 162 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); | 148 | int iptunnel_pull_header(struct sk_buff *skb, int hdr_len, __be16 inner_proto); |
| 163 | int iptunnel_xmit(struct net *net, struct rtable *rt, | 149 | int iptunnel_xmit(struct net *net, struct rtable *rt, |
| 164 | struct sk_buff *skb, | 150 | struct sk_buff *skb, |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 6eab63363e59..e5ae0c50fa9c 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -683,13 +683,19 @@ struct psched_ratecfg { | |||
| 683 | u64 rate_bytes_ps; /* bytes per second */ | 683 | u64 rate_bytes_ps; /* bytes per second */ |
| 684 | u32 mult; | 684 | u32 mult; |
| 685 | u16 overhead; | 685 | u16 overhead; |
| 686 | u8 linklayer; | ||
| 686 | u8 shift; | 687 | u8 shift; |
| 687 | }; | 688 | }; |
| 688 | 689 | ||
| 689 | static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, | 690 | static inline u64 psched_l2t_ns(const struct psched_ratecfg *r, |
| 690 | unsigned int len) | 691 | unsigned int len) |
| 691 | { | 692 | { |
| 692 | return ((u64)(len + r->overhead) * r->mult) >> r->shift; | 693 | len += r->overhead; |
| 694 | |||
| 695 | if (unlikely(r->linklayer == TC_LINKLAYER_ATM)) | ||
| 696 | return ((u64)(DIV_ROUND_UP(len,48)*53) * r->mult) >> r->shift; | ||
| 697 | |||
| 698 | return ((u64)len * r->mult) >> r->shift; | ||
| 693 | } | 699 | } |
| 694 | 700 | ||
| 695 | extern void psched_ratecfg_precompute(struct psched_ratecfg *r, const struct tc_ratespec *conf); | 701 | extern void psched_ratecfg_precompute(struct psched_ratecfg *r, const struct tc_ratespec *conf); |
| @@ -700,6 +706,7 @@ static inline void psched_ratecfg_getrate(struct tc_ratespec *res, | |||
| 700 | memset(res, 0, sizeof(*res)); | 706 | memset(res, 0, sizeof(*res)); |
| 701 | res->rate = r->rate_bytes_ps; | 707 | res->rate = r->rate_bytes_ps; |
| 702 | res->overhead = r->overhead; | 708 | res->overhead = r->overhead; |
| 709 | res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); | ||
| 703 | } | 710 | } |
| 704 | 711 | ||
| 705 | #endif | 712 | #endif |
diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index dbd71b0c7d8c..09d62b9228ff 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h | |||
| @@ -73,9 +73,17 @@ struct tc_estimator { | |||
| 73 | #define TC_H_ROOT (0xFFFFFFFFU) | 73 | #define TC_H_ROOT (0xFFFFFFFFU) |
| 74 | #define TC_H_INGRESS (0xFFFFFFF1U) | 74 | #define TC_H_INGRESS (0xFFFFFFF1U) |
| 75 | 75 | ||
| 76 | /* Need to corrospond to iproute2 tc/tc_core.h "enum link_layer" */ | ||
| 77 | enum tc_link_layer { | ||
| 78 | TC_LINKLAYER_UNAWARE, /* Indicate unaware old iproute2 util */ | ||
| 79 | TC_LINKLAYER_ETHERNET, | ||
| 80 | TC_LINKLAYER_ATM, | ||
| 81 | }; | ||
| 82 | #define TC_LINKLAYER_MASK 0x0F /* limit use to lower 4 bits */ | ||
| 83 | |||
| 76 | struct tc_ratespec { | 84 | struct tc_ratespec { |
| 77 | unsigned char cell_log; | 85 | unsigned char cell_log; |
| 78 | unsigned char __reserved; | 86 | __u8 linklayer; /* lower 4 bits */ |
| 79 | unsigned short overhead; | 87 | unsigned short overhead; |
| 80 | short cell_align; | 88 | short cell_align; |
| 81 | unsigned short mpu; | 89 | unsigned short mpu; |
diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index af0a674cc677..a1356d3b54df 100644 --- a/include/uapi/linux/snmp.h +++ b/include/uapi/linux/snmp.h | |||
| @@ -253,7 +253,7 @@ enum | |||
| 253 | LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ | 253 | LINUX_MIB_TCPFASTOPENLISTENOVERFLOW, /* TCPFastOpenListenOverflow */ |
| 254 | LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ | 254 | LINUX_MIB_TCPFASTOPENCOOKIEREQD, /* TCPFastOpenCookieReqd */ |
| 255 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ | 255 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES, /* TCPSpuriousRtxHostQueues */ |
| 256 | LINUX_MIB_LOWLATENCYRXPACKETS, /* LowLatencyRxPackets */ | 256 | LINUX_MIB_BUSYPOLLRXPACKETS, /* BusyPollRxPackets */ |
| 257 | __LINUX_MIB_MAX | 257 | __LINUX_MIB_MAX |
| 258 | }; | 258 | }; |
| 259 | 259 | ||
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 4a78c4de9f20..6ee48aac776f 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
| @@ -91,7 +91,12 @@ EXPORT_SYMBOL(__vlan_find_dev_deep); | |||
| 91 | 91 | ||
| 92 | struct net_device *vlan_dev_real_dev(const struct net_device *dev) | 92 | struct net_device *vlan_dev_real_dev(const struct net_device *dev) |
| 93 | { | 93 | { |
| 94 | return vlan_dev_priv(dev)->real_dev; | 94 | struct net_device *ret = vlan_dev_priv(dev)->real_dev; |
| 95 | |||
| 96 | while (is_vlan_dev(ret)) | ||
| 97 | ret = vlan_dev_priv(ret)->real_dev; | ||
| 98 | |||
| 99 | return ret; | ||
| 95 | } | 100 | } |
| 96 | EXPORT_SYMBOL(vlan_dev_real_dev); | 101 | EXPORT_SYMBOL(vlan_dev_real_dev); |
| 97 | 102 | ||
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index e14531f1ce1c..264de88db320 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
| @@ -1529,6 +1529,8 @@ out: | |||
| 1529 | * in these cases, the skb is further handled by this function and | 1529 | * in these cases, the skb is further handled by this function and |
| 1530 | * returns 1, otherwise it returns 0 and the caller shall further | 1530 | * returns 1, otherwise it returns 0 and the caller shall further |
| 1531 | * process the skb. | 1531 | * process the skb. |
| 1532 | * | ||
| 1533 | * This call might reallocate skb data. | ||
| 1532 | */ | 1534 | */ |
| 1533 | int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, | 1535 | int batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb, |
| 1534 | unsigned short vid) | 1536 | unsigned short vid) |
diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index f105219f4a4b..7614af31daff 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c | |||
| @@ -508,6 +508,7 @@ out: | |||
| 508 | return 0; | 508 | return 0; |
| 509 | } | 509 | } |
| 510 | 510 | ||
| 511 | /* this call might reallocate skb data */ | ||
| 511 | static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) | 512 | static bool batadv_is_type_dhcprequest(struct sk_buff *skb, int header_len) |
| 512 | { | 513 | { |
| 513 | int ret = false; | 514 | int ret = false; |
| @@ -568,6 +569,7 @@ out: | |||
| 568 | return ret; | 569 | return ret; |
| 569 | } | 570 | } |
| 570 | 571 | ||
| 572 | /* this call might reallocate skb data */ | ||
| 571 | bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | 573 | bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) |
| 572 | { | 574 | { |
| 573 | struct ethhdr *ethhdr; | 575 | struct ethhdr *ethhdr; |
| @@ -619,6 +621,12 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
| 619 | 621 | ||
| 620 | if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr))) | 622 | if (!pskb_may_pull(skb, *header_len + sizeof(*udphdr))) |
| 621 | return false; | 623 | return false; |
| 624 | |||
| 625 | /* skb->data might have been reallocated by pskb_may_pull() */ | ||
| 626 | ethhdr = (struct ethhdr *)skb->data; | ||
| 627 | if (ntohs(ethhdr->h_proto) == ETH_P_8021Q) | ||
| 628 | ethhdr = (struct ethhdr *)(skb->data + VLAN_HLEN); | ||
| 629 | |||
| 622 | udphdr = (struct udphdr *)(skb->data + *header_len); | 630 | udphdr = (struct udphdr *)(skb->data + *header_len); |
| 623 | *header_len += sizeof(*udphdr); | 631 | *header_len += sizeof(*udphdr); |
| 624 | 632 | ||
| @@ -634,12 +642,14 @@ bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len) | |||
| 634 | return true; | 642 | return true; |
| 635 | } | 643 | } |
| 636 | 644 | ||
| 645 | /* this call might reallocate skb data */ | ||
| 637 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | 646 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, |
| 638 | struct sk_buff *skb, struct ethhdr *ethhdr) | 647 | struct sk_buff *skb) |
| 639 | { | 648 | { |
| 640 | struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; | 649 | struct batadv_neigh_node *neigh_curr = NULL, *neigh_old = NULL; |
| 641 | struct batadv_orig_node *orig_dst_node = NULL; | 650 | struct batadv_orig_node *orig_dst_node = NULL; |
| 642 | struct batadv_gw_node *curr_gw = NULL; | 651 | struct batadv_gw_node *curr_gw = NULL; |
| 652 | struct ethhdr *ethhdr; | ||
| 643 | bool ret, out_of_range = false; | 653 | bool ret, out_of_range = false; |
| 644 | unsigned int header_len = 0; | 654 | unsigned int header_len = 0; |
| 645 | uint8_t curr_tq_avg; | 655 | uint8_t curr_tq_avg; |
| @@ -648,6 +658,7 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | |||
| 648 | if (!ret) | 658 | if (!ret) |
| 649 | goto out; | 659 | goto out; |
| 650 | 660 | ||
| 661 | ethhdr = (struct ethhdr *)skb->data; | ||
| 651 | orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, | 662 | orig_dst_node = batadv_transtable_search(bat_priv, ethhdr->h_source, |
| 652 | ethhdr->h_dest); | 663 | ethhdr->h_dest); |
| 653 | if (!orig_dst_node) | 664 | if (!orig_dst_node) |
diff --git a/net/batman-adv/gateway_client.h b/net/batman-adv/gateway_client.h index 039902dca4a6..1037d75da51f 100644 --- a/net/batman-adv/gateway_client.h +++ b/net/batman-adv/gateway_client.h | |||
| @@ -34,7 +34,6 @@ void batadv_gw_node_delete(struct batadv_priv *bat_priv, | |||
| 34 | void batadv_gw_node_purge(struct batadv_priv *bat_priv); | 34 | void batadv_gw_node_purge(struct batadv_priv *bat_priv); |
| 35 | int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset); | 35 | int batadv_gw_client_seq_print_text(struct seq_file *seq, void *offset); |
| 36 | bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len); | 36 | bool batadv_gw_is_dhcp_target(struct sk_buff *skb, unsigned int *header_len); |
| 37 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, | 37 | bool batadv_gw_out_of_range(struct batadv_priv *bat_priv, struct sk_buff *skb); |
| 38 | struct sk_buff *skb, struct ethhdr *ethhdr); | ||
| 39 | 38 | ||
| 40 | #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */ | 39 | #endif /* _NET_BATMAN_ADV_GATEWAY_CLIENT_H_ */ |
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c index 700d0b49742d..0f04e1c302b4 100644 --- a/net/batman-adv/soft-interface.c +++ b/net/batman-adv/soft-interface.c | |||
| @@ -180,6 +180,9 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 180 | if (batadv_bla_tx(bat_priv, skb, vid)) | 180 | if (batadv_bla_tx(bat_priv, skb, vid)) |
| 181 | goto dropped; | 181 | goto dropped; |
| 182 | 182 | ||
| 183 | /* skb->data might have been reallocated by batadv_bla_tx() */ | ||
| 184 | ethhdr = (struct ethhdr *)skb->data; | ||
| 185 | |||
| 183 | /* Register the client MAC in the transtable */ | 186 | /* Register the client MAC in the transtable */ |
| 184 | if (!is_multicast_ether_addr(ethhdr->h_source)) | 187 | if (!is_multicast_ether_addr(ethhdr->h_source)) |
| 185 | batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); | 188 | batadv_tt_local_add(soft_iface, ethhdr->h_source, skb->skb_iif); |
| @@ -220,6 +223,10 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 220 | default: | 223 | default: |
| 221 | break; | 224 | break; |
| 222 | } | 225 | } |
| 226 | |||
| 227 | /* reminder: ethhdr might have become unusable from here on | ||
| 228 | * (batadv_gw_is_dhcp_target() might have reallocated skb data) | ||
| 229 | */ | ||
| 223 | } | 230 | } |
| 224 | 231 | ||
| 225 | /* ethernet packet should be broadcasted */ | 232 | /* ethernet packet should be broadcasted */ |
| @@ -266,7 +273,7 @@ static int batadv_interface_tx(struct sk_buff *skb, | |||
| 266 | /* unicast packet */ | 273 | /* unicast packet */ |
| 267 | } else { | 274 | } else { |
| 268 | if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) { | 275 | if (atomic_read(&bat_priv->gw_mode) != BATADV_GW_MODE_OFF) { |
| 269 | ret = batadv_gw_out_of_range(bat_priv, skb, ethhdr); | 276 | ret = batadv_gw_out_of_range(bat_priv, skb); |
| 270 | if (ret) | 277 | if (ret) |
| 271 | goto dropped; | 278 | goto dropped; |
| 272 | } | 279 | } |
diff --git a/net/batman-adv/unicast.c b/net/batman-adv/unicast.c index dc8b5d4dd636..688a0419756b 100644 --- a/net/batman-adv/unicast.c +++ b/net/batman-adv/unicast.c | |||
| @@ -326,7 +326,9 @@ static bool batadv_unicast_push_and_fill_skb(struct sk_buff *skb, int hdr_size, | |||
| 326 | * @skb: the skb containing the payload to encapsulate | 326 | * @skb: the skb containing the payload to encapsulate |
| 327 | * @orig_node: the destination node | 327 | * @orig_node: the destination node |
| 328 | * | 328 | * |
| 329 | * Returns false if the payload could not be encapsulated or true otherwise | 329 | * Returns false if the payload could not be encapsulated or true otherwise. |
| 330 | * | ||
| 331 | * This call might reallocate skb data. | ||
| 330 | */ | 332 | */ |
| 331 | static bool batadv_unicast_prepare_skb(struct sk_buff *skb, | 333 | static bool batadv_unicast_prepare_skb(struct sk_buff *skb, |
| 332 | struct batadv_orig_node *orig_node) | 334 | struct batadv_orig_node *orig_node) |
| @@ -343,7 +345,9 @@ static bool batadv_unicast_prepare_skb(struct sk_buff *skb, | |||
| 343 | * @orig_node: the destination node | 345 | * @orig_node: the destination node |
| 344 | * @packet_subtype: the batman 4addr packet subtype to use | 346 | * @packet_subtype: the batman 4addr packet subtype to use |
| 345 | * | 347 | * |
| 346 | * Returns false if the payload could not be encapsulated or true otherwise | 348 | * Returns false if the payload could not be encapsulated or true otherwise. |
| 349 | * | ||
| 350 | * This call might reallocate skb data. | ||
| 347 | */ | 351 | */ |
| 348 | bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv, | 352 | bool batadv_unicast_4addr_prepare_skb(struct batadv_priv *bat_priv, |
| 349 | struct sk_buff *skb, | 353 | struct sk_buff *skb, |
| @@ -401,7 +405,7 @@ int batadv_unicast_generic_send_skb(struct batadv_priv *bat_priv, | |||
| 401 | struct batadv_neigh_node *neigh_node; | 405 | struct batadv_neigh_node *neigh_node; |
| 402 | int data_len = skb->len; | 406 | int data_len = skb->len; |
| 403 | int ret = NET_RX_DROP; | 407 | int ret = NET_RX_DROP; |
| 404 | unsigned int dev_mtu; | 408 | unsigned int dev_mtu, header_len; |
| 405 | 409 | ||
| 406 | /* get routing information */ | 410 | /* get routing information */ |
| 407 | if (is_multicast_ether_addr(ethhdr->h_dest)) { | 411 | if (is_multicast_ether_addr(ethhdr->h_dest)) { |
| @@ -429,10 +433,12 @@ find_router: | |||
| 429 | switch (packet_type) { | 433 | switch (packet_type) { |
| 430 | case BATADV_UNICAST: | 434 | case BATADV_UNICAST: |
| 431 | batadv_unicast_prepare_skb(skb, orig_node); | 435 | batadv_unicast_prepare_skb(skb, orig_node); |
| 436 | header_len = sizeof(struct batadv_unicast_packet); | ||
| 432 | break; | 437 | break; |
| 433 | case BATADV_UNICAST_4ADDR: | 438 | case BATADV_UNICAST_4ADDR: |
| 434 | batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node, | 439 | batadv_unicast_4addr_prepare_skb(bat_priv, skb, orig_node, |
| 435 | packet_subtype); | 440 | packet_subtype); |
| 441 | header_len = sizeof(struct batadv_unicast_4addr_packet); | ||
| 436 | break; | 442 | break; |
| 437 | default: | 443 | default: |
| 438 | /* this function supports UNICAST and UNICAST_4ADDR only. It | 444 | /* this function supports UNICAST and UNICAST_4ADDR only. It |
| @@ -441,6 +447,7 @@ find_router: | |||
| 441 | goto out; | 447 | goto out; |
| 442 | } | 448 | } |
| 443 | 449 | ||
| 450 | ethhdr = (struct ethhdr *)(skb->data + header_len); | ||
| 444 | unicast_packet = (struct batadv_unicast_packet *)skb->data; | 451 | unicast_packet = (struct batadv_unicast_packet *)skb->data; |
| 445 | 452 | ||
| 446 | /* inform the destination node that we are still missing a correct route | 453 | /* inform the destination node that we are still missing a correct route |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 61c5e819380e..08e576ada0b2 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
| @@ -1195,7 +1195,7 @@ static int br_ip6_multicast_query(struct net_bridge *br, | |||
| 1195 | max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay)); | 1195 | max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay)); |
| 1196 | if (max_delay) | 1196 | if (max_delay) |
| 1197 | group = &mld->mld_mca; | 1197 | group = &mld->mld_mca; |
| 1198 | } else if (skb->len >= sizeof(*mld2q)) { | 1198 | } else { |
| 1199 | if (!pskb_may_pull(skb, sizeof(*mld2q))) { | 1199 | if (!pskb_may_pull(skb, sizeof(*mld2q))) { |
| 1200 | err = -EINVAL; | 1200 | err = -EINVAL; |
| 1201 | goto out; | 1201 | goto out; |
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index 394bb96b6087..3b9637fb7939 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Sysfs attributes of bridge ports | 2 | * Sysfs attributes of bridge |
| 3 | * Linux ethernet bridge | 3 | * Linux ethernet bridge |
| 4 | * | 4 | * |
| 5 | * Authors: | 5 | * Authors: |
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c index 00ee068efc1c..b84a1b155bc1 100644 --- a/net/core/flow_dissector.c +++ b/net/core/flow_dissector.c | |||
| @@ -65,6 +65,7 @@ ipv6: | |||
| 65 | nhoff += sizeof(struct ipv6hdr); | 65 | nhoff += sizeof(struct ipv6hdr); |
| 66 | break; | 66 | break; |
| 67 | } | 67 | } |
| 68 | case __constant_htons(ETH_P_8021AD): | ||
| 68 | case __constant_htons(ETH_P_8021Q): { | 69 | case __constant_htons(ETH_P_8021Q): { |
| 69 | const struct vlan_hdr *vlan; | 70 | const struct vlan_hdr *vlan; |
| 70 | struct vlan_hdr _vlan; | 71 | struct vlan_hdr _vlan; |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 9232c68941ab..60533db8b72d 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
| @@ -1441,16 +1441,18 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
| 1441 | atomic_set(&p->refcnt, 1); | 1441 | atomic_set(&p->refcnt, 1); |
| 1442 | p->reachable_time = | 1442 | p->reachable_time = |
| 1443 | neigh_rand_reach_time(p->base_reachable_time); | 1443 | neigh_rand_reach_time(p->base_reachable_time); |
| 1444 | dev_hold(dev); | ||
| 1445 | p->dev = dev; | ||
| 1446 | write_pnet(&p->net, hold_net(net)); | ||
| 1447 | p->sysctl_table = NULL; | ||
| 1444 | 1448 | ||
| 1445 | if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { | 1449 | if (ops->ndo_neigh_setup && ops->ndo_neigh_setup(dev, p)) { |
| 1450 | release_net(net); | ||
| 1451 | dev_put(dev); | ||
| 1446 | kfree(p); | 1452 | kfree(p); |
| 1447 | return NULL; | 1453 | return NULL; |
| 1448 | } | 1454 | } |
| 1449 | 1455 | ||
| 1450 | dev_hold(dev); | ||
| 1451 | p->dev = dev; | ||
| 1452 | write_pnet(&p->net, hold_net(net)); | ||
| 1453 | p->sysctl_table = NULL; | ||
| 1454 | write_lock_bh(&tbl->lock); | 1456 | write_lock_bh(&tbl->lock); |
| 1455 | p->next = tbl->parms.next; | 1457 | p->next = tbl->parms.next; |
| 1456 | tbl->parms.next = p; | 1458 | tbl->parms.next = p; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 3de740834d1f..ca198c1d1d30 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
| @@ -2156,7 +2156,7 @@ int ndo_dflt_fdb_del(struct ndmsg *ndm, | |||
| 2156 | /* If aging addresses are supported device will need to | 2156 | /* If aging addresses are supported device will need to |
| 2157 | * implement its own handler for this. | 2157 | * implement its own handler for this. |
| 2158 | */ | 2158 | */ |
| 2159 | if (ndm->ndm_state & NUD_PERMANENT) { | 2159 | if (!(ndm->ndm_state & NUD_PERMANENT)) { |
| 2160 | pr_info("%s: FDB only supports static addresses\n", dev->name); | 2160 | pr_info("%s: FDB only supports static addresses\n", dev->name); |
| 2161 | return -EINVAL; | 2161 | return -EINVAL; |
| 2162 | } | 2162 | } |
| @@ -2384,7 +2384,7 @@ static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 2384 | struct nlattr *extfilt; | 2384 | struct nlattr *extfilt; |
| 2385 | u32 filter_mask = 0; | 2385 | u32 filter_mask = 0; |
| 2386 | 2386 | ||
| 2387 | extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct rtgenmsg), | 2387 | extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), |
| 2388 | IFLA_EXT_MASK); | 2388 | IFLA_EXT_MASK); |
| 2389 | if (extfilt) | 2389 | if (extfilt) |
| 2390 | filter_mask = nla_get_u32(extfilt); | 2390 | filter_mask = nla_get_u32(extfilt); |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index ab3d814bc80a..109ee89f123e 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
| @@ -477,7 +477,7 @@ static u32 esp4_get_mtu(struct xfrm_state *x, int mtu) | |||
| 477 | } | 477 | } |
| 478 | 478 | ||
| 479 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - | 479 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - |
| 480 | net_adj) & ~(align - 1)) + (net_adj - 2); | 480 | net_adj) & ~(align - 1)) + net_adj - 2; |
| 481 | } | 481 | } |
| 482 | 482 | ||
| 483 | static void esp4_err(struct sk_buff *skb, u32 info) | 483 | static void esp4_err(struct sk_buff *skb, u32 info) |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 108a1e9c9eac..3df6d3edb2a1 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
| @@ -71,7 +71,6 @@ | |||
| 71 | #include <linux/init.h> | 71 | #include <linux/init.h> |
| 72 | #include <linux/list.h> | 72 | #include <linux/list.h> |
| 73 | #include <linux/slab.h> | 73 | #include <linux/slab.h> |
| 74 | #include <linux/prefetch.h> | ||
| 75 | #include <linux/export.h> | 74 | #include <linux/export.h> |
| 76 | #include <net/net_namespace.h> | 75 | #include <net/net_namespace.h> |
| 77 | #include <net/ip.h> | 76 | #include <net/ip.h> |
| @@ -1761,10 +1760,8 @@ static struct leaf *leaf_walk_rcu(struct tnode *p, struct rt_trie_node *c) | |||
| 1761 | if (!c) | 1760 | if (!c) |
| 1762 | continue; | 1761 | continue; |
| 1763 | 1762 | ||
| 1764 | if (IS_LEAF(c)) { | 1763 | if (IS_LEAF(c)) |
| 1765 | prefetch(rcu_dereference_rtnl(p->child[idx])); | ||
| 1766 | return (struct leaf *) c; | 1764 | return (struct leaf *) c; |
| 1767 | } | ||
| 1768 | 1765 | ||
| 1769 | /* Rescan start scanning in new node */ | 1766 | /* Rescan start scanning in new node */ |
| 1770 | p = (struct tnode *) c; | 1767 | p = (struct tnode *) c; |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 1f6eab66f7ce..8d6939eeb492 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
| @@ -383,7 +383,7 @@ static int ipgre_header(struct sk_buff *skb, struct net_device *dev, | |||
| 383 | if (daddr) | 383 | if (daddr) |
| 384 | memcpy(&iph->daddr, daddr, 4); | 384 | memcpy(&iph->daddr, daddr, 4); |
| 385 | if (iph->daddr) | 385 | if (iph->daddr) |
| 386 | return t->hlen; | 386 | return t->hlen + sizeof(*iph); |
| 387 | 387 | ||
| 388 | return -(t->hlen + sizeof(*iph)); | 388 | return -(t->hlen + sizeof(*iph)); |
| 389 | } | 389 | } |
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c index 7167b08977df..850525b34899 100644 --- a/net/ipv4/ip_tunnel_core.c +++ b/net/ipv4/ip_tunnel_core.c | |||
| @@ -76,9 +76,7 @@ int iptunnel_xmit(struct net *net, struct rtable *rt, | |||
| 76 | iph->daddr = dst; | 76 | iph->daddr = dst; |
| 77 | iph->saddr = src; | 77 | iph->saddr = src; |
| 78 | iph->ttl = ttl; | 78 | iph->ttl = ttl; |
| 79 | tunnel_ip_select_ident(skb, | 79 | __ip_select_ident(iph, &rt->dst, (skb_shinfo(skb)->gso_segs ?: 1) - 1); |
| 80 | (const struct iphdr *)skb_inner_network_header(skb), | ||
| 81 | &rt->dst); | ||
| 82 | 80 | ||
| 83 | err = ip_local_out(skb); | 81 | err = ip_local_out(skb); |
| 84 | if (unlikely(net_xmit_eval(err))) | 82 | if (unlikely(net_xmit_eval(err))) |
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index 6577a1149a47..463bd1273346 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
| @@ -273,7 +273,7 @@ static const struct snmp_mib snmp4_net_list[] = { | |||
| 273 | SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW), | 273 | SNMP_MIB_ITEM("TCPFastOpenListenOverflow", LINUX_MIB_TCPFASTOPENLISTENOVERFLOW), |
| 274 | SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD), | 274 | SNMP_MIB_ITEM("TCPFastOpenCookieReqd", LINUX_MIB_TCPFASTOPENCOOKIEREQD), |
| 275 | SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES), | 275 | SNMP_MIB_ITEM("TCPSpuriousRtxHostQueues", LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES), |
| 276 | SNMP_MIB_ITEM("LowLatencyRxPackets", LINUX_MIB_LOWLATENCYRXPACKETS), | 276 | SNMP_MIB_ITEM("BusyPollRxPackets", LINUX_MIB_BUSYPOLLRXPACKETS), |
| 277 | SNMP_MIB_SENTINEL | 277 | SNMP_MIB_SENTINEL |
| 278 | }; | 278 | }; |
| 279 | 279 | ||
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index a9077f441cb2..b6ae92a51f58 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c | |||
| @@ -206,8 +206,8 @@ static u32 cubic_root(u64 a) | |||
| 206 | */ | 206 | */ |
| 207 | static inline void bictcp_update(struct bictcp *ca, u32 cwnd) | 207 | static inline void bictcp_update(struct bictcp *ca, u32 cwnd) |
| 208 | { | 208 | { |
| 209 | u64 offs; | 209 | u32 delta, bic_target, max_cnt; |
| 210 | u32 delta, t, bic_target, max_cnt; | 210 | u64 offs, t; |
| 211 | 211 | ||
| 212 | ca->ack_cnt++; /* count the number of ACKs */ | 212 | ca->ack_cnt++; /* count the number of ACKs */ |
| 213 | 213 | ||
| @@ -250,9 +250,11 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) | |||
| 250 | * if the cwnd < 1 million packets !!! | 250 | * if the cwnd < 1 million packets !!! |
| 251 | */ | 251 | */ |
| 252 | 252 | ||
| 253 | t = (s32)(tcp_time_stamp - ca->epoch_start); | ||
| 254 | t += msecs_to_jiffies(ca->delay_min >> 3); | ||
| 253 | /* change the unit from HZ to bictcp_HZ */ | 255 | /* change the unit from HZ to bictcp_HZ */ |
| 254 | t = ((tcp_time_stamp + msecs_to_jiffies(ca->delay_min>>3) | 256 | t <<= BICTCP_HZ; |
| 255 | - ca->epoch_start) << BICTCP_HZ) / HZ; | 257 | do_div(t, HZ); |
| 256 | 258 | ||
| 257 | if (t < ca->bic_K) /* t - K */ | 259 | if (t < ca->bic_K) /* t - K */ |
| 258 | offs = ca->bic_K - t; | 260 | offs = ca->bic_K - t; |
| @@ -414,7 +416,7 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) | |||
| 414 | return; | 416 | return; |
| 415 | 417 | ||
| 416 | /* Discard delay samples right after fast recovery */ | 418 | /* Discard delay samples right after fast recovery */ |
| 417 | if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ) | 419 | if (ca->epoch_start && (s32)(tcp_time_stamp - ca->epoch_start) < HZ) |
| 418 | return; | 420 | return; |
| 419 | 421 | ||
| 420 | delay = (rtt_us << 3) / USEC_PER_MSEC; | 422 | delay = (rtt_us << 3) / USEC_PER_MSEC; |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 40ffd72243a4..aeac0dc3635d 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
| @@ -425,7 +425,7 @@ static u32 esp6_get_mtu(struct xfrm_state *x, int mtu) | |||
| 425 | net_adj = 0; | 425 | net_adj = 0; |
| 426 | 426 | ||
| 427 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - | 427 | return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) - |
| 428 | net_adj) & ~(align - 1)) + (net_adj - 2); | 428 | net_adj) & ~(align - 1)) + net_adj - 2; |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | 431 | static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index bff3d821c7eb..c4ff5bbb45c4 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
| @@ -993,14 +993,22 @@ static struct fib6_node * fib6_lookup_1(struct fib6_node *root, | |||
| 993 | 993 | ||
| 994 | if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) { | 994 | if (ipv6_prefix_equal(&key->addr, args->addr, key->plen)) { |
| 995 | #ifdef CONFIG_IPV6_SUBTREES | 995 | #ifdef CONFIG_IPV6_SUBTREES |
| 996 | if (fn->subtree) | 996 | if (fn->subtree) { |
| 997 | fn = fib6_lookup_1(fn->subtree, args + 1); | 997 | struct fib6_node *sfn; |
| 998 | sfn = fib6_lookup_1(fn->subtree, | ||
| 999 | args + 1); | ||
| 1000 | if (!sfn) | ||
| 1001 | goto backtrack; | ||
| 1002 | fn = sfn; | ||
| 1003 | } | ||
| 998 | #endif | 1004 | #endif |
| 999 | if (!fn || fn->fn_flags & RTN_RTINFO) | 1005 | if (fn->fn_flags & RTN_RTINFO) |
| 1000 | return fn; | 1006 | return fn; |
| 1001 | } | 1007 | } |
| 1002 | } | 1008 | } |
| 1003 | 1009 | #ifdef CONFIG_IPV6_SUBTREES | |
| 1010 | backtrack: | ||
| 1011 | #endif | ||
| 1004 | if (fn->fn_flags & RTN_ROOT) | 1012 | if (fn->fn_flags & RTN_ROOT) |
| 1005 | break; | 1013 | break; |
| 1006 | 1014 | ||
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index ae31968d42d3..cc9e02d79b55 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
| @@ -31,10 +31,12 @@ | |||
| 31 | #include "led.h" | 31 | #include "led.h" |
| 32 | 32 | ||
| 33 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) | 33 | #define IEEE80211_AUTH_TIMEOUT (HZ / 5) |
| 34 | #define IEEE80211_AUTH_TIMEOUT_LONG (HZ / 2) | ||
| 34 | #define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10) | 35 | #define IEEE80211_AUTH_TIMEOUT_SHORT (HZ / 10) |
| 35 | #define IEEE80211_AUTH_MAX_TRIES 3 | 36 | #define IEEE80211_AUTH_MAX_TRIES 3 |
| 36 | #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5) | 37 | #define IEEE80211_AUTH_WAIT_ASSOC (HZ * 5) |
| 37 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) | 38 | #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) |
| 39 | #define IEEE80211_ASSOC_TIMEOUT_LONG (HZ / 2) | ||
| 38 | #define IEEE80211_ASSOC_TIMEOUT_SHORT (HZ / 10) | 40 | #define IEEE80211_ASSOC_TIMEOUT_SHORT (HZ / 10) |
| 39 | #define IEEE80211_ASSOC_MAX_TRIES 3 | 41 | #define IEEE80211_ASSOC_MAX_TRIES 3 |
| 40 | 42 | ||
| @@ -209,8 +211,9 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
| 209 | struct ieee80211_channel *channel, | 211 | struct ieee80211_channel *channel, |
| 210 | const struct ieee80211_ht_operation *ht_oper, | 212 | const struct ieee80211_ht_operation *ht_oper, |
| 211 | const struct ieee80211_vht_operation *vht_oper, | 213 | const struct ieee80211_vht_operation *vht_oper, |
| 212 | struct cfg80211_chan_def *chandef, bool verbose) | 214 | struct cfg80211_chan_def *chandef, bool tracking) |
| 213 | { | 215 | { |
| 216 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
| 214 | struct cfg80211_chan_def vht_chandef; | 217 | struct cfg80211_chan_def vht_chandef; |
| 215 | u32 ht_cfreq, ret; | 218 | u32 ht_cfreq, ret; |
| 216 | 219 | ||
| @@ -229,7 +232,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
| 229 | ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, | 232 | ht_cfreq = ieee80211_channel_to_frequency(ht_oper->primary_chan, |
| 230 | channel->band); | 233 | channel->band); |
| 231 | /* check that channel matches the right operating channel */ | 234 | /* check that channel matches the right operating channel */ |
| 232 | if (channel->center_freq != ht_cfreq) { | 235 | if (!tracking && channel->center_freq != ht_cfreq) { |
| 233 | /* | 236 | /* |
| 234 | * It's possible that some APs are confused here; | 237 | * It's possible that some APs are confused here; |
| 235 | * Netgear WNDR3700 sometimes reports 4 higher than | 238 | * Netgear WNDR3700 sometimes reports 4 higher than |
| @@ -237,11 +240,10 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
| 237 | * since we look at probe response/beacon data here | 240 | * since we look at probe response/beacon data here |
| 238 | * it should be OK. | 241 | * it should be OK. |
| 239 | */ | 242 | */ |
| 240 | if (verbose) | 243 | sdata_info(sdata, |
| 241 | sdata_info(sdata, | 244 | "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", |
| 242 | "Wrong control channel: center-freq: %d ht-cfreq: %d ht->primary_chan: %d band: %d - Disabling HT\n", | 245 | channel->center_freq, ht_cfreq, |
| 243 | channel->center_freq, ht_cfreq, | 246 | ht_oper->primary_chan, channel->band); |
| 244 | ht_oper->primary_chan, channel->band); | ||
| 245 | ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; | 247 | ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_VHT; |
| 246 | goto out; | 248 | goto out; |
| 247 | } | 249 | } |
| @@ -295,7 +297,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
| 295 | channel->band); | 297 | channel->band); |
| 296 | break; | 298 | break; |
| 297 | default: | 299 | default: |
| 298 | if (verbose) | 300 | if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) |
| 299 | sdata_info(sdata, | 301 | sdata_info(sdata, |
| 300 | "AP VHT operation IE has invalid channel width (%d), disable VHT\n", | 302 | "AP VHT operation IE has invalid channel width (%d), disable VHT\n", |
| 301 | vht_oper->chan_width); | 303 | vht_oper->chan_width); |
| @@ -304,7 +306,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
| 304 | } | 306 | } |
| 305 | 307 | ||
| 306 | if (!cfg80211_chandef_valid(&vht_chandef)) { | 308 | if (!cfg80211_chandef_valid(&vht_chandef)) { |
| 307 | if (verbose) | 309 | if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) |
| 308 | sdata_info(sdata, | 310 | sdata_info(sdata, |
| 309 | "AP VHT information is invalid, disable VHT\n"); | 311 | "AP VHT information is invalid, disable VHT\n"); |
| 310 | ret = IEEE80211_STA_DISABLE_VHT; | 312 | ret = IEEE80211_STA_DISABLE_VHT; |
| @@ -317,7 +319,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata, | |||
| 317 | } | 319 | } |
| 318 | 320 | ||
| 319 | if (!cfg80211_chandef_compatible(chandef, &vht_chandef)) { | 321 | if (!cfg80211_chandef_compatible(chandef, &vht_chandef)) { |
| 320 | if (verbose) | 322 | if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT)) |
| 321 | sdata_info(sdata, | 323 | sdata_info(sdata, |
| 322 | "AP VHT information doesn't match HT, disable VHT\n"); | 324 | "AP VHT information doesn't match HT, disable VHT\n"); |
| 323 | ret = IEEE80211_STA_DISABLE_VHT; | 325 | ret = IEEE80211_STA_DISABLE_VHT; |
| @@ -333,18 +335,27 @@ out: | |||
| 333 | if (ret & IEEE80211_STA_DISABLE_VHT) | 335 | if (ret & IEEE80211_STA_DISABLE_VHT) |
| 334 | vht_chandef = *chandef; | 336 | vht_chandef = *chandef; |
| 335 | 337 | ||
| 338 | /* | ||
| 339 | * Ignore the DISABLED flag when we're already connected and only | ||
| 340 | * tracking the APs beacon for bandwidth changes - otherwise we | ||
| 341 | * might get disconnected here if we connect to an AP, update our | ||
| 342 | * regulatory information based on the AP's country IE and the | ||
| 343 | * information we have is wrong/outdated and disables the channel | ||
| 344 | * that we're actually using for the connection to the AP. | ||
| 345 | */ | ||
| 336 | while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, | 346 | while (!cfg80211_chandef_usable(sdata->local->hw.wiphy, chandef, |
| 337 | IEEE80211_CHAN_DISABLED)) { | 347 | tracking ? 0 : |
| 348 | IEEE80211_CHAN_DISABLED)) { | ||
| 338 | if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) { | 349 | if (WARN_ON(chandef->width == NL80211_CHAN_WIDTH_20_NOHT)) { |
| 339 | ret = IEEE80211_STA_DISABLE_HT | | 350 | ret = IEEE80211_STA_DISABLE_HT | |
| 340 | IEEE80211_STA_DISABLE_VHT; | 351 | IEEE80211_STA_DISABLE_VHT; |
| 341 | goto out; | 352 | break; |
| 342 | } | 353 | } |
| 343 | 354 | ||
| 344 | ret |= chandef_downgrade(chandef); | 355 | ret |= chandef_downgrade(chandef); |
| 345 | } | 356 | } |
| 346 | 357 | ||
| 347 | if (chandef->width != vht_chandef.width && verbose) | 358 | if (chandef->width != vht_chandef.width && !tracking) |
| 348 | sdata_info(sdata, | 359 | sdata_info(sdata, |
| 349 | "capabilities/regulatory prevented using AP HT/VHT configuration, downgraded\n"); | 360 | "capabilities/regulatory prevented using AP HT/VHT configuration, downgraded\n"); |
| 350 | 361 | ||
| @@ -384,7 +395,7 @@ static int ieee80211_config_bw(struct ieee80211_sub_if_data *sdata, | |||
| 384 | 395 | ||
| 385 | /* calculate new channel (type) based on HT/VHT operation IEs */ | 396 | /* calculate new channel (type) based on HT/VHT operation IEs */ |
| 386 | flags = ieee80211_determine_chantype(sdata, sband, chan, ht_oper, | 397 | flags = ieee80211_determine_chantype(sdata, sband, chan, ht_oper, |
| 387 | vht_oper, &chandef, false); | 398 | vht_oper, &chandef, true); |
| 388 | 399 | ||
| 389 | /* | 400 | /* |
| 390 | * Downgrade the new channel if we associated with restricted | 401 | * Downgrade the new channel if we associated with restricted |
| @@ -3394,10 +3405,13 @@ static int ieee80211_probe_auth(struct ieee80211_sub_if_data *sdata) | |||
| 3394 | 3405 | ||
| 3395 | if (tx_flags == 0) { | 3406 | if (tx_flags == 0) { |
| 3396 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; | 3407 | auth_data->timeout = jiffies + IEEE80211_AUTH_TIMEOUT; |
| 3397 | ifmgd->auth_data->timeout_started = true; | 3408 | auth_data->timeout_started = true; |
| 3398 | run_again(sdata, auth_data->timeout); | 3409 | run_again(sdata, auth_data->timeout); |
| 3399 | } else { | 3410 | } else { |
| 3400 | auth_data->timeout_started = false; | 3411 | auth_data->timeout = |
| 3412 | round_jiffies_up(jiffies + IEEE80211_AUTH_TIMEOUT_LONG); | ||
| 3413 | auth_data->timeout_started = true; | ||
| 3414 | run_again(sdata, auth_data->timeout); | ||
| 3401 | } | 3415 | } |
| 3402 | 3416 | ||
| 3403 | return 0; | 3417 | return 0; |
| @@ -3434,7 +3448,11 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) | |||
| 3434 | assoc_data->timeout_started = true; | 3448 | assoc_data->timeout_started = true; |
| 3435 | run_again(sdata, assoc_data->timeout); | 3449 | run_again(sdata, assoc_data->timeout); |
| 3436 | } else { | 3450 | } else { |
| 3437 | assoc_data->timeout_started = false; | 3451 | assoc_data->timeout = |
| 3452 | round_jiffies_up(jiffies + | ||
| 3453 | IEEE80211_ASSOC_TIMEOUT_LONG); | ||
| 3454 | assoc_data->timeout_started = true; | ||
| 3455 | run_again(sdata, assoc_data->timeout); | ||
| 3438 | } | 3456 | } |
| 3439 | 3457 | ||
| 3440 | return 0; | 3458 | return 0; |
| @@ -3829,7 +3847,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, | |||
| 3829 | ifmgd->flags |= ieee80211_determine_chantype(sdata, sband, | 3847 | ifmgd->flags |= ieee80211_determine_chantype(sdata, sband, |
| 3830 | cbss->channel, | 3848 | cbss->channel, |
| 3831 | ht_oper, vht_oper, | 3849 | ht_oper, vht_oper, |
| 3832 | &chandef, true); | 3850 | &chandef, false); |
| 3833 | 3851 | ||
| 3834 | sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss), | 3852 | sdata->needed_rx_chains = min(ieee80211_ht_vht_rx_chains(sdata, cbss), |
| 3835 | local->rx_chains); | 3853 | local->rx_chains); |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 7dcc376eea5f..2f8010707d01 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
| @@ -526,7 +526,7 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
| 526 | const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; | 526 | const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple; |
| 527 | __u32 seq, ack, sack, end, win, swin; | 527 | __u32 seq, ack, sack, end, win, swin; |
| 528 | s16 receiver_offset; | 528 | s16 receiver_offset; |
| 529 | bool res; | 529 | bool res, in_recv_win; |
| 530 | 530 | ||
| 531 | /* | 531 | /* |
| 532 | * Get the required data from the packet. | 532 | * Get the required data from the packet. |
| @@ -649,14 +649,18 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
| 649 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, | 649 | receiver->td_end, receiver->td_maxend, receiver->td_maxwin, |
| 650 | receiver->td_scale); | 650 | receiver->td_scale); |
| 651 | 651 | ||
| 652 | /* Is the ending sequence in the receive window (if available)? */ | ||
| 653 | in_recv_win = !receiver->td_maxwin || | ||
| 654 | after(end, sender->td_end - receiver->td_maxwin - 1); | ||
| 655 | |||
| 652 | pr_debug("tcp_in_window: I=%i II=%i III=%i IV=%i\n", | 656 | pr_debug("tcp_in_window: I=%i II=%i III=%i IV=%i\n", |
| 653 | before(seq, sender->td_maxend + 1), | 657 | before(seq, sender->td_maxend + 1), |
| 654 | after(end, sender->td_end - receiver->td_maxwin - 1), | 658 | (in_recv_win ? 1 : 0), |
| 655 | before(sack, receiver->td_end + 1), | 659 | before(sack, receiver->td_end + 1), |
| 656 | after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)); | 660 | after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)); |
| 657 | 661 | ||
| 658 | if (before(seq, sender->td_maxend + 1) && | 662 | if (before(seq, sender->td_maxend + 1) && |
| 659 | after(end, sender->td_end - receiver->td_maxwin - 1) && | 663 | in_recv_win && |
| 660 | before(sack, receiver->td_end + 1) && | 664 | before(sack, receiver->td_end + 1) && |
| 661 | after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)) { | 665 | after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1)) { |
| 662 | /* | 666 | /* |
| @@ -725,7 +729,7 @@ static bool tcp_in_window(const struct nf_conn *ct, | |||
| 725 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, | 729 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, |
| 726 | "nf_ct_tcp: %s ", | 730 | "nf_ct_tcp: %s ", |
| 727 | before(seq, sender->td_maxend + 1) ? | 731 | before(seq, sender->td_maxend + 1) ? |
| 728 | after(end, sender->td_end - receiver->td_maxwin - 1) ? | 732 | in_recv_win ? |
| 729 | before(sack, receiver->td_end + 1) ? | 733 | before(sack, receiver->td_end + 1) ? |
| 730 | after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1) ? "BUG" | 734 | after(sack, receiver->td_end - MAXACKWINDOW(sender) - 1) ? "BUG" |
| 731 | : "ACK is under the lower bound (possible overly delayed ACK)" | 735 | : "ACK is under the lower bound (possible overly delayed ACK)" |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 962e9792e317..d92cc317bf8b 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
| @@ -419,6 +419,7 @@ __build_packet_message(struct nfnl_log_net *log, | |||
| 419 | nfmsg->version = NFNETLINK_V0; | 419 | nfmsg->version = NFNETLINK_V0; |
| 420 | nfmsg->res_id = htons(inst->group_num); | 420 | nfmsg->res_id = htons(inst->group_num); |
| 421 | 421 | ||
| 422 | memset(&pmsg, 0, sizeof(pmsg)); | ||
| 422 | pmsg.hw_protocol = skb->protocol; | 423 | pmsg.hw_protocol = skb->protocol; |
| 423 | pmsg.hook = hooknum; | 424 | pmsg.hook = hooknum; |
| 424 | 425 | ||
| @@ -498,7 +499,10 @@ __build_packet_message(struct nfnl_log_net *log, | |||
| 498 | if (indev && skb->dev && | 499 | if (indev && skb->dev && |
| 499 | skb->mac_header != skb->network_header) { | 500 | skb->mac_header != skb->network_header) { |
| 500 | struct nfulnl_msg_packet_hw phw; | 501 | struct nfulnl_msg_packet_hw phw; |
| 501 | int len = dev_parse_header(skb, phw.hw_addr); | 502 | int len; |
| 503 | |||
| 504 | memset(&phw, 0, sizeof(phw)); | ||
| 505 | len = dev_parse_header(skb, phw.hw_addr); | ||
| 502 | if (len > 0) { | 506 | if (len > 0) { |
| 503 | phw.hw_addrlen = htons(len); | 507 | phw.hw_addrlen = htons(len); |
| 504 | if (nla_put(inst->skb, NFULA_HWADDR, sizeof(phw), &phw)) | 508 | if (nla_put(inst->skb, NFULA_HWADDR, sizeof(phw), &phw)) |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 971ea145ab3e..8a703c3dd318 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
| @@ -463,7 +463,10 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
| 463 | if (indev && entskb->dev && | 463 | if (indev && entskb->dev && |
| 464 | entskb->mac_header != entskb->network_header) { | 464 | entskb->mac_header != entskb->network_header) { |
| 465 | struct nfqnl_msg_packet_hw phw; | 465 | struct nfqnl_msg_packet_hw phw; |
| 466 | int len = dev_parse_header(entskb, phw.hw_addr); | 466 | int len; |
| 467 | |||
| 468 | memset(&phw, 0, sizeof(phw)); | ||
| 469 | len = dev_parse_header(entskb, phw.hw_addr); | ||
| 467 | if (len) { | 470 | if (len) { |
| 468 | phw.hw_addrlen = htons(len); | 471 | phw.hw_addrlen = htons(len); |
| 469 | if (nla_put(skb, NFQA_HWADDR, sizeof(phw), &phw)) | 472 | if (nla_put(skb, NFQA_HWADDR, sizeof(phw), &phw)) |
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c index 7011c71646f0..6113cc7efffc 100644 --- a/net/netfilter/xt_TCPMSS.c +++ b/net/netfilter/xt_TCPMSS.c | |||
| @@ -52,7 +52,8 @@ tcpmss_mangle_packet(struct sk_buff *skb, | |||
| 52 | { | 52 | { |
| 53 | const struct xt_tcpmss_info *info = par->targinfo; | 53 | const struct xt_tcpmss_info *info = par->targinfo; |
| 54 | struct tcphdr *tcph; | 54 | struct tcphdr *tcph; |
| 55 | unsigned int tcplen, i; | 55 | int len, tcp_hdrlen; |
| 56 | unsigned int i; | ||
| 56 | __be16 oldval; | 57 | __be16 oldval; |
| 57 | u16 newmss; | 58 | u16 newmss; |
| 58 | u8 *opt; | 59 | u8 *opt; |
| @@ -64,11 +65,14 @@ tcpmss_mangle_packet(struct sk_buff *skb, | |||
| 64 | if (!skb_make_writable(skb, skb->len)) | 65 | if (!skb_make_writable(skb, skb->len)) |
| 65 | return -1; | 66 | return -1; |
| 66 | 67 | ||
| 67 | tcplen = skb->len - tcphoff; | 68 | len = skb->len - tcphoff; |
| 69 | if (len < (int)sizeof(struct tcphdr)) | ||
| 70 | return -1; | ||
| 71 | |||
| 68 | tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); | 72 | tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); |
| 73 | tcp_hdrlen = tcph->doff * 4; | ||
| 69 | 74 | ||
| 70 | /* Header cannot be larger than the packet */ | 75 | if (len < tcp_hdrlen) |
| 71 | if (tcplen < tcph->doff*4) | ||
| 72 | return -1; | 76 | return -1; |
| 73 | 77 | ||
| 74 | if (info->mss == XT_TCPMSS_CLAMP_PMTU) { | 78 | if (info->mss == XT_TCPMSS_CLAMP_PMTU) { |
| @@ -87,9 +91,8 @@ tcpmss_mangle_packet(struct sk_buff *skb, | |||
| 87 | newmss = info->mss; | 91 | newmss = info->mss; |
| 88 | 92 | ||
| 89 | opt = (u_int8_t *)tcph; | 93 | opt = (u_int8_t *)tcph; |
| 90 | for (i = sizeof(struct tcphdr); i < tcph->doff*4; i += optlen(opt, i)) { | 94 | for (i = sizeof(struct tcphdr); i <= tcp_hdrlen - TCPOLEN_MSS; i += optlen(opt, i)) { |
| 91 | if (opt[i] == TCPOPT_MSS && tcph->doff*4 - i >= TCPOLEN_MSS && | 95 | if (opt[i] == TCPOPT_MSS && opt[i+1] == TCPOLEN_MSS) { |
| 92 | opt[i+1] == TCPOLEN_MSS) { | ||
| 93 | u_int16_t oldmss; | 96 | u_int16_t oldmss; |
| 94 | 97 | ||
| 95 | oldmss = (opt[i+2] << 8) | opt[i+3]; | 98 | oldmss = (opt[i+2] << 8) | opt[i+3]; |
| @@ -112,9 +115,10 @@ tcpmss_mangle_packet(struct sk_buff *skb, | |||
| 112 | } | 115 | } |
| 113 | 116 | ||
| 114 | /* There is data after the header so the option can't be added | 117 | /* There is data after the header so the option can't be added |
| 115 | without moving it, and doing so may make the SYN packet | 118 | * without moving it, and doing so may make the SYN packet |
| 116 | itself too large. Accept the packet unmodified instead. */ | 119 | * itself too large. Accept the packet unmodified instead. |
| 117 | if (tcplen > tcph->doff*4) | 120 | */ |
| 121 | if (len > tcp_hdrlen) | ||
| 118 | return 0; | 122 | return 0; |
| 119 | 123 | ||
| 120 | /* | 124 | /* |
| @@ -143,10 +147,10 @@ tcpmss_mangle_packet(struct sk_buff *skb, | |||
| 143 | newmss = min(newmss, (u16)1220); | 147 | newmss = min(newmss, (u16)1220); |
| 144 | 148 | ||
| 145 | opt = (u_int8_t *)tcph + sizeof(struct tcphdr); | 149 | opt = (u_int8_t *)tcph + sizeof(struct tcphdr); |
| 146 | memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); | 150 | memmove(opt + TCPOLEN_MSS, opt, len - sizeof(struct tcphdr)); |
| 147 | 151 | ||
| 148 | inet_proto_csum_replace2(&tcph->check, skb, | 152 | inet_proto_csum_replace2(&tcph->check, skb, |
| 149 | htons(tcplen), htons(tcplen + TCPOLEN_MSS), 1); | 153 | htons(len), htons(len + TCPOLEN_MSS), 1); |
| 150 | opt[0] = TCPOPT_MSS; | 154 | opt[0] = TCPOPT_MSS; |
| 151 | opt[1] = TCPOLEN_MSS; | 155 | opt[1] = TCPOLEN_MSS; |
| 152 | opt[2] = (newmss & 0xff00) >> 8; | 156 | opt[2] = (newmss & 0xff00) >> 8; |
diff --git a/net/netfilter/xt_TCPOPTSTRIP.c b/net/netfilter/xt_TCPOPTSTRIP.c index b68fa191710f..625fa1d636a0 100644 --- a/net/netfilter/xt_TCPOPTSTRIP.c +++ b/net/netfilter/xt_TCPOPTSTRIP.c | |||
| @@ -38,7 +38,7 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb, | |||
| 38 | struct tcphdr *tcph; | 38 | struct tcphdr *tcph; |
| 39 | u_int16_t n, o; | 39 | u_int16_t n, o; |
| 40 | u_int8_t *opt; | 40 | u_int8_t *opt; |
| 41 | int len; | 41 | int len, tcp_hdrlen; |
| 42 | 42 | ||
| 43 | /* This is a fragment, no TCP header is available */ | 43 | /* This is a fragment, no TCP header is available */ |
| 44 | if (par->fragoff != 0) | 44 | if (par->fragoff != 0) |
| @@ -52,7 +52,9 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb, | |||
| 52 | return NF_DROP; | 52 | return NF_DROP; |
| 53 | 53 | ||
| 54 | tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); | 54 | tcph = (struct tcphdr *)(skb_network_header(skb) + tcphoff); |
| 55 | if (tcph->doff * 4 > len) | 55 | tcp_hdrlen = tcph->doff * 4; |
| 56 | |||
| 57 | if (len < tcp_hdrlen) | ||
| 56 | return NF_DROP; | 58 | return NF_DROP; |
| 57 | 59 | ||
| 58 | opt = (u_int8_t *)tcph; | 60 | opt = (u_int8_t *)tcph; |
| @@ -61,10 +63,10 @@ tcpoptstrip_mangle_packet(struct sk_buff *skb, | |||
| 61 | * Walk through all TCP options - if we find some option to remove, | 63 | * Walk through all TCP options - if we find some option to remove, |
| 62 | * set all octets to %TCPOPT_NOP and adjust checksum. | 64 | * set all octets to %TCPOPT_NOP and adjust checksum. |
| 63 | */ | 65 | */ |
| 64 | for (i = sizeof(struct tcphdr); i < tcp_hdrlen(skb); i += optl) { | 66 | for (i = sizeof(struct tcphdr); i < tcp_hdrlen - 1; i += optl) { |
| 65 | optl = optlen(opt, i); | 67 | optl = optlen(opt, i); |
| 66 | 68 | ||
| 67 | if (i + optl > tcp_hdrlen(skb)) | 69 | if (i + optl > tcp_hdrlen) |
| 68 | break; | 70 | break; |
| 69 | 71 | ||
| 70 | if (!tcpoptstrip_test_bit(info->strip_bmap, opt[i])) | 72 | if (!tcpoptstrip_test_bit(info->strip_bmap, opt[i])) |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 512718adb0d5..f85f8a2ad6cf 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
| @@ -789,6 +789,10 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb) | |||
| 789 | struct net *net = sock_net(skb->sk); | 789 | struct net *net = sock_net(skb->sk); |
| 790 | int chains_to_skip = cb->args[0]; | 790 | int chains_to_skip = cb->args[0]; |
| 791 | int fams_to_skip = cb->args[1]; | 791 | int fams_to_skip = cb->args[1]; |
| 792 | bool need_locking = chains_to_skip || fams_to_skip; | ||
| 793 | |||
| 794 | if (need_locking) | ||
| 795 | genl_lock(); | ||
| 792 | 796 | ||
| 793 | for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) { | 797 | for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) { |
| 794 | n = 0; | 798 | n = 0; |
| @@ -810,6 +814,9 @@ errout: | |||
| 810 | cb->args[0] = i; | 814 | cb->args[0] = i; |
| 811 | cb->args[1] = n; | 815 | cb->args[1] = n; |
| 812 | 816 | ||
| 817 | if (need_locking) | ||
| 818 | genl_unlock(); | ||
| 819 | |||
| 813 | return skb->len; | 820 | return skb->len; |
| 814 | } | 821 | } |
| 815 | 822 | ||
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c index 22c5f399f1cf..ab101f715447 100644 --- a/net/openvswitch/actions.c +++ b/net/openvswitch/actions.c | |||
| @@ -535,6 +535,7 @@ int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb) | |||
| 535 | { | 535 | { |
| 536 | struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts); | 536 | struct sw_flow_actions *acts = rcu_dereference(OVS_CB(skb)->flow->sf_acts); |
| 537 | 537 | ||
| 538 | OVS_CB(skb)->tun_key = NULL; | ||
| 538 | return do_execute_actions(dp, skb, acts->actions, | 539 | return do_execute_actions(dp, skb, acts->actions, |
| 539 | acts->actions_len, false); | 540 | acts->actions_len, false); |
| 540 | } | 541 | } |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index f7e3a0d84c40..f2ed7600084e 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
| @@ -2076,9 +2076,6 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) | |||
| 2076 | ovs_notify(reply, info, &ovs_dp_vport_multicast_group); | 2076 | ovs_notify(reply, info, &ovs_dp_vport_multicast_group); |
| 2077 | return 0; | 2077 | return 0; |
| 2078 | 2078 | ||
| 2079 | rtnl_unlock(); | ||
| 2080 | return 0; | ||
| 2081 | |||
| 2082 | exit_free: | 2079 | exit_free: |
| 2083 | kfree_skb(reply); | 2080 | kfree_skb(reply); |
| 2084 | exit_unlock: | 2081 | exit_unlock: |
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c index 5c519b121e1b..1aa84dc58777 100644 --- a/net/openvswitch/flow.c +++ b/net/openvswitch/flow.c | |||
| @@ -240,7 +240,7 @@ static struct flex_array *alloc_buckets(unsigned int n_buckets) | |||
| 240 | struct flex_array *buckets; | 240 | struct flex_array *buckets; |
| 241 | int i, err; | 241 | int i, err; |
| 242 | 242 | ||
| 243 | buckets = flex_array_alloc(sizeof(struct hlist_head *), | 243 | buckets = flex_array_alloc(sizeof(struct hlist_head), |
| 244 | n_buckets, GFP_KERNEL); | 244 | n_buckets, GFP_KERNEL); |
| 245 | if (!buckets) | 245 | if (!buckets) |
| 246 | return NULL; | 246 | return NULL; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 281c1bded1f6..51b968d3febb 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
| @@ -285,6 +285,45 @@ static struct Qdisc_ops *qdisc_lookup_ops(struct nlattr *kind) | |||
| 285 | return q; | 285 | return q; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | /* The linklayer setting were not transferred from iproute2, in older | ||
| 289 | * versions, and the rate tables lookup systems have been dropped in | ||
| 290 | * the kernel. To keep backward compatible with older iproute2 tc | ||
| 291 | * utils, we detect the linklayer setting by detecting if the rate | ||
| 292 | * table were modified. | ||
| 293 | * | ||
| 294 | * For linklayer ATM table entries, the rate table will be aligned to | ||
| 295 | * 48 bytes, thus some table entries will contain the same value. The | ||
| 296 | * mpu (min packet unit) is also encoded into the old rate table, thus | ||
| 297 | * starting from the mpu, we find low and high table entries for | ||
| 298 | * mapping this cell. If these entries contain the same value, when | ||
| 299 | * the rate tables have been modified for linklayer ATM. | ||
| 300 | * | ||
| 301 | * This is done by rounding mpu to the nearest 48 bytes cell/entry, | ||
| 302 | * and then roundup to the next cell, calc the table entry one below, | ||
| 303 | * and compare. | ||
| 304 | */ | ||
| 305 | static __u8 __detect_linklayer(struct tc_ratespec *r, __u32 *rtab) | ||
| 306 | { | ||
| 307 | int low = roundup(r->mpu, 48); | ||
| 308 | int high = roundup(low+1, 48); | ||
| 309 | int cell_low = low >> r->cell_log; | ||
| 310 | int cell_high = (high >> r->cell_log) - 1; | ||
| 311 | |||
| 312 | /* rtab is too inaccurate at rates > 100Mbit/s */ | ||
| 313 | if ((r->rate > (100000000/8)) || (rtab[0] == 0)) { | ||
| 314 | pr_debug("TC linklayer: Giving up ATM detection\n"); | ||
| 315 | return TC_LINKLAYER_ETHERNET; | ||
| 316 | } | ||
| 317 | |||
| 318 | if ((cell_high > cell_low) && (cell_high < 256) | ||
| 319 | && (rtab[cell_low] == rtab[cell_high])) { | ||
| 320 | pr_debug("TC linklayer: Detected ATM, low(%d)=high(%d)=%u\n", | ||
| 321 | cell_low, cell_high, rtab[cell_high]); | ||
| 322 | return TC_LINKLAYER_ATM; | ||
| 323 | } | ||
| 324 | return TC_LINKLAYER_ETHERNET; | ||
| 325 | } | ||
| 326 | |||
| 288 | static struct qdisc_rate_table *qdisc_rtab_list; | 327 | static struct qdisc_rate_table *qdisc_rtab_list; |
| 289 | 328 | ||
| 290 | struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *tab) | 329 | struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *tab) |
| @@ -308,6 +347,8 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *ta | |||
| 308 | rtab->rate = *r; | 347 | rtab->rate = *r; |
| 309 | rtab->refcnt = 1; | 348 | rtab->refcnt = 1; |
| 310 | memcpy(rtab->data, nla_data(tab), 1024); | 349 | memcpy(rtab->data, nla_data(tab), 1024); |
| 350 | if (r->linklayer == TC_LINKLAYER_UNAWARE) | ||
| 351 | r->linklayer = __detect_linklayer(r, rtab->data); | ||
| 311 | rtab->next = qdisc_rtab_list; | 352 | rtab->next = qdisc_rtab_list; |
| 312 | qdisc_rtab_list = rtab; | 353 | qdisc_rtab_list = rtab; |
| 313 | } | 354 | } |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 4626cef4b76e..48be3d5c0d92 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/rcupdate.h> | 25 | #include <linux/rcupdate.h> |
| 26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | #include <linux/if_vlan.h> | ||
| 28 | #include <net/sch_generic.h> | 29 | #include <net/sch_generic.h> |
| 29 | #include <net/pkt_sched.h> | 30 | #include <net/pkt_sched.h> |
| 30 | #include <net/dst.h> | 31 | #include <net/dst.h> |
| @@ -207,15 +208,19 @@ void __qdisc_run(struct Qdisc *q) | |||
| 207 | 208 | ||
| 208 | unsigned long dev_trans_start(struct net_device *dev) | 209 | unsigned long dev_trans_start(struct net_device *dev) |
| 209 | { | 210 | { |
| 210 | unsigned long val, res = dev->trans_start; | 211 | unsigned long val, res; |
| 211 | unsigned int i; | 212 | unsigned int i; |
| 212 | 213 | ||
| 214 | if (is_vlan_dev(dev)) | ||
| 215 | dev = vlan_dev_real_dev(dev); | ||
| 216 | res = dev->trans_start; | ||
| 213 | for (i = 0; i < dev->num_tx_queues; i++) { | 217 | for (i = 0; i < dev->num_tx_queues; i++) { |
| 214 | val = netdev_get_tx_queue(dev, i)->trans_start; | 218 | val = netdev_get_tx_queue(dev, i)->trans_start; |
| 215 | if (val && time_after(val, res)) | 219 | if (val && time_after(val, res)) |
| 216 | res = val; | 220 | res = val; |
| 217 | } | 221 | } |
| 218 | dev->trans_start = res; | 222 | dev->trans_start = res; |
| 223 | |||
| 219 | return res; | 224 | return res; |
| 220 | } | 225 | } |
| 221 | EXPORT_SYMBOL(dev_trans_start); | 226 | EXPORT_SYMBOL(dev_trans_start); |
| @@ -904,6 +909,7 @@ void psched_ratecfg_precompute(struct psched_ratecfg *r, | |||
| 904 | memset(r, 0, sizeof(*r)); | 909 | memset(r, 0, sizeof(*r)); |
| 905 | r->overhead = conf->overhead; | 910 | r->overhead = conf->overhead; |
| 906 | r->rate_bytes_ps = conf->rate; | 911 | r->rate_bytes_ps = conf->rate; |
| 912 | r->linklayer = (conf->linklayer & TC_LINKLAYER_MASK); | ||
| 907 | r->mult = 1; | 913 | r->mult = 1; |
| 908 | /* | 914 | /* |
| 909 | * The deal here is to replace a divide by a reciprocal one | 915 | * The deal here is to replace a divide by a reciprocal one |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 45e751527dfc..c2178b15ca6e 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
| @@ -1329,6 +1329,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
| 1329 | struct htb_sched *q = qdisc_priv(sch); | 1329 | struct htb_sched *q = qdisc_priv(sch); |
| 1330 | struct htb_class *cl = (struct htb_class *)*arg, *parent; | 1330 | struct htb_class *cl = (struct htb_class *)*arg, *parent; |
| 1331 | struct nlattr *opt = tca[TCA_OPTIONS]; | 1331 | struct nlattr *opt = tca[TCA_OPTIONS]; |
| 1332 | struct qdisc_rate_table *rtab = NULL, *ctab = NULL; | ||
| 1332 | struct nlattr *tb[TCA_HTB_MAX + 1]; | 1333 | struct nlattr *tb[TCA_HTB_MAX + 1]; |
| 1333 | struct tc_htb_opt *hopt; | 1334 | struct tc_htb_opt *hopt; |
| 1334 | 1335 | ||
| @@ -1350,6 +1351,18 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
| 1350 | if (!hopt->rate.rate || !hopt->ceil.rate) | 1351 | if (!hopt->rate.rate || !hopt->ceil.rate) |
| 1351 | goto failure; | 1352 | goto failure; |
| 1352 | 1353 | ||
| 1354 | /* Keeping backward compatible with rate_table based iproute2 tc */ | ||
| 1355 | if (hopt->rate.linklayer == TC_LINKLAYER_UNAWARE) { | ||
| 1356 | rtab = qdisc_get_rtab(&hopt->rate, tb[TCA_HTB_RTAB]); | ||
| 1357 | if (rtab) | ||
| 1358 | qdisc_put_rtab(rtab); | ||
| 1359 | } | ||
| 1360 | if (hopt->ceil.linklayer == TC_LINKLAYER_UNAWARE) { | ||
| 1361 | ctab = qdisc_get_rtab(&hopt->ceil, tb[TCA_HTB_CTAB]); | ||
| 1362 | if (ctab) | ||
| 1363 | qdisc_put_rtab(ctab); | ||
| 1364 | } | ||
| 1365 | |||
| 1353 | if (!cl) { /* new class */ | 1366 | if (!cl) { /* new class */ |
| 1354 | struct Qdisc *new_q; | 1367 | struct Qdisc *new_q; |
| 1355 | int prio; | 1368 | int prio; |
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index bce5b79662a6..ab67efc64b24 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
| @@ -846,12 +846,12 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
| 846 | else | 846 | else |
| 847 | spc_state = SCTP_ADDR_AVAILABLE; | 847 | spc_state = SCTP_ADDR_AVAILABLE; |
| 848 | /* Don't inform ULP about transition from PF to | 848 | /* Don't inform ULP about transition from PF to |
| 849 | * active state and set cwnd to 1, see SCTP | 849 | * active state and set cwnd to 1 MTU, see SCTP |
| 850 | * Quick failover draft section 5.1, point 5 | 850 | * Quick failover draft section 5.1, point 5 |
| 851 | */ | 851 | */ |
| 852 | if (transport->state == SCTP_PF) { | 852 | if (transport->state == SCTP_PF) { |
| 853 | ulp_notify = false; | 853 | ulp_notify = false; |
| 854 | transport->cwnd = 1; | 854 | transport->cwnd = asoc->pathmtu; |
| 855 | } | 855 | } |
| 856 | transport->state = SCTP_ACTIVE; | 856 | transport->state = SCTP_ACTIVE; |
| 857 | break; | 857 | break; |
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index bdbbc3fd7c14..8fdd16046d66 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
| @@ -181,12 +181,12 @@ static void sctp_transport_destroy(struct sctp_transport *transport) | |||
| 181 | return; | 181 | return; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | call_rcu(&transport->rcu, sctp_transport_destroy_rcu); | ||
| 185 | |||
| 186 | sctp_packet_free(&transport->packet); | 184 | sctp_packet_free(&transport->packet); |
| 187 | 185 | ||
| 188 | if (transport->asoc) | 186 | if (transport->asoc) |
| 189 | sctp_association_put(transport->asoc); | 187 | sctp_association_put(transport->asoc); |
| 188 | |||
| 189 | call_rcu(&transport->rcu, sctp_transport_destroy_rcu); | ||
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | /* Start T3_rtx timer if it is not already running and update the heartbeat | 192 | /* Start T3_rtx timer if it is not already running and update the heartbeat |
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index cb29ef7ba2f0..609c30c80816 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
| @@ -460,6 +460,7 @@ static void bearer_disable(struct tipc_bearer *b_ptr) | |||
| 460 | { | 460 | { |
| 461 | struct tipc_link *l_ptr; | 461 | struct tipc_link *l_ptr; |
| 462 | struct tipc_link *temp_l_ptr; | 462 | struct tipc_link *temp_l_ptr; |
| 463 | struct tipc_link_req *temp_req; | ||
| 463 | 464 | ||
| 464 | pr_info("Disabling bearer <%s>\n", b_ptr->name); | 465 | pr_info("Disabling bearer <%s>\n", b_ptr->name); |
| 465 | spin_lock_bh(&b_ptr->lock); | 466 | spin_lock_bh(&b_ptr->lock); |
| @@ -468,9 +469,13 @@ static void bearer_disable(struct tipc_bearer *b_ptr) | |||
| 468 | list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { | 469 | list_for_each_entry_safe(l_ptr, temp_l_ptr, &b_ptr->links, link_list) { |
| 469 | tipc_link_delete(l_ptr); | 470 | tipc_link_delete(l_ptr); |
| 470 | } | 471 | } |
| 471 | if (b_ptr->link_req) | 472 | temp_req = b_ptr->link_req; |
| 472 | tipc_disc_delete(b_ptr->link_req); | 473 | b_ptr->link_req = NULL; |
| 473 | spin_unlock_bh(&b_ptr->lock); | 474 | spin_unlock_bh(&b_ptr->lock); |
| 475 | |||
| 476 | if (temp_req) | ||
| 477 | tipc_disc_delete(temp_req); | ||
| 478 | |||
| 474 | memset(b_ptr, 0, sizeof(struct tipc_bearer)); | 479 | memset(b_ptr, 0, sizeof(struct tipc_bearer)); |
| 475 | } | 480 | } |
| 476 | 481 | ||
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 593071dabd1c..4d9334683f84 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c | |||
| @@ -347,7 +347,7 @@ void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)) | |||
| 347 | for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) { | 347 | for (i = 0; i < ARRAY_SIZE(vsock_connected_table); i++) { |
| 348 | struct vsock_sock *vsk; | 348 | struct vsock_sock *vsk; |
| 349 | list_for_each_entry(vsk, &vsock_connected_table[i], | 349 | list_for_each_entry(vsk, &vsock_connected_table[i], |
| 350 | connected_table); | 350 | connected_table) |
| 351 | fn(sk_vsock(vsk)); | 351 | fn(sk_vsock(vsk)); |
| 352 | } | 352 | } |
| 353 | 353 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index 4f9f216665e9..a8c29fa4f1b3 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
| @@ -765,6 +765,7 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev, | |||
| 765 | cfg80211_leave_mesh(rdev, dev); | 765 | cfg80211_leave_mesh(rdev, dev); |
| 766 | break; | 766 | break; |
| 767 | case NL80211_IFTYPE_AP: | 767 | case NL80211_IFTYPE_AP: |
| 768 | case NL80211_IFTYPE_P2P_GO: | ||
| 768 | cfg80211_stop_ap(rdev, dev); | 769 | cfg80211_stop_ap(rdev, dev); |
| 769 | break; | 770 | break; |
| 770 | default: | 771 | default: |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 25d217d90807..3fcba69817e5 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
| @@ -441,10 +441,12 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb, | |||
| 441 | goto out_unlock; | 441 | goto out_unlock; |
| 442 | } | 442 | } |
| 443 | *rdev = wiphy_to_dev((*wdev)->wiphy); | 443 | *rdev = wiphy_to_dev((*wdev)->wiphy); |
| 444 | cb->args[0] = (*rdev)->wiphy_idx; | 444 | /* 0 is the first index - add 1 to parse only once */ |
| 445 | cb->args[0] = (*rdev)->wiphy_idx + 1; | ||
| 445 | cb->args[1] = (*wdev)->identifier; | 446 | cb->args[1] = (*wdev)->identifier; |
| 446 | } else { | 447 | } else { |
| 447 | struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0]); | 448 | /* subtract the 1 again here */ |
| 449 | struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1); | ||
| 448 | struct wireless_dev *tmp; | 450 | struct wireless_dev *tmp; |
| 449 | 451 | ||
| 450 | if (!wiphy) { | 452 | if (!wiphy) { |
