Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull more networking fixes from David Miller:

1) Fix mlx4_en_netpoll implementation, it needs to schedule a NAPI
context, not synchronize it. From Chris Mason.

2) Ipv4 flow input interface should never be zero, it should be
LOOPBACK_IFINDEX instead. From Cong Wang and Julian Anastasov.

3) Properly configure MAC to PHY connection in mvneta devices, from
Thomas Petazzoni.

4) sys_recv should use SYSCALL_DEFINE. From Jan Glauber.

5) Tunnel driver ioctls do not use the correct namespace, fix from
Nicolas Dichtel.

6) Fix memory leak on seccomp filter attach, from Kees Cook.

7) Fix lockdep warning for nested vlans, from Ding Tianhong.

8) Crashes can happen in SCTP due to how the auth_enable value is
managed, fix from Vlad Yasevich.

9) Wireless fixes from John W Linville and co.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (45 commits)
net: sctp: cache auth_enable per endpoint
tg3: update rx_jumbo_pending ring param only when jumbo frames are enabled
vlan: Fix lockdep warning when vlan dev handle notification
seccomp: fix memory leak on filter attach
isdn: icn: buffer overflow in icn_command()
ip6_tunnel: use the right netns in ioctl handler
sit: use the right netns in ioctl handler
ip_tunnel: use the right netns in ioctl handler
net: use SYSCALL_DEFINEx for sys_recv
net: mdio-gpio: Add support for separate MDI and MDO gpio pins
net: mdio-gpio: Add support for active low gpio pins
net: mdio-gpio: Use devm_ functions where possible
ipv4, route: pass 0 instead of LOOPBACK_IFINDEX to fib_validate_source()
ipv4, fib: pass LOOPBACK_IFINDEX instead of 0 to flowi4_iif
mlx4_en: don't use napi_synchronize inside mlx4_en_netpoll
net: mvneta: properly configure the MAC <-> PHY connection in all situations
net: phy: add minimal support for QSGMII PHY
sfc:On MCDI timeout, issue an FLR (and mark MCDI to fail-fast)
mwifiex: fix hung task on command timeout
mwifiex: process event before command response
...

+664 -344
+1 -1
Documentation/devicetree/bindings/net/ethernet.txt
··· 10 10 - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than 11 11 the maximum frame size (there's contradiction in ePAPR). 12 12 - phy-mode: string, operation mode of the PHY interface; supported values are 13 - "mii", "gmii", "sgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id", 13 + "mii", "gmii", "sgmii", "qsgmii", "tbi", "rev-mii", "rmii", "rgmii", "rgmii-id", 14 14 "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto 15 15 standard property; 16 16 - phy-connection-type: the same as "phy-mode" property but described in ePAPR;
+5 -6
drivers/isdn/icn/icn.c
··· 1155 1155 ulong a; 1156 1156 ulong flags; 1157 1157 int i; 1158 - char cbuf[60]; 1158 + char cbuf[80]; 1159 1159 isdn_ctrl cmd; 1160 1160 icn_cdef cdef; 1161 1161 char __user *arg; ··· 1309 1309 break; 1310 1310 if ((c->arg & 255) < ICN_BCH) { 1311 1311 char *p; 1312 - char dial[50]; 1313 1312 char dcode[4]; 1314 1313 1315 1314 a = c->arg; ··· 1320 1321 } else 1321 1322 /* Normal Dial */ 1322 1323 strcpy(dcode, "CAL"); 1323 - strcpy(dial, p); 1324 - sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), 1325 - dcode, dial, c->parm.setup.si1, 1326 - c->parm.setup.si2, c->parm.setup.eazmsn); 1324 + snprintf(cbuf, sizeof(cbuf), 1325 + "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1), 1326 + dcode, p, c->parm.setup.si1, 1327 + c->parm.setup.si2, c->parm.setup.eazmsn); 1327 1328 i = icn_writecmd(cbuf, strlen(cbuf), 0, card); 1328 1329 } 1329 1330 break;
+3 -1
drivers/net/ethernet/broadcom/tg3.c
··· 12286 12286 if (tg3_flag(tp, MAX_RXPEND_64) && 12287 12287 tp->rx_pending > 63) 12288 12288 tp->rx_pending = 63; 12289 - tp->rx_jumbo_pending = ering->rx_jumbo_pending; 12289 + 12290 + if (tg3_flag(tp, JUMBO_RING_ENABLE)) 12291 + tp->rx_jumbo_pending = ering->rx_jumbo_pending; 12290 12292 12291 12293 for (i = 0; i < tp->irq_max; i++) 12292 12294 tp->napi[i].tx_pending = ering->tx_pending;
+34 -39
drivers/net/ethernet/marvell/mvneta.c
··· 89 89 #define MVNETA_TX_IN_PRGRS BIT(1) 90 90 #define MVNETA_TX_FIFO_EMPTY BIT(8) 91 91 #define MVNETA_RX_MIN_FRAME_SIZE 0x247c 92 - #define MVNETA_SGMII_SERDES_CFG 0x24A0 92 + #define MVNETA_SERDES_CFG 0x24A0 93 93 #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 94 + #define MVNETA_QSGMII_SERDES_PROTO 0x0667 94 95 #define MVNETA_TYPE_PRIO 0x24bc 95 96 #define MVNETA_FORCE_UNI BIT(21) 96 97 #define MVNETA_TXQ_CMD_1 0x24e4 ··· 710 709 val = mvreg_read(pp, MVNETA_RXQ_CONFIG_REG(rxq->id)); 711 710 val &= ~MVNETA_RXQ_HW_BUF_ALLOC; 712 711 mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val); 713 - } 714 - 715 - 716 - 717 - /* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ 718 - static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) 719 - { 720 - u32 val; 721 - 722 - val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 723 - 724 - if (enable) 725 - val |= MVNETA_GMAC2_PORT_RGMII; 726 - else 727 - val &= ~MVNETA_GMAC2_PORT_RGMII; 728 - 729 - mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 730 - } 731 - 732 - /* Config SGMII port */ 733 - static void mvneta_port_sgmii_config(struct mvneta_port *pp) 734 - { 735 - u32 val; 736 - 737 - val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 738 - val |= MVNETA_GMAC2_PCS_ENABLE; 739 - mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 740 - 741 - mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); 742 712 } 743 713 744 714 /* Start the Ethernet port RX and TX activity */ ··· 2721 2749 } 2722 2750 2723 2751 /* Power up the port */ 2724 - static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 2752 + static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 2725 2753 { 2726 - u32 val; 2754 + u32 ctrl; 2727 2755 2728 2756 /* MAC Cause register should be cleared */ 2729 2757 mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0); 2730 2758 2731 - if (phy_mode == PHY_INTERFACE_MODE_SGMII) 2732 - mvneta_port_sgmii_config(pp); 2759 + ctrl = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 2733 2760 2734 - mvneta_gmac_rgmii_set(pp, 1); 2761 + /* Even though it might look weird, when we're configured in 2762 + * SGMII or QSGMII mode, the RGMII bit needs to be set. 2763 + */ 2764 + switch(phy_mode) { 2765 + case PHY_INTERFACE_MODE_QSGMII: 2766 + mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_QSGMII_SERDES_PROTO); 2767 + ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII; 2768 + break; 2769 + case PHY_INTERFACE_MODE_SGMII: 2770 + mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); 2771 + ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII; 2772 + break; 2773 + case PHY_INTERFACE_MODE_RGMII: 2774 + case PHY_INTERFACE_MODE_RGMII_ID: 2775 + ctrl |= MVNETA_GMAC2_PORT_RGMII; 2776 + break; 2777 + default: 2778 + return -EINVAL; 2779 + } 2735 2780 2736 2781 /* Cancel Port Reset */ 2737 - val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); 2738 - val &= ~MVNETA_GMAC2_PORT_RESET; 2739 - mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); 2782 + ctrl &= ~MVNETA_GMAC2_PORT_RESET; 2783 + mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl); 2740 2784 2741 2785 while ((mvreg_read(pp, MVNETA_GMAC_CTRL_2) & 2742 2786 MVNETA_GMAC2_PORT_RESET) != 0) 2743 2787 continue; 2788 + 2789 + return 0; 2744 2790 } 2745 2791 2746 2792 /* Device initialization routine */ ··· 2869 2879 dev_err(&pdev->dev, "can't init eth hal\n"); 2870 2880 goto err_free_stats; 2871 2881 } 2872 - mvneta_port_power_up(pp, phy_mode); 2882 + 2883 + err = mvneta_port_power_up(pp, phy_mode); 2884 + if (err < 0) { 2885 + dev_err(&pdev->dev, "can't power up port\n"); 2886 + goto err_deinit; 2887 + } 2873 2888 2874 2889 dram_target_info = mv_mbus_dram_info(); 2875 2890 if (dram_target_info)
-1
drivers/net/ethernet/mellanox/mlx4/en_cq.c
··· 66 66 67 67 cq->ring = ring; 68 68 cq->is_tx = mode; 69 - spin_lock_init(&cq->lock); 70 69 71 70 /* Allocate HW buffers on provided NUMA node. 72 71 * dev->numa_node is used in mtt range allocation flow.
+1 -5
drivers/net/ethernet/mellanox/mlx4/en_netdev.c
··· 1304 1304 { 1305 1305 struct mlx4_en_priv *priv = netdev_priv(dev); 1306 1306 struct mlx4_en_cq *cq; 1307 - unsigned long flags; 1308 1307 int i; 1309 1308 1310 1309 for (i = 0; i < priv->rx_ring_num; i++) { 1311 1310 cq = priv->rx_cq[i]; 1312 - spin_lock_irqsave(&cq->lock, flags); 1313 - napi_synchronize(&cq->napi); 1314 - mlx4_en_process_rx_cq(dev, cq, 0); 1315 - spin_unlock_irqrestore(&cq->lock, flags); 1311 + napi_schedule(&cq->napi); 1316 1312 } 1317 1313 } 1318 1314 #endif
-1
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
··· 319 319 struct mlx4_cq mcq; 320 320 struct mlx4_hwq_resources wqres; 321 321 int ring; 322 - spinlock_t lock; 323 322 struct net_device *dev; 324 323 struct napi_struct napi; 325 324 int size;
+11 -1
drivers/net/ethernet/sfc/ef10.c
··· 738 738 /* If it was a port reset, trigger reallocation of MC resources. 739 739 * Note that on an MC reset nothing needs to be done now because we'll 740 740 * detect the MC reset later and handle it then. 741 + * For an FLR, we never get an MC reset event, but the MC has reset all 742 + * resources assigned to us, so we have to trigger reallocation now. 741 743 */ 742 - if (reset_type == RESET_TYPE_ALL && !rc) 744 + if ((reset_type == RESET_TYPE_ALL || 745 + reset_type == RESET_TYPE_MCDI_TIMEOUT) && !rc) 743 746 efx_ef10_reset_mc_allocations(efx); 744 747 return rc; 745 748 } ··· 2142 2139 } 2143 2140 2144 2141 return 0; 2142 + } 2143 + 2144 + static void efx_ef10_prepare_flr(struct efx_nic *efx) 2145 + { 2146 + atomic_set(&efx->active_queues, 0); 2145 2147 } 2146 2148 2147 2149 static bool efx_ef10_filter_equal(const struct efx_filter_spec *left, ··· 3611 3603 .probe_port = efx_mcdi_port_probe, 3612 3604 .remove_port = efx_mcdi_port_remove, 3613 3605 .fini_dmaq = efx_ef10_fini_dmaq, 3606 + .prepare_flr = efx_ef10_prepare_flr, 3607 + .finish_flr = efx_port_dummy_op_void, 3614 3608 .describe_stats = efx_ef10_describe_stats, 3615 3609 .update_stats = efx_ef10_update_stats, 3616 3610 .start_stats = efx_mcdi_mac_start_stats,
+16 -3
drivers/net/ethernet/sfc/efx.c
··· 76 76 [RESET_TYPE_RECOVER_OR_ALL] = "RECOVER_OR_ALL", 77 77 [RESET_TYPE_WORLD] = "WORLD", 78 78 [RESET_TYPE_RECOVER_OR_DISABLE] = "RECOVER_OR_DISABLE", 79 + [RESET_TYPE_MC_BIST] = "MC_BIST", 79 80 [RESET_TYPE_DISABLE] = "DISABLE", 80 81 [RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG", 81 82 [RESET_TYPE_INT_ERROR] = "INT_ERROR", ··· 84 83 [RESET_TYPE_DMA_ERROR] = "DMA_ERROR", 85 84 [RESET_TYPE_TX_SKIP] = "TX_SKIP", 86 85 [RESET_TYPE_MC_FAILURE] = "MC_FAILURE", 87 - [RESET_TYPE_MC_BIST] = "MC_BIST", 86 + [RESET_TYPE_MCDI_TIMEOUT] = "MCDI_TIMEOUT (FLR)", 88 87 }; 89 88 90 89 /* Reset workqueue. If any NIC has a hardware failure then a reset will be ··· 1740 1739 1741 1740 /* Check that it is appropriate to restart the interface. All 1742 1741 * of these flags are safe to read under just the rtnl lock */ 1743 - if (efx->port_enabled || !netif_running(efx->net_dev)) 1742 + if (efx->port_enabled || !netif_running(efx->net_dev) || 1743 + efx->reset_pending) 1744 1744 return; 1745 1745 1746 1746 efx_start_port(efx); ··· 2336 2334 { 2337 2335 EFX_ASSERT_RESET_SERIALISED(efx); 2338 2336 2337 + if (method == RESET_TYPE_MCDI_TIMEOUT) 2338 + efx->type->prepare_flr(efx); 2339 + 2339 2340 efx_stop_all(efx); 2340 2341 efx_disable_interrupts(efx); 2341 2342 ··· 2359 2354 2360 2355 EFX_ASSERT_RESET_SERIALISED(efx); 2361 2356 2357 + if (method == RESET_TYPE_MCDI_TIMEOUT) 2358 + efx->type->finish_flr(efx); 2359 + 2360 + /* Ensure that SRAM is initialised even if we're disabling the device */ 2362 2361 rc = efx->type->init(efx); 2363 2362 if (rc) { 2364 2363 netif_err(efx, drv, efx->net_dev, "failed to initialise NIC\n"); ··· 2426 2417 /* Clear flags for the scopes we covered. We assume the NIC and 2427 2418 * driver are now quiescent so that there is no race here. 2428 2419 */ 2429 - efx->reset_pending &= -(1 << (method + 1)); 2420 + if (method < RESET_TYPE_MAX_METHOD) 2421 + efx->reset_pending &= -(1 << (method + 1)); 2422 + else /* it doesn't fit into the well-ordered scope hierarchy */ 2423 + __clear_bit(method, &efx->reset_pending); 2430 2424 2431 2425 /* Reinitialise bus-mastering, which may have been turned off before 2432 2426 * the reset was scheduled. This is still appropriate, even in the ··· 2558 2546 case RESET_TYPE_DISABLE: 2559 2547 case RESET_TYPE_RECOVER_OR_DISABLE: 2560 2548 case RESET_TYPE_MC_BIST: 2549 + case RESET_TYPE_MCDI_TIMEOUT: 2561 2550 method = type; 2562 2551 netif_dbg(efx, drv, efx->net_dev, "scheduling %s reset\n", 2563 2552 RESET_TYPE(method));
+16 -7
drivers/net/ethernet/sfc/enum.h
··· 143 143 * @RESET_TYPE_WORLD: Reset as much as possible 144 144 * @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if 145 145 * unsuccessful. 146 + * @RESET_TYPE_MC_BIST: MC entering BIST mode. 146 147 * @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled 147 148 * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog 148 149 * @RESET_TYPE_INT_ERROR: reset due to internal error ··· 151 150 * @RESET_TYPE_DMA_ERROR: DMA error 152 151 * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors 153 152 * @RESET_TYPE_MC_FAILURE: MC reboot/assertion 153 + * @RESET_TYPE_MCDI_TIMEOUT: MCDI timeout. 154 154 */ 155 155 enum reset_type { 156 - RESET_TYPE_INVISIBLE = 0, 157 - RESET_TYPE_RECOVER_OR_ALL = 1, 158 - RESET_TYPE_ALL = 2, 159 - RESET_TYPE_WORLD = 3, 160 - RESET_TYPE_RECOVER_OR_DISABLE = 4, 161 - RESET_TYPE_DISABLE = 5, 156 + RESET_TYPE_INVISIBLE, 157 + RESET_TYPE_RECOVER_OR_ALL, 158 + RESET_TYPE_ALL, 159 + RESET_TYPE_WORLD, 160 + RESET_TYPE_RECOVER_OR_DISABLE, 161 + RESET_TYPE_MC_BIST, 162 + RESET_TYPE_DISABLE, 162 163 RESET_TYPE_MAX_METHOD, 163 164 RESET_TYPE_TX_WATCHDOG, 164 165 RESET_TYPE_INT_ERROR, ··· 168 165 RESET_TYPE_DMA_ERROR, 169 166 RESET_TYPE_TX_SKIP, 170 167 RESET_TYPE_MC_FAILURE, 171 - RESET_TYPE_MC_BIST, 168 + /* RESET_TYPE_MCDI_TIMEOUT is actually a method, not just a reason, but 169 + * it doesn't fit the scope hierarchy (not well-ordered by inclusion). 170 + * We encode this by having its enum value be greater than 171 + * RESET_TYPE_MAX_METHOD. This also prevents issuing it with 172 + * efx_ioctl_reset. 173 + */ 174 + RESET_TYPE_MCDI_TIMEOUT, 172 175 RESET_TYPE_MAX, 173 176 }; 174 177
+4
drivers/net/ethernet/sfc/falcon.c
··· 2696 2696 .fini_dmaq = efx_farch_fini_dmaq, 2697 2697 .prepare_flush = falcon_prepare_flush, 2698 2698 .finish_flush = efx_port_dummy_op_void, 2699 + .prepare_flr = efx_port_dummy_op_void, 2700 + .finish_flr = efx_farch_finish_flr, 2699 2701 .describe_stats = falcon_describe_nic_stats, 2700 2702 .update_stats = falcon_update_nic_stats, 2701 2703 .start_stats = falcon_start_nic_stats, ··· 2792 2790 .fini_dmaq = efx_farch_fini_dmaq, 2793 2791 .prepare_flush = falcon_prepare_flush, 2794 2792 .finish_flush = efx_port_dummy_op_void, 2793 + .prepare_flr = efx_port_dummy_op_void, 2794 + .finish_flr = efx_farch_finish_flr, 2795 2795 .describe_stats = falcon_describe_nic_stats, 2796 2796 .update_stats = falcon_update_nic_stats, 2797 2797 .start_stats = falcon_start_nic_stats,
+22
drivers/net/ethernet/sfc/farch.c
··· 741 741 return rc; 742 742 } 743 743 744 + /* Reset queue and flush accounting after FLR 745 + * 746 + * One possible cause of FLR recovery is that DMA may be failing (eg. if bus 747 + * mastering was disabled), in which case we don't receive (RXQ) flush 748 + * completion events. This means that efx->rxq_flush_outstanding remained at 4 749 + * after the FLR; also, efx->active_queues was non-zero (as no flush completion 750 + * events were received, and we didn't go through efx_check_tx_flush_complete()) 751 + * If we don't fix this up, on the next call to efx_realloc_channels() we won't 752 + * flush any RX queues because efx->rxq_flush_outstanding is at the limit of 4 753 + * for batched flush requests; and the efx->active_queues gets messed up because 754 + * we keep incrementing for the newly initialised queues, but it never went to 755 + * zero previously. Then we get a timeout every time we try to restart the 756 + * queues, as it doesn't go back to zero when we should be flushing the queues. 757 + */ 758 + void efx_farch_finish_flr(struct efx_nic *efx) 759 + { 760 + atomic_set(&efx->rxq_flush_pending, 0); 761 + atomic_set(&efx->rxq_flush_outstanding, 0); 762 + atomic_set(&efx->active_queues, 0); 763 + } 764 + 765 + 744 766 /************************************************************************** 745 767 * 746 768 * Event queue processing
+44 -11
drivers/net/ethernet/sfc/mcdi.c
··· 52 52 static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating, 53 53 bool *was_attached_out); 54 54 static bool efx_mcdi_poll_once(struct efx_nic *efx); 55 - 56 - static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) 57 - { 58 - EFX_BUG_ON_PARANOID(!efx->mcdi); 59 - return &efx->mcdi->iface; 60 - } 55 + static void efx_mcdi_abandon(struct efx_nic *efx); 61 56 62 57 int efx_mcdi_init(struct efx_nic *efx) 63 58 { ··· 553 558 rc = 0; 554 559 } 555 560 561 + efx_mcdi_abandon(efx); 562 + 556 563 /* Close the race with efx_mcdi_ev_cpl() executing just too late 557 564 * and completing a request we've just cancelled, by ensuring 558 565 * that the seqno check therein fails. ··· 667 670 return rc; 668 671 669 672 if (efx->mc_bist_for_other_fn) 673 + return -ENETDOWN; 674 + 675 + if (mcdi->mode == MCDI_MODE_FAIL) 670 676 return -ENETDOWN; 671 677 672 678 efx_mcdi_acquire_sync(mcdi); ··· 812 812 return; 813 813 814 814 mcdi = efx_mcdi(efx); 815 - if (mcdi->mode == MCDI_MODE_POLL) 815 + /* If already in polling mode, nothing to do. 816 + * If in fail-fast state, don't switch to polled completion. 817 + * FLR recovery will do that later. 818 + */ 819 + if (mcdi->mode == MCDI_MODE_POLL || mcdi->mode == MCDI_MODE_FAIL) 816 820 return; 817 821 818 822 /* We can switch from event completion to polled completion, because ··· 845 841 846 842 mcdi = efx_mcdi(efx); 847 843 848 - /* We must be in polling mode so no more requests can be queued */ 849 - BUG_ON(mcdi->mode != MCDI_MODE_POLL); 844 + /* We must be in poll or fail mode so no more requests can be queued */ 845 + BUG_ON(mcdi->mode == MCDI_MODE_EVENTS); 850 846 851 847 del_timer_sync(&mcdi->async_timer); 852 848 ··· 879 875 return; 880 876 881 877 mcdi = efx_mcdi(efx); 882 - 883 - if (mcdi->mode == MCDI_MODE_EVENTS) 878 + /* If already in event completion mode, nothing to do. 879 + * If in fail-fast state, don't switch to event completion. FLR 880 + * recovery will do that later. 881 + */ 882 + if (mcdi->mode == MCDI_MODE_EVENTS || mcdi->mode == MCDI_MODE_FAIL) 884 883 return; 885 884 886 885 /* We can't switch from polled to event completion in the middle of a ··· 971 964 mcdi->new_epoch = true; 972 965 efx_schedule_reset(efx, RESET_TYPE_MC_BIST); 973 966 spin_unlock(&mcdi->iface_lock); 967 + } 968 + 969 + /* MCDI timeouts seen, so make all MCDI calls fail-fast and issue an FLR to try 970 + * to recover. 971 + */ 972 + static void efx_mcdi_abandon(struct efx_nic *efx) 973 + { 974 + struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 975 + 976 + if (xchg(&mcdi->mode, MCDI_MODE_FAIL) == MCDI_MODE_FAIL) 977 + return; /* it had already been done */ 978 + netif_dbg(efx, hw, efx->net_dev, "MCDI is timing out; trying to recover\n"); 979 + efx_schedule_reset(efx, RESET_TYPE_MCDI_TIMEOUT); 974 980 } 975 981 976 982 /* Called from falcon_process_eventq for MCDI events */ ··· 1531 1511 int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method) 1532 1512 { 1533 1513 int rc; 1514 + 1515 + /* If MCDI is down, we can't handle_assertion */ 1516 + if (method == RESET_TYPE_MCDI_TIMEOUT) { 1517 + rc = pci_reset_function(efx->pci_dev); 1518 + if (rc) 1519 + return rc; 1520 + /* Re-enable polled MCDI completion */ 1521 + if (efx->mcdi) { 1522 + struct efx_mcdi_iface *mcdi = efx_mcdi(efx); 1523 + mcdi->mode = MCDI_MODE_POLL; 1524 + } 1525 + return 0; 1526 + } 1534 1527 1535 1528 /* Recover from a failed assertion pre-reset */ 1536 1529 rc = efx_mcdi_handle_assertion(efx);
+13
drivers/net/ethernet/sfc/mcdi.h
··· 28 28 MCDI_STATE_COMPLETED, 29 29 }; 30 30 31 + /** 32 + * enum efx_mcdi_mode - MCDI transaction mode 33 + * @MCDI_MODE_POLL: poll for MCDI completion, until timeout 34 + * @MCDI_MODE_EVENTS: wait for an mcdi_event. On timeout, poll once 35 + * @MCDI_MODE_FAIL: we think MCDI is dead, so fail-fast all calls 36 + */ 31 37 enum efx_mcdi_mode { 32 38 MCDI_MODE_POLL, 33 39 MCDI_MODE_EVENTS, 40 + MCDI_MODE_FAIL, 34 41 }; 35 42 36 43 /** ··· 110 103 #endif 111 104 u32 fn_flags; 112 105 }; 106 + 107 + static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx) 108 + { 109 + EFX_BUG_ON_PARANOID(!efx->mcdi); 110 + return &efx->mcdi->iface; 111 + } 113 112 114 113 #ifdef CONFIG_SFC_MCDI_MON 115 114 static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx)
+4
drivers/net/ethernet/sfc/net_driver.h
··· 972 972 * (for Falcon architecture) 973 973 * @finish_flush: Clean up after flushing the DMA queues (for Falcon 974 974 * architecture) 975 + * @prepare_flr: Prepare for an FLR 976 + * @finish_flr: Clean up after an FLR 975 977 * @describe_stats: Describe statistics for ethtool 976 978 * @update_stats: Update statistics not provided by event handling. 977 979 * Either argument may be %NULL. ··· 1102 1100 int (*fini_dmaq)(struct efx_nic *efx); 1103 1101 void (*prepare_flush)(struct efx_nic *efx); 1104 1102 void (*finish_flush)(struct efx_nic *efx); 1103 + void (*prepare_flr)(struct efx_nic *efx); 1104 + void (*finish_flr)(struct efx_nic *efx); 1105 1105 size_t (*describe_stats)(struct efx_nic *efx, u8 *names); 1106 1106 size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats, 1107 1107 struct rtnl_link_stats64 *core_stats);
+1
drivers/net/ethernet/sfc/nic.h
··· 757 757 int efx_nic_flush_queues(struct efx_nic *efx); 758 758 void siena_prepare_flush(struct efx_nic *efx); 759 759 int efx_farch_fini_dmaq(struct efx_nic *efx); 760 + void efx_farch_finish_flr(struct efx_nic *efx); 760 761 void siena_finish_flush(struct efx_nic *efx); 761 762 void falcon_start_nic_stats(struct efx_nic *efx); 762 763 void falcon_stop_nic_stats(struct efx_nic *efx);
+2
drivers/net/ethernet/sfc/siena.c
··· 921 921 .fini_dmaq = efx_farch_fini_dmaq, 922 922 .prepare_flush = siena_prepare_flush, 923 923 .finish_flush = siena_finish_flush, 924 + .prepare_flr = efx_port_dummy_op_void, 925 + .finish_flr = efx_farch_finish_flr, 924 926 .describe_stats = siena_describe_nic_stats, 925 927 .update_stats = siena_update_nic_stats, 926 928 .start_stats = efx_mcdi_mac_start_stats,
+47 -21
drivers/net/phy/mdio-gpio.c
··· 32 32 33 33 struct mdio_gpio_info { 34 34 struct mdiobb_ctrl ctrl; 35 - int mdc, mdio; 35 + int mdc, mdio, mdo; 36 + int mdc_active_low, mdio_active_low, mdo_active_low; 36 37 }; 37 38 38 39 static void *mdio_gpio_of_get_data(struct platform_device *pdev) 39 40 { 40 41 struct device_node *np = pdev->dev.of_node; 41 42 struct mdio_gpio_platform_data *pdata; 43 + enum of_gpio_flags flags; 42 44 int ret; 43 45 44 46 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 45 47 if (!pdata) 46 48 return NULL; 47 49 48 - ret = of_get_gpio(np, 0); 50 + ret = of_get_gpio_flags(np, 0, &flags); 49 51 if (ret < 0) 50 52 return NULL; 51 53 52 54 pdata->mdc = ret; 55 + pdata->mdc_active_low = flags & OF_GPIO_ACTIVE_LOW; 53 56 54 - ret = of_get_gpio(np, 1); 57 + ret = of_get_gpio_flags(np, 1, &flags); 55 58 if (ret < 0) 56 59 return NULL; 57 60 pdata->mdio = ret; 61 + pdata->mdio_active_low = flags & OF_GPIO_ACTIVE_LOW; 62 + 63 + ret = of_get_gpio_flags(np, 2, &flags); 64 + if (ret > 0) { 65 + pdata->mdo = ret; 66 + pdata->mdo_active_low = flags & OF_GPIO_ACTIVE_LOW; 67 + } 58 68 59 69 return pdata; 60 70 } ··· 74 64 struct mdio_gpio_info *bitbang = 75 65 container_of(ctrl, struct mdio_gpio_info, ctrl); 76 66 67 + if (bitbang->mdo) { 68 + /* Separate output pin. Always set its value to high 69 + * when changing direction. If direction is input, 70 + * assume the pin serves as pull-up. If direction is 71 + * output, the default value is high. 72 + */ 73 + gpio_set_value(bitbang->mdo, 1 ^ bitbang->mdo_active_low); 74 + return; 75 + } 76 + 77 77 if (dir) 78 - gpio_direction_output(bitbang->mdio, 1); 78 + gpio_direction_output(bitbang->mdio, 79 + 1 ^ bitbang->mdio_active_low); 79 80 else 80 81 gpio_direction_input(bitbang->mdio); 81 82 } ··· 96 75 struct mdio_gpio_info *bitbang = 97 76 container_of(ctrl, struct mdio_gpio_info, ctrl); 98 77 99 - return gpio_get_value(bitbang->mdio); 78 + return gpio_get_value(bitbang->mdio) ^ bitbang->mdio_active_low; 100 79 } 101 80 102 81 static void mdio_set(struct mdiobb_ctrl *ctrl, int what) ··· 104 83 struct mdio_gpio_info *bitbang = 105 84 container_of(ctrl, struct mdio_gpio_info, ctrl); 106 85 107 - gpio_set_value(bitbang->mdio, what); 86 + if (bitbang->mdo) 87 + gpio_set_value(bitbang->mdo, what ^ bitbang->mdo_active_low); 88 + else 89 + gpio_set_value(bitbang->mdio, what ^ bitbang->mdio_active_low); 108 90 } 109 91 110 92 static void mdc_set(struct mdiobb_ctrl *ctrl, int what) ··· 115 91 struct mdio_gpio_info *bitbang = 116 92 container_of(ctrl, struct mdio_gpio_info, ctrl); 117 93 118 - gpio_set_value(bitbang->mdc, what); 94 + gpio_set_value(bitbang->mdc, what ^ bitbang->mdc_active_low); 119 95 } 120 96 121 97 static struct mdiobb_ops mdio_gpio_ops = { ··· 134 110 struct mdio_gpio_info *bitbang; 135 111 int i; 136 112 137 - bitbang = kzalloc(sizeof(*bitbang), GFP_KERNEL); 113 + bitbang = devm_kzalloc(dev, sizeof(*bitbang), GFP_KERNEL); 138 114 if (!bitbang) 139 115 goto out; 140 116 141 117 bitbang->ctrl.ops = &mdio_gpio_ops; 142 118 bitbang->ctrl.reset = pdata->reset; 143 119 bitbang->mdc = pdata->mdc; 120 + bitbang->mdc_active_low = pdata->mdc_active_low; 144 121 bitbang->mdio = pdata->mdio; 122 + bitbang->mdio_active_low = pdata->mdio_active_low; 123 + bitbang->mdo = pdata->mdo; 124 + bitbang->mdo_active_low = pdata->mdo_active_low; 145 125 146 126 new_bus = alloc_mdio_bitbang(&bitbang->ctrl); 147 127 if (!new_bus) 148 - goto out_free_bitbang; 128 + goto out; 149 129 150 130 new_bus->name = "GPIO Bitbanged MDIO", 151 131 ··· 166 138 167 139 snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id); 168 140 169 - if (gpio_request(bitbang->mdc, "mdc")) 141 + if (devm_gpio_request(dev, bitbang->mdc, "mdc")) 170 142 goto out_free_bus; 171 143 172 - if (gpio_request(bitbang->mdio, "mdio")) 173 - goto out_free_mdc; 144 + if (devm_gpio_request(dev, bitbang->mdio, "mdio")) 145 + goto out_free_bus; 146 + 147 + if (bitbang->mdo) { 148 + if (devm_gpio_request(dev, bitbang->mdo, "mdo")) 149 + goto out_free_bus; 150 + gpio_direction_output(bitbang->mdo, 1); 151 + gpio_direction_input(bitbang->mdio); 152 + } 174 153 175 154 gpio_direction_output(bitbang->mdc, 0); 176 155 ··· 185 150 186 151 return new_bus; 187 152 188 - out_free_mdc: 189 - gpio_free(bitbang->mdc); 190 153 out_free_bus: 191 154 free_mdio_bitbang(new_bus); 192 - out_free_bitbang: 193 - kfree(bitbang); 194 155 out: 195 156 return NULL; 196 157 } ··· 194 163 static void mdio_gpio_bus_deinit(struct device *dev) 195 164 { 196 165 struct mii_bus *bus = dev_get_drvdata(dev); 197 - struct mdio_gpio_info *bitbang = bus->priv; 198 166 199 - dev_set_drvdata(dev, NULL); 200 - gpio_free(bitbang->mdio); 201 - gpio_free(bitbang->mdc); 202 167 free_mdio_bitbang(bus); 203 - kfree(bitbang); 204 168 } 205 169 206 170 static void mdio_gpio_bus_destroy(struct device *dev)
+2
drivers/net/wireless/cw1200/debug.c
··· 41 41 "REQ", 42 42 "SOFT", 43 43 "HARD", 44 + "RESET", 45 + "RESET_REMAP", 44 46 }; 45 47 46 48 static const char *cw1200_debug_mode(int mode)
+3 -2
drivers/net/wireless/iwlwifi/iwl-7000.c
··· 67 67 #include "iwl-agn-hw.h" 68 68 69 69 /* Highest firmware API version supported */ 70 - #define IWL7260_UCODE_API_MAX 8 71 - #define IWL3160_UCODE_API_MAX 8 70 + #define IWL7260_UCODE_API_MAX 9 71 + #define IWL3160_UCODE_API_MAX 9 72 72 73 73 /* Oldest version we won't warn about */ 74 74 #define IWL7260_UCODE_API_OK 8 ··· 244 244 245 245 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); 246 246 MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); 247 + MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
+11 -7
drivers/net/wireless/iwlwifi/mvm/coex.c
··· 190 190 cpu_to_le32(0xcc00aaaa), 191 191 cpu_to_le32(0x0000aaaa), 192 192 cpu_to_le32(0xc0004000), 193 - cpu_to_le32(0x00000000), 193 + cpu_to_le32(0x00004000), 194 194 cpu_to_le32(0xf0005000), 195 195 cpu_to_le32(0xf0005000), 196 196 }, ··· 213 213 /* Tx Tx disabled */ 214 214 cpu_to_le32(0xaaaaaaaa), 215 215 cpu_to_le32(0xaaaaaaaa), 216 - cpu_to_le32(0xaaaaaaaa), 216 + cpu_to_le32(0xeeaaaaaa), 217 217 cpu_to_le32(0xaaaaaaaa), 218 218 cpu_to_le32(0xcc00ff28), 219 219 cpu_to_le32(0x0000aaaa), 220 220 cpu_to_le32(0xcc00aaaa), 221 221 cpu_to_le32(0x0000aaaa), 222 - cpu_to_le32(0xC0004000), 223 - cpu_to_le32(0xC0004000), 224 - cpu_to_le32(0xF0005000), 225 - cpu_to_le32(0xF0005000), 222 + cpu_to_le32(0xc0004000), 223 + cpu_to_le32(0xc0004000), 224 + cpu_to_le32(0xf0005000), 225 + cpu_to_le32(0xf0005000), 226 226 }, 227 227 }; 228 228 ··· 1262 1262 struct iwl_rx_packet *pkt = rxb_addr(rxb); 1263 1263 u32 ant_isolation = le32_to_cpup((void *)pkt->data); 1264 1264 u8 __maybe_unused lower_bound, upper_bound; 1265 + int ret; 1265 1266 u8 lut; 1266 1267 1267 1268 struct iwl_bt_coex_cmd *bt_cmd; ··· 1319 1318 memcpy(bt_cmd->bt4_corun_lut40, antenna_coupling_ranges[lut].lut20, 1320 1319 sizeof(bt_cmd->bt4_corun_lut40)); 1321 1320 1322 - return 0; 1321 + ret = iwl_mvm_send_cmd(mvm, &cmd); 1322 + 1323 + kfree(bt_cmd); 1324 + return ret; 1323 1325 }
+1
drivers/net/wireless/iwlwifi/mvm/mac80211.c
··· 1332 1332 */ 1333 1333 iwl_mvm_remove_time_event(mvm, mvmvif, 1334 1334 &mvmvif->time_event_data); 1335 + iwl_mvm_sf_update(mvm, vif, false); 1335 1336 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC)); 1336 1337 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | 1337 1338 BSS_CHANGED_QOS)) {
+170 -101
drivers/net/wireless/iwlwifi/mvm/rs.c
··· 59 59 /* max allowed rate miss before sync LQ cmd */ 60 60 #define IWL_MISSED_RATE_MAX 15 61 61 #define RS_STAY_IN_COLUMN_TIMEOUT (5*HZ) 62 - 62 + #define RS_IDLE_TIMEOUT (5*HZ) 63 63 64 64 static u8 rs_ht_to_legacy[] = { 65 65 [IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX, ··· 142 142 RS_MIMO2, 143 143 }; 144 144 145 - #define MAX_NEXT_COLUMNS 5 145 + #define MAX_NEXT_COLUMNS 7 146 146 #define MAX_COLUMN_CHECKS 3 147 147 148 148 typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm, ··· 212 212 RS_COLUMN_LEGACY_ANT_B, 213 213 RS_COLUMN_SISO_ANT_A, 214 214 RS_COLUMN_SISO_ANT_B, 215 - RS_COLUMN_MIMO2, 216 - RS_COLUMN_MIMO2_SGI, 215 + RS_COLUMN_INVALID, 216 + RS_COLUMN_INVALID, 217 + RS_COLUMN_INVALID, 218 + RS_COLUMN_INVALID, 217 219 }, 218 220 }, 219 221 [RS_COLUMN_LEGACY_ANT_B] = { ··· 225 223 RS_COLUMN_LEGACY_ANT_A, 226 224 RS_COLUMN_SISO_ANT_A, 227 225 RS_COLUMN_SISO_ANT_B, 228 - RS_COLUMN_MIMO2, 229 - RS_COLUMN_MIMO2_SGI, 226 + RS_COLUMN_INVALID, 227 + RS_COLUMN_INVALID, 228 + RS_COLUMN_INVALID, 229 + RS_COLUMN_INVALID, 230 230 }, 231 231 }, 232 232 [RS_COLUMN_SISO_ANT_A] = { ··· 239 235 RS_COLUMN_MIMO2, 240 236 RS_COLUMN_SISO_ANT_A_SGI, 241 237 RS_COLUMN_SISO_ANT_B_SGI, 242 - RS_COLUMN_MIMO2_SGI, 238 + RS_COLUMN_LEGACY_ANT_A, 239 + RS_COLUMN_LEGACY_ANT_B, 240 + RS_COLUMN_INVALID, 243 241 }, 244 242 .checks = { 245 243 rs_siso_allow, ··· 255 249 RS_COLUMN_MIMO2, 256 250 RS_COLUMN_SISO_ANT_B_SGI, 257 251 RS_COLUMN_SISO_ANT_A_SGI, 258 - RS_COLUMN_MIMO2_SGI, 252 + RS_COLUMN_LEGACY_ANT_A, 253 + RS_COLUMN_LEGACY_ANT_B, 254 + RS_COLUMN_INVALID, 259 255 }, 260 256 .checks = { 261 257 rs_siso_allow, ··· 273 265 RS_COLUMN_SISO_ANT_A, 274 266 RS_COLUMN_SISO_ANT_B, 275 267 RS_COLUMN_MIMO2, 268 + RS_COLUMN_LEGACY_ANT_A, 269 + RS_COLUMN_LEGACY_ANT_B, 276 270 }, 277 271 .checks = { 278 272 rs_siso_allow, ··· 291 281 RS_COLUMN_SISO_ANT_B, 292 282 RS_COLUMN_SISO_ANT_A, 293 283 RS_COLUMN_MIMO2, 284 + RS_COLUMN_LEGACY_ANT_A, 285 + RS_COLUMN_LEGACY_ANT_B, 294 286 }, 295 287 .checks = { 296 288 rs_siso_allow, ··· 308 296 RS_COLUMN_SISO_ANT_A_SGI, 309 297 RS_COLUMN_SISO_ANT_B_SGI, 310 298 RS_COLUMN_MIMO2_SGI, 299 + RS_COLUMN_LEGACY_ANT_A, 300 + RS_COLUMN_LEGACY_ANT_B, 311 301 }, 312 302 .checks = { 313 303 rs_mimo_allow, ··· 325 311 RS_COLUMN_SISO_ANT_A, 326 312 RS_COLUMN_SISO_ANT_B, 327 313 RS_COLUMN_MIMO2, 314 + RS_COLUMN_LEGACY_ANT_A, 315 + RS_COLUMN_LEGACY_ANT_B, 328 316 }, 329 317 .checks = { 330 318 rs_mimo_allow, ··· 519 503 window->average_tpt = IWL_INVALID_VALUE; 520 504 } 521 505 522 - static void rs_rate_scale_clear_tbl_windows(struct iwl_scale_tbl_info *tbl) 506 + static void rs_rate_scale_clear_tbl_windows(struct iwl_mvm *mvm, 507 + struct iwl_scale_tbl_info *tbl) 523 508 { 524 509 int i; 525 510 511 + IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); 526 512 for (i = 0; i < IWL_RATE_COUNT; i++) 527 513 rs_rate_scale_clear_window(&tbl->win[i]); 528 514 } ··· 1010 992 return; 1011 993 } 1012 994 995 + #ifdef CPTCFG_MAC80211_DEBUGFS 996 + /* Disable last tx check if we are debugging with fixed rate */ 997 + if (lq_sta->dbg_fixed_rate) { 998 + IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n"); 999 + return; 1000 + } 1001 + #endif 1013 1002 if (!ieee80211_is_data(hdr->frame_control) || 1014 1003 info->flags & IEEE80211_TX_CTL_NO_ACK) 1015 1004 return; ··· 1058 1033 if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE)) 1059 1034 mac_index++; 1060 1035 } 1036 + 1037 + if (time_after(jiffies, 1038 + (unsigned long)(lq_sta->last_tx + RS_IDLE_TIMEOUT))) { 1039 + int tid; 1040 + IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n"); 1041 + for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++) 1042 + ieee80211_stop_tx_ba_session(sta, tid); 1043 + 1044 + iwl_mvm_rs_rate_init(mvm, sta, sband->band, false); 1045 + return; 1046 + } 1047 + lq_sta->last_tx = jiffies; 1061 1048 1062 1049 /* Here we actually compare this rate to the latest LQ command */ 1063 1050 if ((mac_index < 0) || ··· 1223 1186 lq_sta->visited_columns = 0; 1224 1187 } 1225 1188 1189 + static int rs_get_max_allowed_rate(struct iwl_lq_sta *lq_sta, 1190 + const struct rs_tx_column *column) 1191 + { 1192 + switch (column->mode) { 1193 + case RS_LEGACY: 1194 + return lq_sta->max_legacy_rate_idx; 1195 + case RS_SISO: 1196 + return lq_sta->max_siso_rate_idx; 1197 + case RS_MIMO2: 1198 + return lq_sta->max_mimo2_rate_idx; 1199 + default: 1200 + WARN_ON_ONCE(1); 1201 + } 1202 + 1203 + return lq_sta->max_legacy_rate_idx; 1204 + } 1205 + 1226 1206 static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta, 1227 - const struct rs_tx_column *column, 1228 - u32 bw) 1207 + const struct rs_tx_column *column, 1208 + u32 bw) 1229 1209 { 1230 1210 /* Used to choose among HT tables */ 1231 1211 const u16 (*ht_tbl_pointer)[IWL_RATE_COUNT]; ··· 1492 1438 1493 1439 IWL_DEBUG_RATE(mvm, 1494 1440 "LQ: stay in table clear win\n"); 1495 - rs_rate_scale_clear_tbl_windows(tbl); 1441 + rs_rate_scale_clear_tbl_windows(mvm, tbl); 1496 1442 } 1497 1443 } 1498 1444 ··· 1500 1446 * bitmaps and stats in active table (this will become the new 1501 1447 * "search" table). */ 1502 1448 if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) { 1503 - IWL_DEBUG_RATE(mvm, "Clearing up window stats\n"); 1504 - rs_rate_scale_clear_tbl_windows(tbl); 1449 + rs_rate_scale_clear_tbl_windows(mvm, tbl); 1505 1450 } 1506 1451 } 1507 1452 } ··· 1538 1485 struct ieee80211_sta *sta, 1539 1486 struct iwl_scale_tbl_info *tbl) 1540 1487 { 1541 - int i, j, n; 1488 + int i, j, max_rate; 1542 1489 enum rs_column next_col_id; 1543 1490 const struct rs_tx_column *curr_col = &rs_tx_columns[tbl->column]; 1544 1491 const struct rs_tx_column *next_col; 1545 1492 allow_column_func_t allow_func; 1546 1493 u8 valid_ants = mvm->fw->valid_tx_ant; 1547 1494 const u16 *expected_tpt_tbl; 1548 - s32 tpt, max_expected_tpt; 1495 + u16 tpt, max_expected_tpt; 1549 1496 1550 1497 for (i = 0; i < MAX_NEXT_COLUMNS; i++) { 1551 1498 next_col_id = curr_col->next_columns[i]; ··· 1588 1535 if (WARN_ON_ONCE(!expected_tpt_tbl)) 1589 1536 continue; 1590 1537 1591 - max_expected_tpt = 0; 1592 - for (n = 0; n < IWL_RATE_COUNT; n++) 1593 - if (expected_tpt_tbl[n] > max_expected_tpt) 1594 - max_expected_tpt = expected_tpt_tbl[n]; 1538 + max_rate = rs_get_max_allowed_rate(lq_sta, next_col); 1539 + if (WARN_ON_ONCE(max_rate == IWL_RATE_INVALID)) 1540 + continue; 1595 1541 1542 + max_expected_tpt = expected_tpt_tbl[max_rate]; 1596 1543 if (tpt >= max_expected_tpt) { 1597 1544 IWL_DEBUG_RATE(mvm, 1598 1545 "Skip column %d: can't beat current TPT. Max expected %d current %d\n", ··· 1600 1547 continue; 1601 1548 } 1602 1549 1550 + IWL_DEBUG_RATE(mvm, 1551 + "Found potential column %d. Max expected %d current %d\n", 1552 + next_col_id, max_expected_tpt, tpt); 1603 1553 break; 1604 1554 } 1605 1555 1606 1556 if (i == MAX_NEXT_COLUMNS) 1607 1557 return RS_COLUMN_INVALID; 1608 - 1609 - IWL_DEBUG_RATE(mvm, "Found potential column %d\n", next_col_id); 1610 1558 1611 1559 return next_col_id; 1612 1560 } ··· 1694 1640 { 1695 1641 enum rs_action action = RS_ACTION_STAY; 1696 1642 1697 - /* Too many failures, decrease rate */ 1698 1643 if ((sr <= RS_SR_FORCE_DECREASE) || (current_tpt == 0)) { 1699 1644 IWL_DEBUG_RATE(mvm, 1700 - "decrease rate because of low SR\n"); 1645 + "Decrease rate because of low SR\n"); 1646 + return RS_ACTION_DOWNSCALE; 1647 + } 1648 + 1649 + if ((low_tpt == IWL_INVALID_VALUE) && 1650 + (high_tpt == IWL_INVALID_VALUE) && 1651 + (high != IWL_RATE_INVALID)) { 1652 + IWL_DEBUG_RATE(mvm, 1653 + "No data about high/low rates. Increase rate\n"); 1654 + return RS_ACTION_UPSCALE; 1655 + } 1656 + 1657 + if ((high_tpt == IWL_INVALID_VALUE) && 1658 + (high != IWL_RATE_INVALID) && 1659 + (low_tpt != IWL_INVALID_VALUE) && 1660 + (low_tpt < current_tpt)) { 1661 + IWL_DEBUG_RATE(mvm, 1662 + "No data about high rate and low rate is worse. Increase rate\n"); 1663 + return RS_ACTION_UPSCALE; 1664 + } 1665 + 1666 + if ((high_tpt != IWL_INVALID_VALUE) && 1667 + (high_tpt > current_tpt)) { 1668 + IWL_DEBUG_RATE(mvm, 1669 + "Higher rate is better. Increate rate\n"); 1670 + return RS_ACTION_UPSCALE; 1671 + } 1672 + 1673 + if ((low_tpt != IWL_INVALID_VALUE) && 1674 + (high_tpt != IWL_INVALID_VALUE) && 1675 + (low_tpt < current_tpt) && 1676 + (high_tpt < current_tpt)) { 1677 + IWL_DEBUG_RATE(mvm, 1678 + "Both high and low are worse. Maintain rate\n"); 1679 + return RS_ACTION_STAY; 1680 + } 1681 + 1682 + if ((low_tpt != IWL_INVALID_VALUE) && 1683 + (low_tpt > current_tpt)) { 1684 + IWL_DEBUG_RATE(mvm, 1685 + "Lower rate is better\n"); 1701 1686 action = RS_ACTION_DOWNSCALE; 1702 - /* No throughput measured yet for adjacent rates; try increase. */ 1703 - } else if ((low_tpt == IWL_INVALID_VALUE) && 1704 - (high_tpt == IWL_INVALID_VALUE)) { 1705 - if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) { 1687 + goto out; 1688 + } 1689 + 1690 + if ((low_tpt == IWL_INVALID_VALUE) && 1691 + (low != IWL_RATE_INVALID)) { 1692 + IWL_DEBUG_RATE(mvm, 1693 + "No data about lower rate\n"); 1694 + action = RS_ACTION_DOWNSCALE; 1695 + goto out; 1696 + } 1697 + 1698 + IWL_DEBUG_RATE(mvm, "Maintain rate\n"); 1699 + 1700 + out: 1701 + if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID)) { 1702 + if (sr >= RS_SR_NO_DECREASE) { 1706 1703 IWL_DEBUG_RATE(mvm, 1707 - "Good SR and no high rate measurement. " 1708 - "Increase rate\n"); 1709 - action = RS_ACTION_UPSCALE; 1710 - } else if (low != IWL_RATE_INVALID) { 1711 - IWL_DEBUG_RATE(mvm, 1712 - "Remain in current rate\n"); 1704 + "SR is above NO DECREASE. Avoid downscale\n"); 1713 1705 action = RS_ACTION_STAY; 1706 + } else if (current_tpt > (100 * tbl->expected_tpt[low])) { 1707 + IWL_DEBUG_RATE(mvm, 1708 + "Current TPT is higher than max expected in low rate. Avoid downscale\n"); 1709 + action = RS_ACTION_STAY; 1710 + } else { 1711 + IWL_DEBUG_RATE(mvm, "Decrease rate\n"); 1714 1712 } 1715 - } 1716 - 1717 - /* Both adjacent throughputs are measured, but neither one has better 1718 - * throughput; we're using the best rate, don't change it! 1719 - */ 1720 - else if ((low_tpt != IWL_INVALID_VALUE) && 1721 - (high_tpt != IWL_INVALID_VALUE) && 1722 - (low_tpt < current_tpt) && 1723 - (high_tpt < current_tpt)) { 1724 - IWL_DEBUG_RATE(mvm, 1725 - "Both high and low are worse. " 1726 - "Maintain rate\n"); 1727 - action = RS_ACTION_STAY; 1728 - } 1729 - 1730 - /* At least one adjacent rate's throughput is measured, 1731 - * and may have better performance. 1732 - */ 1733 - else { 1734 - /* Higher adjacent rate's throughput is measured */ 1735 - if (high_tpt != IWL_INVALID_VALUE) { 1736 - /* Higher rate has better throughput */ 1737 - if (high_tpt > current_tpt && 1738 - sr >= IWL_RATE_INCREASE_TH) { 1739 - IWL_DEBUG_RATE(mvm, 1740 - "Higher rate is better and good " 1741 - "SR. Increate rate\n"); 1742 - action = RS_ACTION_UPSCALE; 1743 - } else { 1744 - IWL_DEBUG_RATE(mvm, 1745 - "Higher rate isn't better OR " 1746 - "no good SR. Maintain rate\n"); 1747 - action = RS_ACTION_STAY; 1748 - } 1749 - 1750 - /* Lower adjacent rate's throughput is measured */ 1751 - } else if (low_tpt != IWL_INVALID_VALUE) { 1752 - /* Lower rate has better throughput */ 1753 - if (low_tpt > current_tpt) { 1754 - IWL_DEBUG_RATE(mvm, 1755 - "Lower rate is better. " 1756 - "Decrease rate\n"); 1757 - action = RS_ACTION_DOWNSCALE; 1758 - } else if (sr >= IWL_RATE_INCREASE_TH) { 1759 - IWL_DEBUG_RATE(mvm, 1760 - "Lower rate isn't better and " 1761 - "good SR. Increase rate\n"); 1762 - action = RS_ACTION_UPSCALE; 1763 - } 1764 - } 1765 - } 1766 - 1767 - /* Sanity check; asked for decrease, but success rate or throughput 1768 - * has been good at old rate. Don't change it. 1769 - */ 1770 - if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID) && 1771 - ((sr > IWL_RATE_HIGH_TH) || 1772 - (current_tpt > (100 * tbl->expected_tpt[low])))) { 1773 - IWL_DEBUG_RATE(mvm, 1774 - "Sanity check failed. Maintain rate\n"); 1775 - action = RS_ACTION_STAY; 1776 1713 } 1777 1714 1778 1715 return action; ··· 1837 1792 "Aggregation changed: prev %d current %d. Update expected TPT table\n", 1838 1793 prev_agg, lq_sta->is_agg); 1839 1794 rs_set_expected_tpt_table(lq_sta, tbl); 1795 + rs_rate_scale_clear_tbl_windows(mvm, tbl); 1840 1796 } 1841 1797 1842 1798 /* current tx rate */ ··· 2067 2021 if (lq_sta->search_better_tbl) { 2068 2022 /* Access the "search" table, clear its history. */ 2069 2023 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]); 2070 - rs_rate_scale_clear_tbl_windows(tbl); 2024 + rs_rate_scale_clear_tbl_windows(mvm, tbl); 2071 2025 2072 2026 /* Use new "search" start rate */ 2073 2027 index = tbl->rate.index; ··· 2088 2042 * stay with best antenna legacy modulation for a while 2089 2043 * before next round of mode comparisons. */ 2090 2044 tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); 2091 - if (is_legacy(&tbl1->rate) && !sta->ht_cap.ht_supported) { 2045 + if (is_legacy(&tbl1->rate)) { 2092 2046 IWL_DEBUG_RATE(mvm, "LQ: STAY in legacy table\n"); 2047 + 2048 + if (tid != IWL_MAX_TID_COUNT) { 2049 + tid_data = &sta_priv->tid_data[tid]; 2050 + if (tid_data->state != IWL_AGG_OFF) { 2051 + IWL_DEBUG_RATE(mvm, 2052 + "Stop aggregation on tid %d\n", 2053 + tid); 2054 + ieee80211_stop_tx_ba_session(sta, tid); 2055 + } 2056 + } 2093 2057 rs_set_stay_in_table(mvm, 1, lq_sta); 2094 2058 } else { 2095 2059 /* If we're in an HT mode, and all 3 mode switch actions ··· 2398 2342 lq_sta->lq.sta_id = sta_priv->sta_id; 2399 2343 2400 2344 for (j = 0; j < LQ_SIZE; j++) 2401 - rs_rate_scale_clear_tbl_windows(&lq_sta->lq_info[j]); 2345 + rs_rate_scale_clear_tbl_windows(mvm, &lq_sta->lq_info[j]); 2402 2346 2403 2347 lq_sta->flush_timer = 0; 2348 + lq_sta->last_tx = jiffies; 2404 2349 2405 2350 IWL_DEBUG_RATE(mvm, 2406 2351 "LQ: *** rate scale station global init for station %d ***\n", ··· 2445 2388 lq_sta->is_vht = true; 2446 2389 } 2447 2390 2448 - IWL_DEBUG_RATE(mvm, 2449 - "SISO-RATE=%X MIMO2-RATE=%X VHT=%d\n", 2391 + lq_sta->max_legacy_rate_idx = find_last_bit(&lq_sta->active_legacy_rate, 2392 + BITS_PER_LONG); 2393 + lq_sta->max_siso_rate_idx = find_last_bit(&lq_sta->active_siso_rate, 2394 + BITS_PER_LONG); 2395 + lq_sta->max_mimo2_rate_idx = find_last_bit(&lq_sta->active_mimo2_rate, 2396 + BITS_PER_LONG); 2397 + 2398 + IWL_DEBUG_RATE(mvm, "RATE MASK: LEGACY=%lX SISO=%lX MIMO2=%lX VHT=%d\n", 2399 + lq_sta->active_legacy_rate, 2450 2400 lq_sta->active_siso_rate, 2451 2401 lq_sta->active_mimo2_rate, 2452 2402 lq_sta->is_vht); 2403 + IWL_DEBUG_RATE(mvm, "MAX RATE: LEGACY=%d SISO=%d MIMO2=%d\n", 2404 + lq_sta->max_legacy_rate_idx, 2405 + lq_sta->max_siso_rate_idx, 2406 + lq_sta->max_mimo2_rate_idx); 2453 2407 2454 2408 /* These values will be overridden later */ 2455 2409 lq_sta->lq.single_stream_ant_msk = ··· 2615 2547 if (is_siso(&rate)) { 2616 2548 num_rates = RS_SECONDARY_SISO_NUM_RATES; 2617 2549 num_retries = RS_SECONDARY_SISO_RETRIES; 2550 + lq_cmd->mimo_delim = index; 2618 2551 } else if (is_legacy(&rate)) { 2619 2552 num_rates = RS_SECONDARY_LEGACY_NUM_RATES; 2620 2553 num_retries = RS_LEGACY_RETRIES_PER_RATE; ··· 2818 2749 return -ENOMEM; 2819 2750 2820 2751 desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id); 2821 - desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n", 2752 + desc += sprintf(buff+desc, "failed=%d success=%d rate=0%lX\n", 2822 2753 lq_sta->total_failed, lq_sta->total_success, 2823 2754 lq_sta->active_legacy_rate); 2824 2755 desc += sprintf(buff+desc, "fixed rate 0x%X\n",
+11 -3
drivers/net/wireless/iwlwifi/mvm/rs.h
··· 156 156 #define IWL_RATE_HIGH_TH 10880 /* 85% */ 157 157 #define IWL_RATE_INCREASE_TH 6400 /* 50% */ 158 158 #define RS_SR_FORCE_DECREASE 1920 /* 15% */ 159 + #define RS_SR_NO_DECREASE 10880 /* 85% */ 159 160 160 161 #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */ 161 162 #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000) ··· 311 310 u32 visited_columns; /* Bitmask marking which Tx columns were 312 311 * explored during a search cycle 313 312 */ 313 + u64 last_tx; 314 314 bool is_vht; 315 315 enum ieee80211_band band; 316 316 317 317 /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */ 318 - u16 active_legacy_rate; 319 - u16 active_siso_rate; 320 - u16 active_mimo2_rate; 318 + unsigned long active_legacy_rate; 319 + unsigned long active_siso_rate; 320 + unsigned long active_mimo2_rate; 321 + 322 + /* Highest rate per Tx mode */ 323 + u8 max_legacy_rate_idx; 324 + u8 max_siso_rate_idx; 325 + u8 max_mimo2_rate_idx; 326 + 321 327 s8 max_rate_idx; /* Max rate set by user */ 322 328 u8 missed_rate_counter; 323 329
+2 -1
drivers/net/wireless/iwlwifi/mvm/sf.c
··· 274 274 return -EINVAL; 275 275 if (changed_vif->type != NL80211_IFTYPE_STATION) { 276 276 new_state = SF_UNINIT; 277 - } else if (changed_vif->bss_conf.assoc) { 277 + } else if (changed_vif->bss_conf.assoc && 278 + changed_vif->bss_conf.dtim_period) { 278 279 mvmvif = iwl_mvm_vif_from_mac80211(changed_vif); 279 280 sta_id = mvmvif->ap_sta_id; 280 281 new_state = SF_FULL_ON;
+2
drivers/net/wireless/iwlwifi/pcie/drv.c
··· 373 373 {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)}, 374 374 {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)}, 375 375 {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)}, 376 + {IWL_PCI_DEVICE(0x095A, 0x5102, iwl7265_n_cfg)}, 376 377 {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, 377 378 {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, 378 379 {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, 379 380 {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, 380 381 {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, 381 382 {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, 383 + {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)}, 382 384 {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)}, 383 385 {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)}, 384 386 {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)},
+6 -6
drivers/net/wireless/mwifiex/main.c
··· 292 292 while ((skb = skb_dequeue(&adapter->usb_rx_data_q))) 293 293 mwifiex_handle_rx_packet(adapter, skb); 294 294 295 + /* Check for event */ 296 + if (adapter->event_received) { 297 + adapter->event_received = false; 298 + mwifiex_process_event(adapter); 299 + } 300 + 295 301 /* Check for Cmd Resp */ 296 302 if (adapter->cmd_resp_received) { 297 303 adapter->cmd_resp_received = false; ··· 308 302 adapter->hw_status = MWIFIEX_HW_STATUS_READY; 309 303 mwifiex_init_fw_complete(adapter); 310 304 } 311 - } 312 - 313 - /* Check for event */ 314 - if (adapter->event_received) { 315 - adapter->event_received = false; 316 - mwifiex_process_event(adapter); 317 305 } 318 306 319 307 /* Check if we need to confirm Sleep Request
+4 -3
drivers/net/wireless/mwifiex/sta_ioctl.c
··· 60 60 int status; 61 61 62 62 /* Wait for completion */ 63 - status = wait_event_interruptible(adapter->cmd_wait_q.wait, 64 - *(cmd_queued->condition)); 65 - if (status) { 63 + status = wait_event_interruptible_timeout(adapter->cmd_wait_q.wait, 64 + *(cmd_queued->condition), 65 + (12 * HZ)); 66 + if (status <= 0) { 66 67 dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); 67 68 mwifiex_cancel_all_pending_cmd(adapter); 68 69 return status;
+1 -1
drivers/net/wireless/rsi/rsi_91x_core.c
··· 88 88 bool recontend_queue = false; 89 89 u32 q_len = 0; 90 90 u8 q_num = INVALID_QUEUE; 91 - u8 ii, min = 0; 91 + u8 ii = 0, min = 0; 92 92 93 93 if (skb_queue_len(&common->tx_queue[MGMT_SOFT_Q])) { 94 94 if (!common->mgmt_q_block)
+11 -10
drivers/net/wireless/rsi/rsi_91x_mgmt.c
··· 841 841 rsi_dbg(MGMT_TX_ZONE, 842 842 "%s: Sending scan req frame\n", __func__); 843 843 844 - skb = dev_alloc_skb(FRAME_DESC_SZ); 845 - if (!skb) { 846 - rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", 847 - __func__); 848 - return -ENOMEM; 849 - } 850 - 851 - memset(skb->data, 0, FRAME_DESC_SZ); 852 - mgmt_frame = (struct rsi_mac_frame *)skb->data; 853 - 854 844 if (common->band == IEEE80211_BAND_5GHZ) { 855 845 if ((channel >= 36) && (channel <= 64)) 856 846 channel = ((channel - 32) / 4); ··· 857 867 return -EINVAL; 858 868 } 859 869 } 870 + 871 + skb = dev_alloc_skb(FRAME_DESC_SZ); 872 + if (!skb) { 873 + rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n", 874 + __func__); 875 + return -ENOMEM; 876 + } 877 + 878 + memset(skb->data, 0, FRAME_DESC_SZ); 879 + mgmt_frame = (struct rsi_mac_frame *)skb->data; 860 880 861 881 mgmt_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12); 862 882 mgmt_frame->desc_word[1] = cpu_to_le16(SCAN_REQUEST); ··· 966 966 if (!selected_rates) { 967 967 rsi_dbg(ERR_ZONE, "%s: Failed in allocation of mem\n", 968 968 __func__); 969 + dev_kfree_skb(skb); 969 970 return -ENOMEM; 970 971 } 971 972
+20
drivers/net/wireless/ti/wl18xx/event.h
··· 68 68 69 69 /* bitmap of inactive stations (by HLID) */ 70 70 __le32 inactive_sta_bitmap; 71 + 72 + /* rx BA win size indicated by RX_BA_WIN_SIZE_CHANGE_EVENT_ID */ 73 + u8 rx_ba_role_id; 74 + u8 rx_ba_link_id; 75 + u8 rx_ba_win_size; 76 + u8 padding; 77 + 78 + /* smart config */ 79 + u8 sc_ssid_len; 80 + u8 sc_pwd_len; 81 + u8 sc_token_len; 82 + u8 padding1; 83 + u8 sc_ssid[32]; 84 + u8 sc_pwd[32]; 85 + u8 sc_token[32]; 86 + 87 + /* smart config sync channel */ 88 + u8 sc_sync_channel; 89 + u8 sc_sync_band; 90 + u8 padding2[2]; 71 91 } __packed; 72 92 73 93 int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
+5
drivers/net/wireless/ti/wlcore/event.c
··· 158 158 159 159 void wlcore_event_dummy_packet(struct wl1271 *wl) 160 160 { 161 + if (wl->plt) { 162 + wl1271_info("Got DUMMY_PACKET event in PLT mode. FW bug, ignoring."); 163 + return; 164 + } 165 + 161 166 wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); 162 167 wl1271_tx_dummy_packet(wl); 163 168 }
+5
include/linux/mdio-gpio.h
··· 17 17 /* GPIO numbers for bus pins */ 18 18 unsigned int mdc; 19 19 unsigned int mdio; 20 + unsigned int mdo; 21 + 22 + bool mdc_active_low; 23 + bool mdio_active_low; 24 + bool mdo_active_low; 20 25 21 26 unsigned int phy_mask; 22 27 int irqs[PHY_MAX_ADDR];
+3
include/linux/phy.h
··· 75 75 PHY_INTERFACE_MODE_SMII, 76 76 PHY_INTERFACE_MODE_XGMII, 77 77 PHY_INTERFACE_MODE_MOCA, 78 + PHY_INTERFACE_MODE_QSGMII, 78 79 PHY_INTERFACE_MODE_MAX, 79 80 } phy_interface_t; 80 81 ··· 117 116 return "xgmii"; 118 117 case PHY_INTERFACE_MODE_MOCA: 119 118 return "moca"; 119 + case PHY_INTERFACE_MODE_QSGMII: 120 + return "qsgmii"; 120 121 default: 121 122 return "unknown"; 122 123 }
+9 -1
include/net/flow.h
··· 11 11 #include <linux/in6.h> 12 12 #include <linux/atomic.h> 13 13 14 + /* 15 + * ifindex generation is per-net namespace, and loopback is 16 + * always the 1st device in ns (see net_dev_init), thus any 17 + * loopback device should get ifindex 1 18 + */ 19 + 20 + #define LOOPBACK_IFINDEX 1 21 + 14 22 struct flowi_common { 15 23 int flowic_oif; 16 24 int flowic_iif; ··· 88 80 __be16 dport, __be16 sport) 89 81 { 90 82 fl4->flowi4_oif = oif; 91 - fl4->flowi4_iif = 0; 83 + fl4->flowi4_iif = LOOPBACK_IFINDEX; 92 84 fl4->flowi4_mark = mark; 93 85 fl4->flowi4_tos = tos; 94 86 fl4->flowi4_scope = scope;
+1 -8
include/net/net_namespace.h
··· 9 9 #include <linux/list.h> 10 10 #include <linux/sysctl.h> 11 11 12 + #include <net/flow.h> 12 13 #include <net/netns/core.h> 13 14 #include <net/netns/mib.h> 14 15 #include <net/netns/unix.h> ··· 131 130 struct sock *diag_nlsk; 132 131 atomic_t fnhe_genid; 133 132 }; 134 - 135 - /* 136 - * ifindex generation is per-net namespace, and loopback is 137 - * always the 1st device in ns (see net_dev_init), thus any 138 - * loopback device should get ifindex 1 139 - */ 140 - 141 - #define LOOPBACK_IFINDEX 1 142 133 143 134 #include <linux/seq_file_net.h> 144 135
+3 -1
include/net/sctp/structs.h
··· 1241 1241 /* SCTP-AUTH: endpoint shared keys */ 1242 1242 struct list_head endpoint_shared_keys; 1243 1243 __u16 active_key_id; 1244 + __u8 auth_enable; 1244 1245 }; 1245 1246 1246 1247 /* Recover the outter endpoint structure. */ ··· 1270 1269 int sctp_has_association(struct net *net, const union sctp_addr *laddr, 1271 1270 const union sctp_addr *paddr); 1272 1271 1273 - int sctp_verify_init(struct net *net, const struct sctp_association *asoc, 1272 + int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep, 1273 + const struct sctp_association *asoc, 1274 1274 sctp_cid_t, sctp_init_chunk_t *peer_init, 1275 1275 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk); 1276 1276 int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
+2
kernel/seccomp.c
··· 255 255 goto free_prog; 256 256 257 257 /* Allocate a new seccomp_filter */ 258 + ret = -ENOMEM; 258 259 filter = kzalloc(sizeof(struct seccomp_filter) + 259 260 sizeof(struct sock_filter_int) * new_len, 260 261 GFP_KERNEL|__GFP_NOWARN); ··· 265 264 ret = sk_convert_filter(fp, fprog->len, filter->insnsi, &new_len); 266 265 if (ret) 267 266 goto free_filter; 267 + kfree(fp); 268 268 269 269 atomic_set(&filter->usage, 1); 270 270 filter->len = new_len;
+41 -5
net/8021q/vlan_dev.c
··· 493 493 } 494 494 } 495 495 496 + static int vlan_calculate_locking_subclass(struct net_device *real_dev) 497 + { 498 + int subclass = 0; 499 + 500 + while (is_vlan_dev(real_dev)) { 501 + subclass++; 502 + real_dev = vlan_dev_priv(real_dev)->real_dev; 503 + } 504 + 505 + return subclass; 506 + } 507 + 508 + static void vlan_dev_mc_sync(struct net_device *to, struct net_device *from) 509 + { 510 + int err = 0, subclass; 511 + 512 + subclass = vlan_calculate_locking_subclass(to); 513 + 514 + spin_lock_nested(&to->addr_list_lock, subclass); 515 + err = __hw_addr_sync(&to->mc, &from->mc, to->addr_len); 516 + if (!err) 517 + __dev_set_rx_mode(to); 518 + spin_unlock(&to->addr_list_lock); 519 + } 520 + 521 + static void vlan_dev_uc_sync(struct net_device *to, struct net_device *from) 522 + { 523 + int err = 0, subclass; 524 + 525 + subclass = vlan_calculate_locking_subclass(to); 526 + 527 + spin_lock_nested(&to->addr_list_lock, subclass); 528 + err = __hw_addr_sync(&to->uc, &from->uc, to->addr_len); 529 + if (!err) 530 + __dev_set_rx_mode(to); 531 + spin_unlock(&to->addr_list_lock); 532 + } 533 + 496 534 static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) 497 535 { 498 - dev_mc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); 499 - dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); 536 + vlan_dev_mc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); 537 + vlan_dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev); 500 538 } 501 539 502 540 /* ··· 646 608 647 609 SET_NETDEV_DEVTYPE(dev, &vlan_type); 648 610 649 - if (is_vlan_dev(real_dev)) 650 - subclass = 1; 651 - 611 + subclass = vlan_calculate_locking_subclass(dev); 652 612 vlan_dev_set_lockdep_class(dev, subclass); 653 613 654 614 vlan_dev_priv(dev)->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
+1
net/core/dev.c
··· 5238 5238 if (ops->ndo_set_rx_mode) 5239 5239 ops->ndo_set_rx_mode(dev); 5240 5240 } 5241 + EXPORT_SYMBOL(__dev_set_rx_mode); 5241 5242 5242 5243 void dev_set_rx_mode(struct net_device *dev) 5243 5244 {
+1 -1
net/ipv4/fib_frontend.c
··· 250 250 bool dev_match; 251 251 252 252 fl4.flowi4_oif = 0; 253 - fl4.flowi4_iif = oif; 253 + fl4.flowi4_iif = oif ? : LOOPBACK_IFINDEX; 254 254 fl4.daddr = src; 255 255 fl4.saddr = dst; 256 256 fl4.flowi4_tos = tos;
+1
net/ipv4/fib_semantics.c
··· 631 631 .daddr = nh->nh_gw, 632 632 .flowi4_scope = cfg->fc_scope + 1, 633 633 .flowi4_oif = nh->nh_oif, 634 + .flowi4_iif = LOOPBACK_IFINDEX, 634 635 }; 635 636 636 637 /* It is not necessary, but requires a bit of thinking */
+7 -8
net/ipv4/ip_tunnel.c
··· 722 722 int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd) 723 723 { 724 724 int err = 0; 725 - struct ip_tunnel *t; 726 - struct net *net = dev_net(dev); 727 - struct ip_tunnel *tunnel = netdev_priv(dev); 728 - struct ip_tunnel_net *itn = net_generic(net, tunnel->ip_tnl_net_id); 725 + struct ip_tunnel *t = netdev_priv(dev); 726 + struct net *net = t->net; 727 + struct ip_tunnel_net *itn = net_generic(net, t->ip_tnl_net_id); 729 728 730 729 BUG_ON(!itn->fb_tunnel_dev); 731 730 switch (cmd) { 732 731 case SIOCGETTUNNEL: 733 - t = NULL; 734 - if (dev == itn->fb_tunnel_dev) 732 + if (dev == itn->fb_tunnel_dev) { 735 733 t = ip_tunnel_find(itn, p, itn->fb_tunnel_dev->type); 736 - if (t == NULL) 737 - t = netdev_priv(dev); 734 + if (t == NULL) 735 + t = netdev_priv(dev); 736 + } 738 737 memcpy(p, &t->parms, sizeof(*p)); 739 738 break; 740 739
+1 -1
net/ipv4/ipmr.c
··· 455 455 struct mr_table *mrt; 456 456 struct flowi4 fl4 = { 457 457 .flowi4_oif = dev->ifindex, 458 - .flowi4_iif = skb->skb_iif, 458 + .flowi4_iif = skb->skb_iif ? : LOOPBACK_IFINDEX, 459 459 .flowi4_mark = skb->mark, 460 460 }; 461 461 int err;
+1 -4
net/ipv4/netfilter/ipt_rpfilter.c
··· 89 89 if (ipv4_is_multicast(iph->daddr)) { 90 90 if (ipv4_is_zeronet(iph->saddr)) 91 91 return ipv4_is_local_multicast(iph->daddr) ^ invert; 92 - flow.flowi4_iif = 0; 93 - } else { 94 - flow.flowi4_iif = LOOPBACK_IFINDEX; 95 92 } 96 - 93 + flow.flowi4_iif = LOOPBACK_IFINDEX; 97 94 flow.daddr = iph->saddr; 98 95 flow.saddr = rpfilter_get_saddr(iph->daddr); 99 96 flow.flowi4_oif = 0;
+1 -2
net/ipv4/route.c
··· 1700 1700 1701 1701 if (res.type == RTN_LOCAL) { 1702 1702 err = fib_validate_source(skb, saddr, daddr, tos, 1703 - LOOPBACK_IFINDEX, 1704 - dev, in_dev, &itag); 1703 + 0, dev, in_dev, &itag); 1705 1704 if (err < 0) 1706 1705 goto martian_source_keep_err; 1707 1706 goto local_input;
+4 -4
net/ipv6/ip6_tunnel.c
··· 1340 1340 int err = 0; 1341 1341 struct ip6_tnl_parm p; 1342 1342 struct __ip6_tnl_parm p1; 1343 - struct ip6_tnl *t = NULL; 1344 - struct net *net = dev_net(dev); 1343 + struct ip6_tnl *t = netdev_priv(dev); 1344 + struct net *net = t->net; 1345 1345 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); 1346 1346 1347 1347 switch (cmd) { ··· 1353 1353 } 1354 1354 ip6_tnl_parm_from_user(&p1, &p); 1355 1355 t = ip6_tnl_locate(net, &p1, 0); 1356 + if (t == NULL) 1357 + t = netdev_priv(dev); 1356 1358 } else { 1357 1359 memset(&p, 0, sizeof(p)); 1358 1360 } 1359 - if (t == NULL) 1360 - t = netdev_priv(dev); 1361 1361 ip6_tnl_parm_to_user(&p, &t->parms); 1362 1362 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) { 1363 1363 err = -EFAULT;
+1 -1
net/ipv6/ip6mr.c
··· 700 700 struct mr6_table *mrt; 701 701 struct flowi6 fl6 = { 702 702 .flowi6_oif = dev->ifindex, 703 - .flowi6_iif = skb->skb_iif, 703 + .flowi6_iif = skb->skb_iif ? : LOOPBACK_IFINDEX, 704 704 .flowi6_mark = skb->mark, 705 705 }; 706 706 int err;
+4 -13
net/ipv6/sit.c
··· 1127 1127 int err = 0; 1128 1128 struct ip_tunnel_parm p; 1129 1129 struct ip_tunnel_prl prl; 1130 - struct ip_tunnel *t; 1131 - struct net *net = dev_net(dev); 1130 + struct ip_tunnel *t = netdev_priv(dev); 1131 + struct net *net = t->net; 1132 1132 struct sit_net *sitn = net_generic(net, sit_net_id); 1133 1133 #ifdef CONFIG_IPV6_SIT_6RD 1134 1134 struct ip_tunnel_6rd ip6rd; ··· 1139 1139 #ifdef CONFIG_IPV6_SIT_6RD 1140 1140 case SIOCGET6RD: 1141 1141 #endif 1142 - t = NULL; 1143 1142 if (dev == sitn->fb_tunnel_dev) { 1144 1143 if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) { 1145 1144 err = -EFAULT; 1146 1145 break; 1147 1146 } 1148 1147 t = ipip6_tunnel_locate(net, &p, 0); 1148 + if (t == NULL) 1149 + t = netdev_priv(dev); 1149 1150 } 1150 - if (t == NULL) 1151 - t = netdev_priv(dev); 1152 1151 1153 1152 err = -EFAULT; 1154 1153 if (cmd == SIOCGETTUNNEL) { ··· 1243 1244 err = -EINVAL; 1244 1245 if (dev == sitn->fb_tunnel_dev) 1245 1246 goto done; 1246 - err = -ENOENT; 1247 - if (!(t = netdev_priv(dev))) 1248 - goto done; 1249 1247 err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data); 1250 1248 break; 1251 1249 ··· 1257 1261 goto done; 1258 1262 err = -EFAULT; 1259 1263 if (copy_from_user(&prl, ifr->ifr_ifru.ifru_data, sizeof(prl))) 1260 - goto done; 1261 - err = -ENOENT; 1262 - if (!(t = netdev_priv(dev))) 1263 1264 goto done; 1264 1265 1265 1266 switch (cmd) { ··· 1284 1291 if (copy_from_user(&ip6rd, ifr->ifr_ifru.ifru_data, 1285 1292 sizeof(ip6rd))) 1286 1293 goto done; 1287 - 1288 - t = netdev_priv(dev); 1289 1294 1290 1295 if (cmd != SIOCDEL6RD) { 1291 1296 err = ipip6_tunnel_update_6rd(t, &ip6rd);
+9 -2
net/mac80211/chan.c
··· 249 249 250 250 if (!local->use_chanctx) { 251 251 local->_oper_chandef = *chandef; 252 - ieee80211_hw_config(local, 0); 252 + ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 253 253 } else { 254 254 err = drv_add_chanctx(local, ctx); 255 255 if (err) { ··· 286 286 check_single_channel = true; 287 287 local->hw.conf.radar_enabled = false; 288 288 289 - ieee80211_hw_config(local, 0); 289 + ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); 290 290 } else { 291 291 drv_remove_chanctx(local, ctx); 292 292 } ··· 492 492 rx_chains_static = max(rx_chains_static, needed_static); 493 493 rx_chains_dynamic = max(rx_chains_dynamic, needed_dynamic); 494 494 } 495 + 496 + /* Disable SMPS for the monitor interface */ 497 + sdata = rcu_dereference(local->monitor_sdata); 498 + if (sdata && 499 + rcu_access_pointer(sdata->vif.chanctx_conf) == &chanctx->conf) 500 + rx_chains_dynamic = rx_chains_static = local->rx_chains; 501 + 495 502 rcu_read_unlock(); 496 503 497 504 if (!local->use_chanctx) {
+3 -1
net/mac80211/main.c
··· 148 148 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 149 149 if (!rcu_access_pointer(sdata->vif.chanctx_conf)) 150 150 continue; 151 + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 152 + continue; 151 153 power = min(power, sdata->vif.bss_conf.txpower); 152 154 } 153 155 rcu_read_unlock(); ··· 201 199 { 202 200 struct ieee80211_local *local = sdata->local; 203 201 204 - if (!changed) 202 + if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 205 203 return; 206 204 207 205 drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
+1
net/mac80211/offchannel.c
··· 355 355 struct ieee80211_roc_work *dep; 356 356 357 357 /* start this ROC */ 358 + ieee80211_offchannel_stop_vifs(local); 358 359 359 360 /* switch channel etc */ 360 361 ieee80211_recalc_idle(local);
+1
net/mac80211/status.c
··· 618 618 sta, true, acked); 619 619 620 620 if ((local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) && 621 + (ieee80211_is_data(hdr->frame_control)) && 621 622 (rates_idx != -1)) 622 623 sta->last_tx_rate = info->status.rates[rates_idx]; 623 624
+6 -11
net/sctp/auth.c
··· 386 386 */ 387 387 int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp) 388 388 { 389 - struct net *net = sock_net(asoc->base.sk); 390 389 struct sctp_auth_bytes *secret; 391 390 struct sctp_shared_key *ep_key; 392 391 393 392 /* If we don't support AUTH, or peer is not capable 394 393 * we don't need to do anything. 395 394 */ 396 - if (!net->sctp.auth_enable || !asoc->peer.auth_capable) 395 + if (!asoc->ep->auth_enable || !asoc->peer.auth_capable) 397 396 return 0; 398 397 399 398 /* If the key_id is non-zero and we couldn't find an ··· 439 440 */ 440 441 int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp) 441 442 { 442 - struct net *net = sock_net(ep->base.sk); 443 443 struct crypto_hash *tfm = NULL; 444 444 __u16 id; 445 445 446 - /* if the transforms are already allocted, we are done */ 447 - if (!net->sctp.auth_enable) { 446 + /* If AUTH extension is disabled, we are done */ 447 + if (!ep->auth_enable) { 448 448 ep->auth_hmacs = NULL; 449 449 return 0; 450 450 } 451 451 452 + /* If the transforms are already allocated, we are done */ 452 453 if (ep->auth_hmacs) 453 454 return 0; 454 455 ··· 664 665 /* Check if peer requested that this chunk is authenticated */ 665 666 int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) 666 667 { 667 - struct net *net; 668 668 if (!asoc) 669 669 return 0; 670 670 671 - net = sock_net(asoc->base.sk); 672 - if (!net->sctp.auth_enable || !asoc->peer.auth_capable) 671 + if (!asoc->ep->auth_enable || !asoc->peer.auth_capable) 673 672 return 0; 674 673 675 674 return __sctp_auth_cid(chunk, asoc->peer.peer_chunks); ··· 676 679 /* Check if we requested that peer authenticate this chunk. */ 677 680 int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc) 678 681 { 679 - struct net *net; 680 682 if (!asoc) 681 683 return 0; 682 684 683 - net = sock_net(asoc->base.sk); 684 - if (!net->sctp.auth_enable) 685 + if (!asoc->ep->auth_enable) 685 686 return 0; 686 687 687 688 return __sctp_auth_cid(chunk,
+2 -1
net/sctp/endpointola.c
··· 68 68 if (!ep->digest) 69 69 return NULL; 70 70 71 - if (net->sctp.auth_enable) { 71 + ep->auth_enable = net->sctp.auth_enable; 72 + if (ep->auth_enable) { 72 73 /* Allocate space for HMACS and CHUNKS authentication 73 74 * variables. There are arrays that we encode directly 74 75 * into parameters to make the rest of the operations easier.
+17 -15
net/sctp/sm_make_chunk.c
··· 219 219 gfp_t gfp, int vparam_len) 220 220 { 221 221 struct net *net = sock_net(asoc->base.sk); 222 + struct sctp_endpoint *ep = asoc->ep; 222 223 sctp_inithdr_t init; 223 224 union sctp_params addrs; 224 225 size_t chunksize; ··· 279 278 chunksize += vparam_len; 280 279 281 280 /* Account for AUTH related parameters */ 282 - if (net->sctp.auth_enable) { 281 + if (ep->auth_enable) { 283 282 /* Add random parameter length*/ 284 283 chunksize += sizeof(asoc->c.auth_random); 285 284 ··· 364 363 } 365 364 366 365 /* Add SCTP-AUTH chunks to the parameter list */ 367 - if (net->sctp.auth_enable) { 366 + if (ep->auth_enable) { 368 367 sctp_addto_chunk(retval, sizeof(asoc->c.auth_random), 369 368 asoc->c.auth_random); 370 369 if (auth_hmacs) ··· 2011 2010 /* if the peer reports AUTH, assume that he 2012 2011 * supports AUTH. 2013 2012 */ 2014 - if (net->sctp.auth_enable) 2013 + if (asoc->ep->auth_enable) 2015 2014 asoc->peer.auth_capable = 1; 2016 2015 break; 2017 2016 case SCTP_CID_ASCONF: ··· 2103 2102 * SCTP_IERROR_NO_ERROR - continue with the chunk 2104 2103 */ 2105 2104 static sctp_ierror_t sctp_verify_param(struct net *net, 2105 + const struct sctp_endpoint *ep, 2106 2106 const struct sctp_association *asoc, 2107 2107 union sctp_params param, 2108 2108 sctp_cid_t cid, ··· 2154 2152 goto fallthrough; 2155 2153 2156 2154 case SCTP_PARAM_RANDOM: 2157 - if (!net->sctp.auth_enable) 2155 + if (!ep->auth_enable) 2158 2156 goto fallthrough; 2159 2157 2160 2158 /* SCTP-AUTH: Secion 6.1 ··· 2171 2169 break; 2172 2170 2173 2171 case SCTP_PARAM_CHUNKS: 2174 - if (!net->sctp.auth_enable) 2172 + if (!ep->auth_enable) 2175 2173 goto fallthrough; 2176 2174 2177 2175 /* SCTP-AUTH: Section 3.2 ··· 2187 2185 break; 2188 2186 2189 2187 case SCTP_PARAM_HMAC_ALGO: 2190 - if (!net->sctp.auth_enable) 2188 + if (!ep->auth_enable) 2191 2189 goto fallthrough; 2192 2190 2193 2191 hmacs = (struct sctp_hmac_algo_param *)param.p; ··· 2222 2220 } 2223 2221 2224 2222 /* Verify the INIT packet before we process it. */ 2225 - int sctp_verify_init(struct net *net, const struct sctp_association *asoc, 2226 - sctp_cid_t cid, 2227 - sctp_init_chunk_t *peer_init, 2228 - struct sctp_chunk *chunk, 2223 + int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep, 2224 + const struct sctp_association *asoc, sctp_cid_t cid, 2225 + sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, 2229 2226 struct sctp_chunk **errp) 2230 2227 { 2231 2228 union sctp_params param; ··· 2265 2264 2266 2265 /* Verify all the variable length parameters */ 2267 2266 sctp_walk_params(param, peer_init, init_hdr.params) { 2268 - 2269 - result = sctp_verify_param(net, asoc, param, cid, chunk, errp); 2267 + result = sctp_verify_param(net, ep, asoc, param, cid, 2268 + chunk, errp); 2270 2269 switch (result) { 2271 2270 case SCTP_IERROR_ABORT: 2272 2271 case SCTP_IERROR_NOMEM: ··· 2498 2497 struct sctp_af *af; 2499 2498 union sctp_addr_param *addr_param; 2500 2499 struct sctp_transport *t; 2500 + struct sctp_endpoint *ep = asoc->ep; 2501 2501 2502 2502 /* We maintain all INIT parameters in network byte order all the 2503 2503 * time. This allows us to not worry about whether the parameters ··· 2638 2636 goto fall_through; 2639 2637 2640 2638 case SCTP_PARAM_RANDOM: 2641 - if (!net->sctp.auth_enable) 2639 + if (!ep->auth_enable) 2642 2640 goto fall_through; 2643 2641 2644 2642 /* Save peer's random parameter */ ··· 2651 2649 break; 2652 2650 2653 2651 case SCTP_PARAM_HMAC_ALGO: 2654 - if (!net->sctp.auth_enable) 2652 + if (!ep->auth_enable) 2655 2653 goto fall_through; 2656 2654 2657 2655 /* Save peer's HMAC list */ ··· 2667 2665 break; 2668 2666 2669 2667 case SCTP_PARAM_CHUNKS: 2670 - if (!net->sctp.auth_enable) 2668 + if (!ep->auth_enable) 2671 2669 goto fall_through; 2672 2670 2673 2671 asoc->peer.peer_chunks = kmemdup(param.p,
+3 -3
net/sctp/sm_statefuns.c
··· 357 357 358 358 /* Verify the INIT chunk before processing it. */ 359 359 err_chunk = NULL; 360 - if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, 360 + if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, 361 361 (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, 362 362 &err_chunk)) { 363 363 /* This chunk contains fatal error. It is to be discarded. ··· 524 524 525 525 /* Verify the INIT chunk before processing it. */ 526 526 err_chunk = NULL; 527 - if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, 527 + if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, 528 528 (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, 529 529 &err_chunk)) { 530 530 ··· 1430 1430 1431 1431 /* Verify the INIT chunk before processing it. */ 1432 1432 err_chunk = NULL; 1433 - if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, 1433 + if (!sctp_verify_init(net, ep, asoc, chunk->chunk_hdr->type, 1434 1434 (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, 1435 1435 &err_chunk)) { 1436 1436 /* This chunk contains fatal error. It is to be discarded.
+26 -28
net/sctp/socket.c
··· 3321 3321 char __user *optval, 3322 3322 unsigned int optlen) 3323 3323 { 3324 - struct net *net = sock_net(sk); 3324 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 3325 3325 struct sctp_authchunk val; 3326 3326 3327 - if (!net->sctp.auth_enable) 3327 + if (!ep->auth_enable) 3328 3328 return -EACCES; 3329 3329 3330 3330 if (optlen != sizeof(struct sctp_authchunk)) ··· 3341 3341 } 3342 3342 3343 3343 /* add this chunk id to the endpoint */ 3344 - return sctp_auth_ep_add_chunkid(sctp_sk(sk)->ep, val.sauth_chunk); 3344 + return sctp_auth_ep_add_chunkid(ep, val.sauth_chunk); 3345 3345 } 3346 3346 3347 3347 /* ··· 3354 3354 char __user *optval, 3355 3355 unsigned int optlen) 3356 3356 { 3357 - struct net *net = sock_net(sk); 3357 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 3358 3358 struct sctp_hmacalgo *hmacs; 3359 3359 u32 idents; 3360 3360 int err; 3361 3361 3362 - if (!net->sctp.auth_enable) 3362 + if (!ep->auth_enable) 3363 3363 return -EACCES; 3364 3364 3365 3365 if (optlen < sizeof(struct sctp_hmacalgo)) ··· 3376 3376 goto out; 3377 3377 } 3378 3378 3379 - err = sctp_auth_ep_set_hmacs(sctp_sk(sk)->ep, hmacs); 3379 + err = sctp_auth_ep_set_hmacs(ep, hmacs); 3380 3380 out: 3381 3381 kfree(hmacs); 3382 3382 return err; ··· 3392 3392 char __user *optval, 3393 3393 unsigned int optlen) 3394 3394 { 3395 - struct net *net = sock_net(sk); 3395 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 3396 3396 struct sctp_authkey *authkey; 3397 3397 struct sctp_association *asoc; 3398 3398 int ret; 3399 3399 3400 - if (!net->sctp.auth_enable) 3400 + if (!ep->auth_enable) 3401 3401 return -EACCES; 3402 3402 3403 3403 if (optlen <= sizeof(struct sctp_authkey)) ··· 3418 3418 goto out; 3419 3419 } 3420 3420 3421 - ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey); 3421 + ret = sctp_auth_set_key(ep, asoc, authkey); 3422 3422 out: 3423 3423 kzfree(authkey); 3424 3424 return ret; ··· 3434 3434 char __user *optval, 3435 3435 unsigned int optlen) 3436 3436 { 3437 - struct net *net = sock_net(sk); 3437 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 3438 3438 struct sctp_authkeyid val; 3439 3439 struct sctp_association *asoc; 3440 3440 3441 - if (!net->sctp.auth_enable) 3441 + if (!ep->auth_enable) 3442 3442 return -EACCES; 3443 3443 3444 3444 if (optlen != sizeof(struct sctp_authkeyid)) ··· 3450 3450 if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) 3451 3451 return -EINVAL; 3452 3452 3453 - return sctp_auth_set_active_key(sctp_sk(sk)->ep, asoc, 3454 - val.scact_keynumber); 3453 + return sctp_auth_set_active_key(ep, asoc, val.scact_keynumber); 3455 3454 } 3456 3455 3457 3456 /* ··· 3462 3463 char __user *optval, 3463 3464 unsigned int optlen) 3464 3465 { 3465 - struct net *net = sock_net(sk); 3466 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 3466 3467 struct sctp_authkeyid val; 3467 3468 struct sctp_association *asoc; 3468 3469 3469 - if (!net->sctp.auth_enable) 3470 + if (!ep->auth_enable) 3470 3471 return -EACCES; 3471 3472 3472 3473 if (optlen != sizeof(struct sctp_authkeyid)) ··· 3478 3479 if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP)) 3479 3480 return -EINVAL; 3480 3481 3481 - return sctp_auth_del_key_id(sctp_sk(sk)->ep, asoc, 3482 - val.scact_keynumber); 3482 + return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber); 3483 3483 3484 3484 } 3485 3485 ··· 5385 5387 static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, 5386 5388 char __user *optval, int __user *optlen) 5387 5389 { 5388 - struct net *net = sock_net(sk); 5390 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 5389 5391 struct sctp_hmacalgo __user *p = (void __user *)optval; 5390 5392 struct sctp_hmac_algo_param *hmacs; 5391 5393 __u16 data_len = 0; 5392 5394 u32 num_idents; 5393 5395 5394 - if (!net->sctp.auth_enable) 5396 + if (!ep->auth_enable) 5395 5397 return -EACCES; 5396 5398 5397 - hmacs = sctp_sk(sk)->ep->auth_hmacs_list; 5399 + hmacs = ep->auth_hmacs_list; 5398 5400 data_len = ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t); 5399 5401 5400 5402 if (len < sizeof(struct sctp_hmacalgo) + data_len) ··· 5415 5417 static int sctp_getsockopt_active_key(struct sock *sk, int len, 5416 5418 char __user *optval, int __user *optlen) 5417 5419 { 5418 - struct net *net = sock_net(sk); 5420 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 5419 5421 struct sctp_authkeyid val; 5420 5422 struct sctp_association *asoc; 5421 5423 5422 - if (!net->sctp.auth_enable) 5424 + if (!ep->auth_enable) 5423 5425 return -EACCES; 5424 5426 5425 5427 if (len < sizeof(struct sctp_authkeyid)) ··· 5434 5436 if (asoc) 5435 5437 val.scact_keynumber = asoc->active_key_id; 5436 5438 else 5437 - val.scact_keynumber = sctp_sk(sk)->ep->active_key_id; 5439 + val.scact_keynumber = ep->active_key_id; 5438 5440 5439 5441 len = sizeof(struct sctp_authkeyid); 5440 5442 if (put_user(len, optlen)) ··· 5448 5450 static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, 5449 5451 char __user *optval, int __user *optlen) 5450 5452 { 5451 - struct net *net = sock_net(sk); 5453 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 5452 5454 struct sctp_authchunks __user *p = (void __user *)optval; 5453 5455 struct sctp_authchunks val; 5454 5456 struct sctp_association *asoc; ··· 5456 5458 u32 num_chunks = 0; 5457 5459 char __user *to; 5458 5460 5459 - if (!net->sctp.auth_enable) 5461 + if (!ep->auth_enable) 5460 5462 return -EACCES; 5461 5463 5462 5464 if (len < sizeof(struct sctp_authchunks)) ··· 5493 5495 static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, 5494 5496 char __user *optval, int __user *optlen) 5495 5497 { 5496 - struct net *net = sock_net(sk); 5498 + struct sctp_endpoint *ep = sctp_sk(sk)->ep; 5497 5499 struct sctp_authchunks __user *p = (void __user *)optval; 5498 5500 struct sctp_authchunks val; 5499 5501 struct sctp_association *asoc; ··· 5501 5503 u32 num_chunks = 0; 5502 5504 char __user *to; 5503 5505 5504 - if (!net->sctp.auth_enable) 5506 + if (!ep->auth_enable) 5505 5507 return -EACCES; 5506 5508 5507 5509 if (len < sizeof(struct sctp_authchunks)) ··· 5518 5520 if (asoc) 5519 5521 ch = (struct sctp_chunks_param *)asoc->c.auth_chunks; 5520 5522 else 5521 - ch = sctp_sk(sk)->ep->auth_chunk_list; 5523 + ch = ep->auth_chunk_list; 5522 5524 5523 5525 if (!ch) 5524 5526 goto num;
+35 -1
net/sctp/sysctl.c
··· 64 64 static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, 65 65 void __user *buffer, size_t *lenp, 66 66 loff_t *ppos); 67 + static int proc_sctp_do_auth(struct ctl_table *ctl, int write, 68 + void __user *buffer, size_t *lenp, 69 + loff_t *ppos); 67 70 68 71 static struct ctl_table sctp_table[] = { 69 72 { ··· 269 266 .data = &init_net.sctp.auth_enable, 270 267 .maxlen = sizeof(int), 271 268 .mode = 0644, 272 - .proc_handler = proc_dointvec, 269 + .proc_handler = proc_sctp_do_auth, 273 270 }, 274 271 { 275 272 .procname = "addr_scope_policy", ··· 400 397 return -EINVAL; 401 398 net->sctp.rto_max = new_value; 402 399 } 400 + return ret; 401 + } 402 + 403 + static int proc_sctp_do_auth(struct ctl_table *ctl, int write, 404 + void __user *buffer, size_t *lenp, 405 + loff_t *ppos) 406 + { 407 + struct net *net = current->nsproxy->net_ns; 408 + struct ctl_table tbl; 409 + int new_value, ret; 410 + 411 + memset(&tbl, 0, sizeof(struct ctl_table)); 412 + tbl.maxlen = sizeof(unsigned int); 413 + 414 + if (write) 415 + tbl.data = &new_value; 416 + else 417 + tbl.data = &net->sctp.auth_enable; 418 + 419 + ret = proc_dointvec(&tbl, write, buffer, lenp, ppos); 420 + 421 + if (write) { 422 + struct sock *sk = net->sctp.ctl_sock; 423 + 424 + net->sctp.auth_enable = new_value; 425 + /* Update the value in the control socket */ 426 + lock_sock(sk); 427 + sctp_sk(sk)->ep->auth_enable = new_value; 428 + release_sock(sk); 429 + } 430 + 403 431 return ret; 404 432 } 405 433
+2 -2
net/socket.c
··· 1880 1880 * Receive a datagram from a socket. 1881 1881 */ 1882 1882 1883 - asmlinkage long sys_recv(int fd, void __user *ubuf, size_t size, 1884 - unsigned int flags) 1883 + SYSCALL_DEFINE4(recv, int, fd, void __user *, ubuf, size_t, size, 1884 + unsigned int, flags) 1885 1885 { 1886 1886 return sys_recvfrom(fd, ubuf, size, flags, NULL, NULL); 1887 1887 }