History

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 ...

Linus Torvalds committed 12 years ago

Commit ebfc45e2 parents 6e66d5d b14878c60 files · +659 −339Browse files

Unified · Split

60 files
  1. Documentation/devicetree/bindings/net/ethernet.txt +1 −1
  2. drivers/isdn/icn/icn.c +5 −6
  3. drivers/net/ethernet/broadcom/tg3.c +3 −1
  4. drivers/net/ethernet/marvell/mvneta.c +34 −39
  5. drivers/net/ethernet/mellanox/mlx4/en_cq.c +0 −1
  6. drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 −5
  7. drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +0 −1
  8. drivers/net/ethernet/sfc/ef10.c +11 −1
  9. drivers/net/ethernet/sfc/efx.c +16 −3
  10. drivers/net/ethernet/sfc/enum.h +16 −7
  11. drivers/net/ethernet/sfc/falcon.c +4 −0
  12. drivers/net/ethernet/sfc/farch.c +22 −0
  13. drivers/net/ethernet/sfc/mcdi.c +44 −11
  14. drivers/net/ethernet/sfc/mcdi.h +13 −0
  15. drivers/net/ethernet/sfc/net_driver.h +4 −0
  16. drivers/net/ethernet/sfc/nic.h +1 −0
  17. drivers/net/ethernet/sfc/siena.c +2 −0
  18. drivers/net/phy/mdio-gpio.c +47 −21
  19. drivers/net/wireless/cw1200/debug.c +2 −0
  20. drivers/net/wireless/iwlwifi/iwl-7000.c +3 −2
  21. drivers/net/wireless/iwlwifi/mvm/coex.c +11 −7
  22. drivers/net/wireless/iwlwifi/mvm/mac80211.c +1 −0
  23. drivers/net/wireless/iwlwifi/mvm/rs.c +165 −96
  24. drivers/net/wireless/iwlwifi/mvm/rs.h +11 −3
  25. drivers/net/wireless/iwlwifi/mvm/sf.c +2 −1
  26. drivers/net/wireless/iwlwifi/pcie/drv.c +2 −0
  27. drivers/net/wireless/mwifiex/main.c +6 −6
  28. drivers/net/wireless/mwifiex/sta_ioctl.c +4 −3
  29. drivers/net/wireless/rsi/rsi_91x_core.c +1 −1
  30. drivers/net/wireless/rsi/rsi_91x_mgmt.c +11 −10
  31. drivers/net/wireless/ti/wl18xx/event.h +20 −0
  32. drivers/net/wireless/ti/wlcore/event.c +5 −0
  33. include/linux/mdio-gpio.h +5 −0
  34. include/linux/phy.h +3 −0
  35. include/net/flow.h +9 −1
  36. include/net/net_namespace.h +1 −8
  37. include/net/sctp/structs.h +3 −1
  38. kernel/seccomp.c +2 −0
  39. net/8021q/vlan_dev.c +41 −5
  40. net/core/dev.c +1 −0
  41. net/ipv4/fib_frontend.c +1 −1
  42. net/ipv4/fib_semantics.c +1 −0
  43. net/ipv4/ip_tunnel.c +7 −8
  44. net/ipv4/ipmr.c +1 −1
  45. net/ipv4/netfilter/ipt_rpfilter.c +1 −4
  46. net/ipv4/route.c +1 −2
  47. net/ipv6/ip6_tunnel.c +4 −4
  48. net/ipv6/ip6mr.c +1 −1
  49. net/ipv6/sit.c +4 −13
  50. net/mac80211/chan.c +9 −2
  51. net/mac80211/main.c +3 −1
  52. net/mac80211/offchannel.c +1 −0
  53. net/mac80211/status.c +1 −0
  54. net/sctp/auth.c +6 −11
  55. net/sctp/endpointola.c +2 −1
  56. net/sctp/sm_make_chunk.c +17 −15
  57. net/sctp/sm_statefuns.c +3 −3
  58. net/sctp/socket.c +26 −28
  59. net/sctp/sysctl.c +35 −1
  60. net/socket.c +2 −2
Documentation/devicetree/bindings/net/ethernet.txt+1−1
@@ -10,7 +10,7 @@ The following properties are common to the Ethernet controllers: · 9 unmodified lines
1010 - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than
1111 the maximum frame size (there's contradiction in ePAPR).
1212 - 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",
1414 "rgmii-rxid", "rgmii-txid", "rtbi", "smii", "xgmii"; this is now a de-facto
1515 standard property;
1616 - phy-connection-type: the same as "phy-mode" property but described in ePAPR;
drivers/isdn/icn/icn.c+5−6
@@ -1155,7 +1155,7 @@ icn_command(isdn_ctrl *c, icn_card *card) · 1154 unmodified lines
11551155 ulong a;
11561156 ulong flags;
11571157 int i;
1158− char cbuf[60];
1158+ char cbuf[80];
11591159 isdn_ctrl cmd;
11601160 icn_cdef cdef;
11611161 char __user *arg;
@@ -1309,7 +1309,6 @@ icn_command(isdn_ctrl *c, icn_card *card) · 147 unmodified lines
13091309 break;
13101310 if ((c->arg & 255) < ICN_BCH) {
13111311 char *p;
1312− char dial[50];
13131312 char dcode[4];
13141313
13151314 a = c->arg;
@@ -1321,10 +1320,10 @@ icn_command(isdn_ctrl *c, icn_card *card) · 5 unmodified lines
13211320 } else
13221321 /* Normal Dial */
13231322 strcpy(dcode, "CAL");
1324− strcpy(dial, p);
1325− sprintf(cbuf, "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
1326− dcode, dial, c->parm.setup.si1,
1327− c->parm.setup.si2, c->parm.setup.eazmsn);
1323+ snprintf(cbuf, sizeof(cbuf),
1324+ "%02d;D%s_R%s,%02d,%02d,%s\n", (int) (a + 1),
1325+ dcode, p, c->parm.setup.si1,
1326+ c->parm.setup.si2, c->parm.setup.eazmsn);
13281327 i = icn_writecmd(cbuf, strlen(cbuf), 0, card);
13291328 }
13301329 break;
drivers/net/ethernet/broadcom/tg3.c+3−1
@@ -12286,7 +12286,9 @@ static int tg3_set_ringparam(struct net_device *dev, struct ethtool_ringparam *e · 12285 unmodified lines
1228612286 if (tg3_flag(tp, MAX_RXPEND_64) &&
1228712287 tp->rx_pending > 63)
1228812288 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;
1229012292
1229112293 for (i = 0; i < tp->irq_max; i++)
1229212294 tp->napi[i].tx_pending = ering->tx_pending;
drivers/net/ethernet/marvell/mvneta.c+34−39
@@ -89,8 +89,9 @@ · 88 unmodified lines
8989 #define MVNETA_TX_IN_PRGRS BIT(1)
9090 #define MVNETA_TX_FIFO_EMPTY BIT(8)
9191 #define MVNETA_RX_MIN_FRAME_SIZE 0x247c
92−#define MVNETA_SGMII_SERDES_CFG 0x24A0
92+#define MVNETA_SERDES_CFG 0x24A0
9393 #define MVNETA_SGMII_SERDES_PROTO 0x0cc7
94+#define MVNETA_QSGMII_SERDES_PROTO 0x0667
9495 #define MVNETA_TYPE_PRIO 0x24bc
9596 #define MVNETA_FORCE_UNI BIT(21)
9697 #define MVNETA_TXQ_CMD_1 0x24e4
@@ -711,35 +712,6 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp, · 614 unmodified lines
711712 mvreg_write(pp, MVNETA_RXQ_CONFIG_REG(rxq->id), val);
712713 }
713714
714−
715−
716−/* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */
717−static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)
718−{
719− u32 val;
720−
721− val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
722−
723− if (enable)
724− val |= MVNETA_GMAC2_PORT_RGMII;
725− else
726− val &= ~MVNETA_GMAC2_PORT_RGMII;
727−
728− mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
729−}
730−
731−/* Config SGMII port */
732−static void mvneta_port_sgmii_config(struct mvneta_port *pp)
733−{
734− u32 val;
735−
736− val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
737− val |= MVNETA_GMAC2_PCS_ENABLE;
738− mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
739−
740− mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
741−}
742−
743715 /* Start the Ethernet port RX and TX activity */
744716 static void mvneta_port_up(struct mvneta_port *pp)
745717 {
@@ -2749,26 +2721,44 @@ static void mvneta_conf_mbus_windows(struct mvneta_port *pp, · 2003 unmodified lines
27492721 }
27502722
27512723 /* Power up the port */
2752−static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
2724+static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
27532725 {
2754− u32 val;
2726+ u32 ctrl;
27552727
27562728 /* MAC Cause register should be cleared */
27572729 mvreg_write(pp, MVNETA_UNIT_INTR_CAUSE, 0);
27582730
2759− if (phy_mode == PHY_INTERFACE_MODE_SGMII)
2760− mvneta_port_sgmii_config(pp);
2731+ ctrl = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
27612732
2762− mvneta_gmac_rgmii_set(pp, 1);
2733+ /* Even though it might look weird, when we're configured in
2734+ * SGMII or QSGMII mode, the RGMII bit needs to be set.
2735+ */
2736+ switch(phy_mode) {
2737+ case PHY_INTERFACE_MODE_QSGMII:
2738+ mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_QSGMII_SERDES_PROTO);
2739+ ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII;
2740+ break;
2741+ case PHY_INTERFACE_MODE_SGMII:
2742+ mvreg_write(pp, MVNETA_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO);
2743+ ctrl |= MVNETA_GMAC2_PCS_ENABLE | MVNETA_GMAC2_PORT_RGMII;
2744+ break;
2745+ case PHY_INTERFACE_MODE_RGMII:
2746+ case PHY_INTERFACE_MODE_RGMII_ID:
2747+ ctrl |= MVNETA_GMAC2_PORT_RGMII;
2748+ break;
2749+ default:
2750+ return -EINVAL;
2751+ }
27632752
27642753 /* Cancel Port Reset */
2765− val = mvreg_read(pp, MVNETA_GMAC_CTRL_2);
2766− val &= ~MVNETA_GMAC2_PORT_RESET;
2767− mvreg_write(pp, MVNETA_GMAC_CTRL_2, val);
2754+ ctrl &= ~MVNETA_GMAC2_PORT_RESET;
2755+ mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl);
27682756
27692757 while ((mvreg_read(pp, MVNETA_GMAC_CTRL_2) &
27702758 MVNETA_GMAC2_PORT_RESET) != 0)
27712759 continue;
2760+
2761+ return 0;
27722762 }
27732763
27742764 /* Device initialization routine */
@@ -2879,7 +2869,12 @@ static int mvneta_probe(struct platform_device *pdev) · 104 unmodified lines
28792869 dev_err(&pdev->dev, "can't init eth hal\n");
28802870 goto err_free_stats;
28812871 }
2882− mvneta_port_power_up(pp, phy_mode);
2872+
2873+ err = mvneta_port_power_up(pp, phy_mode);
2874+ if (err < 0) {
2875+ dev_err(&pdev->dev, "can't power up port\n");
2876+ goto err_deinit;
2877+ }
28832878
28842879 dram_target_info = mv_mbus_dram_info();
28852880 if (dram_target_info)
drivers/net/ethernet/mellanox/mlx4/en_cq.c+0−1
@@ -66,7 +66,6 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv, · 65 unmodified lines
6666
6767 cq->ring = ring;
6868 cq->is_tx = mode;
69− spin_lock_init(&cq->lock);
7069
7170 /* Allocate HW buffers on provided NUMA node.
7271 * dev->numa_node is used in mtt range allocation flow.
drivers/net/ethernet/mellanox/mlx4/en_netdev.c+1−5
@@ -1304,15 +1304,11 @@ static void mlx4_en_netpoll(struct net_device *dev) · 1303 unmodified lines
13041304 {
13051305 struct mlx4_en_priv *priv = netdev_priv(dev);
13061306 struct mlx4_en_cq *cq;
1307− unsigned long flags;
13081307 int i;
13091308
13101309 for (i = 0; i < priv->rx_ring_num; i++) {
13111310 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);
13161312 }
13171313 }
13181314 #endif
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h+0−1
@@ -319,7 +319,6 @@ struct mlx4_en_cq { · 318 unmodified lines
319319 struct mlx4_cq mcq;
320320 struct mlx4_hwq_resources wqres;
321321 int ring;
322− spinlock_t lock;
323322 struct net_device *dev;
324323 struct napi_struct napi;
325324 int size;
drivers/net/ethernet/sfc/ef10.c+11−1
@@ -738,8 +738,11 @@ static int efx_ef10_reset(struct efx_nic *efx, enum reset_type reset_type) · 737 unmodified lines
738738 /* If it was a port reset, trigger reallocation of MC resources.
739739 * Note that on an MC reset nothing needs to be done now because we'll
740740 * 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.
741743 */
742− if (reset_type == RESET_TYPE_ALL && !rc)
744+ if ((reset_type == RESET_TYPE_ALL ||
745+ reset_type == RESET_TYPE_MCDI_TIMEOUT) && !rc)
743746 efx_ef10_reset_mc_allocations(efx);
744747 return rc;
745748 }
@@ -2141,6 +2144,11 @@ static int efx_ef10_fini_dmaq(struct efx_nic *efx) · 1395 unmodified lines
21412144 return 0;
21422145 }
21432146
2147+static void efx_ef10_prepare_flr(struct efx_nic *efx)
2148+{
2149+ atomic_set(&efx->active_queues, 0);
2150+}
2151+
21442152 static bool efx_ef10_filter_equal(const struct efx_filter_spec *left,
21452153 const struct efx_filter_spec *right)
21462154 {
@@ -3603,6 +3611,8 @@ const struct efx_nic_type efx_hunt_a0_nic_type = { · 1456 unmodified lines
36033611 .probe_port = efx_mcdi_port_probe,
36043612 .remove_port = efx_mcdi_port_remove,
36053613 .fini_dmaq = efx_ef10_fini_dmaq,
3614+ .prepare_flr = efx_ef10_prepare_flr,
3615+ .finish_flr = efx_port_dummy_op_void,
36063616 .describe_stats = efx_ef10_describe_stats,
36073617 .update_stats = efx_ef10_update_stats,
36083618 .start_stats = efx_mcdi_mac_start_stats,
drivers/net/ethernet/sfc/efx.c+16−3
@@ -76,6 +76,7 @@ const char *const efx_reset_type_names[] = { · 75 unmodified lines
7676 [RESET_TYPE_RECOVER_OR_ALL] = "RECOVER_OR_ALL",
7777 [RESET_TYPE_WORLD] = "WORLD",
7878 [RESET_TYPE_RECOVER_OR_DISABLE] = "RECOVER_OR_DISABLE",
79+ [RESET_TYPE_MC_BIST] = "MC_BIST",
7980 [RESET_TYPE_DISABLE] = "DISABLE",
8081 [RESET_TYPE_TX_WATCHDOG] = "TX_WATCHDOG",
8182 [RESET_TYPE_INT_ERROR] = "INT_ERROR",
@@ -83,7 +84,7 @@ const char *const efx_reset_type_names[] = { · 1 unmodified line
8384 [RESET_TYPE_DMA_ERROR] = "DMA_ERROR",
8485 [RESET_TYPE_TX_SKIP] = "TX_SKIP",
8586 [RESET_TYPE_MC_FAILURE] = "MC_FAILURE",
86− [RESET_TYPE_MC_BIST] = "MC_BIST",
87+ [RESET_TYPE_MCDI_TIMEOUT] = "MCDI_TIMEOUT (FLR)",
8788 };
8889
8990 /* Reset workqueue. If any NIC has a hardware failure then a reset will be
@@ -1739,7 +1740,8 @@ static void efx_start_all(struct efx_nic *efx) · 1649 unmodified lines
17391740
17401741 /* Check that it is appropriate to restart the interface. All
17411742 * of these flags are safe to read under just the rtnl lock */
1742− if (efx->port_enabled || !netif_running(efx->net_dev))
1743+ if (efx->port_enabled || !netif_running(efx->net_dev) ||
1744+ efx->reset_pending)
17431745 return;
17441746
17451747 efx_start_port(efx);
@@ -2334,6 +2336,9 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method) · 588 unmodified lines
23342336 {
23352337 EFX_ASSERT_RESET_SERIALISED(efx);
23362338
2339+ if (method == RESET_TYPE_MCDI_TIMEOUT)
2340+ efx->type->prepare_flr(efx);
2341+
23372342 efx_stop_all(efx);
23382343 efx_disable_interrupts(efx);
23392344
@@ -2354,6 +2359,10 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) · 14 unmodified lines
23542359
23552360 EFX_ASSERT_RESET_SERIALISED(efx);
23562361
2362+ if (method == RESET_TYPE_MCDI_TIMEOUT)
2363+ efx->type->finish_flr(efx);
2364+
2365+ /* Ensure that SRAM is initialised even if we're disabling the device */
23572366 rc = efx->type->init(efx);
23582367 if (rc) {
23592368 netif_err(efx, drv, efx->net_dev, "failed to initialise NIC\n");
@@ -2417,7 +2426,10 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) · 57 unmodified lines
24172426 /* Clear flags for the scopes we covered. We assume the NIC and
24182427 * driver are now quiescent so that there is no race here.
24192428 */
2420− efx->reset_pending &= -(1 << (method + 1));
2429+ if (method < RESET_TYPE_MAX_METHOD)
2430+ efx->reset_pending &= -(1 << (method + 1));
2431+ else /* it doesn't fit into the well-ordered scope hierarchy */
2432+ __clear_bit(method, &efx->reset_pending);
24212433
24222434 /* Reinitialise bus-mastering, which may have been turned off before
24232435 * the reset was scheduled. This is still appropriate, even in the
@@ -2546,6 +2558,7 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) · 122 unmodified lines
25462558 case RESET_TYPE_DISABLE:
25472559 case RESET_TYPE_RECOVER_OR_DISABLE:
25482560 case RESET_TYPE_MC_BIST:
2561+ case RESET_TYPE_MCDI_TIMEOUT:
25492562 method = type;
25502563 netif_dbg(efx, drv, efx->net_dev, "scheduling %s reset\n",
25512564 RESET_TYPE(method));
drivers/net/ethernet/sfc/enum.h+16−7
@@ -143,6 +143,7 @@ enum efx_loopback_mode { · 142 unmodified lines
143143 * @RESET_TYPE_WORLD: Reset as much as possible
144144 * @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if
145145 * unsuccessful.
146+ * @RESET_TYPE_MC_BIST: MC entering BIST mode.
146147 * @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled
147148 * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog
148149 * @RESET_TYPE_INT_ERROR: reset due to internal error
@@ -150,14 +151,16 @@ enum efx_loopback_mode { · 1 unmodified line
150151 * @RESET_TYPE_DMA_ERROR: DMA error
151152 * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors
152153 * @RESET_TYPE_MC_FAILURE: MC reboot/assertion
154+ * @RESET_TYPE_MCDI_TIMEOUT: MCDI timeout.
153155 */
154156 enum reset_type {
155− RESET_TYPE_INVISIBLE = 0,
156− RESET_TYPE_RECOVER_OR_ALL = 1,
157− RESET_TYPE_ALL = 2,
158− RESET_TYPE_WORLD = 3,
159− RESET_TYPE_RECOVER_OR_DISABLE = 4,
160− RESET_TYPE_DISABLE = 5,
157+ RESET_TYPE_INVISIBLE,
158+ RESET_TYPE_RECOVER_OR_ALL,
159+ RESET_TYPE_ALL,
160+ RESET_TYPE_WORLD,
161+ RESET_TYPE_RECOVER_OR_DISABLE,
162+ RESET_TYPE_MC_BIST,
163+ RESET_TYPE_DISABLE,
161164 RESET_TYPE_MAX_METHOD,
162165 RESET_TYPE_TX_WATCHDOG,
163166 RESET_TYPE_INT_ERROR,
@@ -165,7 +168,13 @@ enum reset_type { · 1 unmodified line
165168 RESET_TYPE_DMA_ERROR,
166169 RESET_TYPE_TX_SKIP,
167170 RESET_TYPE_MC_FAILURE,
168− RESET_TYPE_MC_BIST,
171+ /* RESET_TYPE_MCDI_TIMEOUT is actually a method, not just a reason, but
172+ * it doesn't fit the scope hierarchy (not well-ordered by inclusion).
173+ * We encode this by having its enum value be greater than
174+ * RESET_TYPE_MAX_METHOD. This also prevents issuing it with
175+ * efx_ioctl_reset.
176+ */
177+ RESET_TYPE_MCDI_TIMEOUT,
169178 RESET_TYPE_MAX,
170179 };
171180
drivers/net/ethernet/sfc/falcon.c+4−0
@@ -2696,6 +2696,8 @@ const struct efx_nic_type falcon_a1_nic_type = { · 2695 unmodified lines
26962696 .fini_dmaq = efx_farch_fini_dmaq,
26972697 .prepare_flush = falcon_prepare_flush,
26982698 .finish_flush = efx_port_dummy_op_void,
2699+ .prepare_flr = efx_port_dummy_op_void,
2700+ .finish_flr = efx_farch_finish_flr,
26992701 .describe_stats = falcon_describe_nic_stats,
27002702 .update_stats = falcon_update_nic_stats,
27012703 .start_stats = falcon_start_nic_stats,
@@ -2790,6 +2792,8 @@ const struct efx_nic_type falcon_b0_nic_type = { · 88 unmodified lines
27902792 .fini_dmaq = efx_farch_fini_dmaq,
27912793 .prepare_flush = falcon_prepare_flush,
27922794 .finish_flush = efx_port_dummy_op_void,
2795+ .prepare_flr = efx_port_dummy_op_void,
2796+ .finish_flr = efx_farch_finish_flr,
27932797 .describe_stats = falcon_describe_nic_stats,
27942798 .update_stats = falcon_update_nic_stats,
27952799 .start_stats = falcon_start_nic_stats,
drivers/net/ethernet/sfc/farch.c+22−0
@@ -741,6 +741,28 @@ int efx_farch_fini_dmaq(struct efx_nic *efx) · 740 unmodified lines
741741 return rc;
742742 }
743743
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+
744766 /**************************************************************************
745767 *
746768 * Event queue processing
drivers/net/ethernet/sfc/mcdi.c+44−11
@@ -52,12 +52,7 @@ static void efx_mcdi_timeout_async(unsigned long context); · 51 unmodified lines
5252 static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
5353 bool *was_attached_out);
5454 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);
6156
6257 int efx_mcdi_init(struct efx_nic *efx)
6358 {
@@ -558,6 +553,8 @@ static int _efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen, · 494 unmodified lines
558553 rc = 0;
559554 }
560555
556+ efx_mcdi_abandon(efx);
557+
561558 /* Close the race with efx_mcdi_ev_cpl() executing just too late
562559 * and completing a request we've just cancelled, by ensuring
563560 * that the seqno check therein fails.
@@ -672,6 +669,9 @@ int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd, · 108 unmodified lines
672669 if (efx->mc_bist_for_other_fn)
673670 return -ENETDOWN;
674671
672+ if (mcdi->mode == MCDI_MODE_FAIL)
673+ return -ENETDOWN;
674+
675675 efx_mcdi_acquire_sync(mcdi);
676676 efx_mcdi_send_request(efx, cmd, inbuf, inlen);
677677 return 0;
@@ -812,7 +812,11 @@ void efx_mcdi_mode_poll(struct efx_nic *efx) · 134 unmodified lines
812812 return;
813813
814814 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)
816820 return;
817821
818822 /* We can switch from event completion to polled completion, because
@@ -841,8 +845,8 @@ void efx_mcdi_flush_async(struct efx_nic *efx) · 22 unmodified lines
841845
842846 mcdi = efx_mcdi(efx);
843847
844− /* We must be in polling mode so no more requests can be queued */
845− BUG_ON(mcdi->mode != MCDI_MODE_POLL);
848+ /* We must be in poll or fail mode so no more requests can be queued */
849+ BUG_ON(mcdi->mode == MCDI_MODE_EVENTS);
846850
847851 del_timer_sync(&mcdi->async_timer);
848852
@@ -875,8 +879,11 @@ void efx_mcdi_mode_event(struct efx_nic *efx) · 26 unmodified lines
875879 return;
876880
877881 mcdi = efx_mcdi(efx);
878−
879− if (mcdi->mode == MCDI_MODE_EVENTS)
882+ /* If already in event completion mode, nothing to do.
883+ * If in fail-fast state, don't switch to event completion. FLR
884+ * recovery will do that later.
885+ */
886+ if (mcdi->mode == MCDI_MODE_EVENTS || mcdi->mode == MCDI_MODE_FAIL)
880887 return;
881888
882889 /* We can't switch from polled to event completion in the middle of a
@@ -966,6 +973,19 @@ static void efx_mcdi_ev_bist(struct efx_nic *efx) · 83 unmodified lines
966973 spin_unlock(&mcdi->iface_lock);
967974 }
968975
976+/* MCDI timeouts seen, so make all MCDI calls fail-fast and issue an FLR to try
977+ * to recover.
978+ */
979+static void efx_mcdi_abandon(struct efx_nic *efx)
980+{
981+ struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
982+
983+ if (xchg(&mcdi->mode, MCDI_MODE_FAIL) == MCDI_MODE_FAIL)
984+ return; /* it had already been done */
985+ netif_dbg(efx, hw, efx->net_dev, "MCDI is timing out; trying to recover\n");
986+ efx_schedule_reset(efx, RESET_TYPE_MCDI_TIMEOUT);
987+}
988+
969989 /* Called from falcon_process_eventq for MCDI events */
970990 void efx_mcdi_process_event(struct efx_channel *channel,
971991 efx_qword_t *event)
@@ -1512,6 +1532,19 @@ int efx_mcdi_reset(struct efx_nic *efx, enum reset_type method) · 540 unmodified lines
15121532 {
15131533 int rc;
15141534
1535+ /* If MCDI is down, we can't handle_assertion */
1536+ if (method == RESET_TYPE_MCDI_TIMEOUT) {
1537+ rc = pci_reset_function(efx->pci_dev);
1538+ if (rc)
1539+ return rc;
1540+ /* Re-enable polled MCDI completion */
1541+ if (efx->mcdi) {
1542+ struct efx_mcdi_iface *mcdi = efx_mcdi(efx);
1543+ mcdi->mode = MCDI_MODE_POLL;
1544+ }
1545+ return 0;
1546+ }
1547+
15151548 /* Recover from a failed assertion pre-reset */
15161549 rc = efx_mcdi_handle_assertion(efx);
15171550 if (rc)
drivers/net/ethernet/sfc/mcdi.h+13−0
@@ -28,9 +28,16 @@ enum efx_mcdi_state { · 27 unmodified lines
2828 MCDI_STATE_COMPLETED,
2929 };
3030
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+ */
3137 enum efx_mcdi_mode {
3238 MCDI_MODE_POLL,
3339 MCDI_MODE_EVENTS,
40+ MCDI_MODE_FAIL,
3441 };
3542
3643 /**
@@ -104,6 +111,12 @@ struct efx_mcdi_data { · 67 unmodified lines
104111 u32 fn_flags;
105112 };
106113
114+static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx)
115+{
116+ EFX_BUG_ON_PARANOID(!efx->mcdi);
117+ return &efx->mcdi->iface;
118+}
119+
107120 #ifdef CONFIG_SFC_MCDI_MON
108121 static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx)
109122 {
drivers/net/ethernet/sfc/net_driver.h+4−0
@@ -972,6 +972,8 @@ struct efx_mtd_partition { · 971 unmodified lines
972972 * (for Falcon architecture)
973973 * @finish_flush: Clean up after flushing the DMA queues (for Falcon
974974 * architecture)
975+ * @prepare_flr: Prepare for an FLR
976+ * @finish_flr: Clean up after an FLR
975977 * @describe_stats: Describe statistics for ethtool
976978 * @update_stats: Update statistics not provided by event handling.
977979 * Either argument may be %NULL.
@@ -1100,6 +1102,8 @@ struct efx_nic_type { · 122 unmodified lines
11001102 int (*fini_dmaq)(struct efx_nic *efx);
11011103 void (*prepare_flush)(struct efx_nic *efx);
11021104 void (*finish_flush)(struct efx_nic *efx);
1105+ void (*prepare_flr)(struct efx_nic *efx);
1106+ void (*finish_flr)(struct efx_nic *efx);
11031107 size_t (*describe_stats)(struct efx_nic *efx, u8 *names);
11041108 size_t (*update_stats)(struct efx_nic *efx, u64 *full_stats,
11051109 struct rtnl_link_stats64 *core_stats);
drivers/net/ethernet/sfc/nic.h+1−0
@@ -757,6 +757,7 @@ static inline int efx_nic_irq_test_irq_cpu(struct efx_nic *efx) · 756 unmodified lines
757757 int efx_nic_flush_queues(struct efx_nic *efx);
758758 void siena_prepare_flush(struct efx_nic *efx);
759759 int efx_farch_fini_dmaq(struct efx_nic *efx);
760+void efx_farch_finish_flr(struct efx_nic *efx);
760761 void siena_finish_flush(struct efx_nic *efx);
761762 void falcon_start_nic_stats(struct efx_nic *efx);
762763 void falcon_stop_nic_stats(struct efx_nic *efx);
drivers/net/ethernet/sfc/siena.c+2−0
@@ -921,6 +921,8 @@ const struct efx_nic_type siena_a0_nic_type = { · 920 unmodified lines
921921 .fini_dmaq = efx_farch_fini_dmaq,
922922 .prepare_flush = siena_prepare_flush,
923923 .finish_flush = siena_finish_flush,
924+ .prepare_flr = efx_port_dummy_op_void,
925+ .finish_flr = efx_farch_finish_flr,
924926 .describe_stats = siena_describe_nic_stats,
925927 .update_stats = siena_update_nic_stats,
926928 .start_stats = efx_mcdi_mac_start_stats,
drivers/net/phy/mdio-gpio.c+47−21
@@ -32,29 +32,39 @@ · 31 unmodified lines
3232
3333 struct mdio_gpio_info {
3434 struct mdiobb_ctrl ctrl;
35− int mdc, mdio;
35+ int mdc, mdio, mdo;
36+ int mdc_active_low, mdio_active_low, mdo_active_low;
3637 };
3738
3839 static void *mdio_gpio_of_get_data(struct platform_device *pdev)
3940 {
4041 struct device_node *np = pdev->dev.of_node;
4142 struct mdio_gpio_platform_data *pdata;
43+ enum of_gpio_flags flags;
4244 int ret;
4345
4446 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
4547 if (!pdata)
4648 return NULL;
4749
48− ret = of_get_gpio(np, 0);
50+ ret = of_get_gpio_flags(np, 0, &flags);
4951 if (ret < 0)
5052 return NULL;
5153
5254 pdata->mdc = ret;
55+ pdata->mdc_active_low = flags & OF_GPIO_ACTIVE_LOW;
5356
54− ret = of_get_gpio(np, 1);
57+ ret = of_get_gpio_flags(np, 1, &flags);
5558 if (ret < 0)
5659 return NULL;
5760 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+ }
5868
5969 return pdata;
6070 }
@@ -64,8 +74,19 @@ static void mdio_dir(struct mdiobb_ctrl *ctrl, int dir) · 3 unmodified lines
6474 struct mdio_gpio_info *bitbang =
6575 container_of(ctrl, struct mdio_gpio_info, ctrl);
6676
77+ if (bitbang->mdo) {
78+ /* Separate output pin. Always set its value to high
79+ * when changing direction. If direction is input,
80+ * assume the pin serves as pull-up. If direction is
81+ * output, the default value is high.
82+ */
83+ gpio_set_value(bitbang->mdo, 1 ^ bitbang->mdo_active_low);
84+ return;
85+ }
86+
6787 if (dir)
68− gpio_direction_output(bitbang->mdio, 1);
88+ gpio_direction_output(bitbang->mdio,
89+ 1 ^ bitbang->mdio_active_low);
6990 else
7091 gpio_direction_input(bitbang->mdio);
7192 }
@@ -75,7 +96,7 @@ static int mdio_get(struct mdiobb_ctrl *ctrl) · 3 unmodified lines
7596 struct mdio_gpio_info *bitbang =
7697 container_of(ctrl, struct mdio_gpio_info, ctrl);
7798
78− return gpio_get_value(bitbang->mdio);
99+ return gpio_get_value(bitbang->mdio) ^ bitbang->mdio_active_low;
79100 }
80101
81102 static void mdio_set(struct mdiobb_ctrl *ctrl, int what)
@@ -83,7 +104,10 @@ static void mdio_set(struct mdiobb_ctrl *ctrl, int what) · 1 unmodified line
83104 struct mdio_gpio_info *bitbang =
84105 container_of(ctrl, struct mdio_gpio_info, ctrl);
85106
86− gpio_set_value(bitbang->mdio, what);
107+ if (bitbang->mdo)
108+ gpio_set_value(bitbang->mdo, what ^ bitbang->mdo_active_low);
109+ else
110+ gpio_set_value(bitbang->mdio, what ^ bitbang->mdio_active_low);
87111 }
88112
89113 static void mdc_set(struct mdiobb_ctrl *ctrl, int what)
@@ -91,7 +115,7 @@ static void mdc_set(struct mdiobb_ctrl *ctrl, int what) · 1 unmodified line
91115 struct mdio_gpio_info *bitbang =
92116 container_of(ctrl, struct mdio_gpio_info, ctrl);
93117
94− gpio_set_value(bitbang->mdc, what);
118+ gpio_set_value(bitbang->mdc, what ^ bitbang->mdc_active_low);
95119 }
96120
97121 static struct mdiobb_ops mdio_gpio_ops = {
@@ -110,18 +134,22 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, · 12 unmodified lines
110134 struct mdio_gpio_info *bitbang;
111135 int i;
112136
113− bitbang = kzalloc(sizeof(*bitbang), GFP_KERNEL);
137+ bitbang = devm_kzalloc(dev, sizeof(*bitbang), GFP_KERNEL);
114138 if (!bitbang)
115139 goto out;
116140
117141 bitbang->ctrl.ops = &mdio_gpio_ops;
118142 bitbang->ctrl.reset = pdata->reset;
119143 bitbang->mdc = pdata->mdc;
144+ bitbang->mdc_active_low = pdata->mdc_active_low;
120145 bitbang->mdio = pdata->mdio;
146+ bitbang->mdio_active_low = pdata->mdio_active_low;
147+ bitbang->mdo = pdata->mdo;
148+ bitbang->mdo_active_low = pdata->mdo_active_low;
121149
122150 new_bus = alloc_mdio_bitbang(&bitbang->ctrl);
123151 if (!new_bus)
124− goto out_free_bitbang;
152+ goto out;
125153
126154 new_bus->name = "GPIO Bitbanged MDIO",
127155
@@ -138,11 +166,18 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, · 10 unmodified lines
138166
139167 snprintf(new_bus->id, MII_BUS_ID_SIZE, "gpio-%x", bus_id);
140168
141− if (gpio_request(bitbang->mdc, "mdc"))
169+ if (devm_gpio_request(dev, bitbang->mdc, "mdc"))
170+ goto out_free_bus;
171+
172+ if (devm_gpio_request(dev, bitbang->mdio, "mdio"))
142173 goto out_free_bus;
143174
144− if (gpio_request(bitbang->mdio, "mdio"))
145− goto out_free_mdc;
175+ if (bitbang->mdo) {
176+ if (devm_gpio_request(dev, bitbang->mdo, "mdo"))
177+ goto out_free_bus;
178+ gpio_direction_output(bitbang->mdo, 1);
179+ gpio_direction_input(bitbang->mdio);
180+ }
146181
147182 gpio_direction_output(bitbang->mdc, 0);
148183
@@ -150,12 +185,8 @@ static struct mii_bus *mdio_gpio_bus_init(struct device *dev, · 1 unmodified line
150185
151186 return new_bus;
152187
153−out_free_mdc:
154− gpio_free(bitbang->mdc);
155188 out_free_bus:
156189 free_mdio_bitbang(new_bus);
157−out_free_bitbang:
158− kfree(bitbang);
159190 out:
160191 return NULL;
161192 }
@@ -163,13 +194,8 @@ out: · 1 unmodified line
163194 static void mdio_gpio_bus_deinit(struct device *dev)
164195 {
165196 struct mii_bus *bus = dev_get_drvdata(dev);
166− struct mdio_gpio_info *bitbang = bus->priv;
167197
168− dev_set_drvdata(dev, NULL);
169− gpio_free(bitbang->mdio);
170− gpio_free(bitbang->mdc);
171198 free_mdio_bitbang(bus);
172− kfree(bitbang);
173199 }
174200
175201 static void mdio_gpio_bus_destroy(struct device *dev)
drivers/net/wireless/cw1200/debug.c+2−0
@@ -41,6 +41,8 @@ static const char * const cw1200_debug_link_id[] = { · 40 unmodified lines
4141 "REQ",
4242 "SOFT",
4343 "HARD",
44+ "RESET",
45+ "RESET_REMAP",
4446 };
4547
4648 static const char *cw1200_debug_mode(int mode)
drivers/net/wireless/iwlwifi/iwl-7000.c+3−2
@@ -67,8 +67,8 @@ · 66 unmodified lines
6767 #include "iwl-agn-hw.h"
6868
6969 /* 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
7272
7373 /* Oldest version we won't warn about */
7474 #define IWL7260_UCODE_API_OK 8
@@ -244,3 +244,4 @@ const struct iwl_cfg iwl7265_n_cfg = { · 169 unmodified lines
244244
245245 MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
246246 MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK));
247+MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK));
drivers/net/wireless/iwlwifi/mvm/coex.c+11−7
@@ -190,7 +190,7 @@ static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { · 189 unmodified lines
190190 cpu_to_le32(0xcc00aaaa),
191191 cpu_to_le32(0x0000aaaa),
192192 cpu_to_le32(0xc0004000),
193− cpu_to_le32(0x00000000),
193+ cpu_to_le32(0x00004000),
194194 cpu_to_le32(0xf0005000),
195195 cpu_to_le32(0xf0005000),
196196 },
@@ -213,16 +213,16 @@ static const __le32 iwl_combined_lookup[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE] = { · 16 unmodified lines
213213 /* Tx Tx disabled */
214214 cpu_to_le32(0xaaaaaaaa),
215215 cpu_to_le32(0xaaaaaaaa),
216− cpu_to_le32(0xaaaaaaaa),
216+ cpu_to_le32(0xeeaaaaaa),
217217 cpu_to_le32(0xaaaaaaaa),
218218 cpu_to_le32(0xcc00ff28),
219219 cpu_to_le32(0x0000aaaa),
220220 cpu_to_le32(0xcc00aaaa),
221221 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),
226226 },
227227 };
228228
@@ -1262,6 +1262,7 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, · 1033 unmodified lines
12621262 struct iwl_rx_packet *pkt = rxb_addr(rxb);
12631263 u32 ant_isolation = le32_to_cpup((void *)pkt->data);
12641264 u8 __maybe_unused lower_bound, upper_bound;
1265+ int ret;
12651266 u8 lut;
12661267
12671268 struct iwl_bt_coex_cmd *bt_cmd;
@@ -1318,5 +1319,8 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, · 50 unmodified lines
13181319 memcpy(bt_cmd->bt4_corun_lut40, antenna_coupling_ranges[lut].lut20,
13191320 sizeof(bt_cmd->bt4_corun_lut40));
13201321
1321− return 0;
1322+ ret = iwl_mvm_send_cmd(mvm, &cmd);
1323+
1324+ kfree(bt_cmd);
1325+ return ret;
13221326 }
drivers/net/wireless/iwlwifi/mvm/mac80211.c+1−0
@@ -1332,6 +1332,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, · 1331 unmodified lines
13321332 */
13331333 iwl_mvm_remove_time_event(mvm, mvmvif,
13341334 &mvmvif->time_event_data);
1335+ iwl_mvm_sf_update(mvm, vif, false);
13351336 WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, CMD_SYNC));
13361337 } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS |
13371338 BSS_CHANGED_QOS)) {
drivers/net/wireless/iwlwifi/mvm/rs.c+165−96
@@ -59,7 +59,7 @@ · 58 unmodified lines
5959 /* max allowed rate miss before sync LQ cmd */
6060 #define IWL_MISSED_RATE_MAX 15
6161 #define RS_STAY_IN_COLUMN_TIMEOUT (5*HZ)
62−
62+#define RS_IDLE_TIMEOUT (5*HZ)
6363
6464 static u8 rs_ht_to_legacy[] = {
6565 [IWL_RATE_MCS_0_INDEX] = IWL_RATE_6M_INDEX,
@@ -142,7 +142,7 @@ enum rs_column_mode { · 76 unmodified lines
142142 RS_MIMO2,
143143 };
144144
145−#define MAX_NEXT_COLUMNS 5
145+#define MAX_NEXT_COLUMNS 7
146146 #define MAX_COLUMN_CHECKS 3
147147
148148 typedef bool (*allow_column_func_t) (struct iwl_mvm *mvm,
@@ -212,8 +212,10 @@ static const struct rs_tx_column rs_tx_columns[] = { · 63 unmodified lines
212212 RS_COLUMN_LEGACY_ANT_B,
213213 RS_COLUMN_SISO_ANT_A,
214214 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,
217219 },
218220 },
219221 [RS_COLUMN_LEGACY_ANT_B] = {
@@ -223,8 +225,10 @@ static const struct rs_tx_column rs_tx_columns[] = { · 3 unmodified lines
223225 RS_COLUMN_LEGACY_ANT_A,
224226 RS_COLUMN_SISO_ANT_A,
225227 RS_COLUMN_SISO_ANT_B,
226− RS_COLUMN_MIMO2,
227− RS_COLUMN_MIMO2_SGI,
228+ RS_COLUMN_INVALID,
229+ RS_COLUMN_INVALID,
230+ RS_COLUMN_INVALID,
231+ RS_COLUMN_INVALID,
228232 },
229233 },
230234 [RS_COLUMN_SISO_ANT_A] = {
@@ -235,7 +239,9 @@ static const struct rs_tx_column rs_tx_columns[] = { · 4 unmodified lines
235239 RS_COLUMN_MIMO2,
236240 RS_COLUMN_SISO_ANT_A_SGI,
237241 RS_COLUMN_SISO_ANT_B_SGI,
238− RS_COLUMN_MIMO2_SGI,
242+ RS_COLUMN_LEGACY_ANT_A,
243+ RS_COLUMN_LEGACY_ANT_B,
244+ RS_COLUMN_INVALID,
239245 },
240246 .checks = {
241247 rs_siso_allow,
@@ -249,7 +255,9 @@ static const struct rs_tx_column rs_tx_columns[] = { · 7 unmodified lines
249255 RS_COLUMN_MIMO2,
250256 RS_COLUMN_SISO_ANT_B_SGI,
251257 RS_COLUMN_SISO_ANT_A_SGI,
252− RS_COLUMN_MIMO2_SGI,
258+ RS_COLUMN_LEGACY_ANT_A,
259+ RS_COLUMN_LEGACY_ANT_B,
260+ RS_COLUMN_INVALID,
253261 },
254262 .checks = {
255263 rs_siso_allow,
@@ -265,6 +273,8 @@ static const struct rs_tx_column rs_tx_columns[] = { · 9 unmodified lines
265273 RS_COLUMN_SISO_ANT_A,
266274 RS_COLUMN_SISO_ANT_B,
267275 RS_COLUMN_MIMO2,
276+ RS_COLUMN_LEGACY_ANT_A,
277+ RS_COLUMN_LEGACY_ANT_B,
268278 },
269279 .checks = {
270280 rs_siso_allow,
@@ -281,6 +291,8 @@ static const struct rs_tx_column rs_tx_columns[] = { · 10 unmodified lines
281291 RS_COLUMN_SISO_ANT_B,
282292 RS_COLUMN_SISO_ANT_A,
283293 RS_COLUMN_MIMO2,
294+ RS_COLUMN_LEGACY_ANT_A,
295+ RS_COLUMN_LEGACY_ANT_B,
284296 },
285297 .checks = {
286298 rs_siso_allow,
@@ -296,6 +308,8 @@ static const struct rs_tx_column rs_tx_columns[] = { · 9 unmodified lines
296308 RS_COLUMN_SISO_ANT_A_SGI,
297309 RS_COLUMN_SISO_ANT_B_SGI,
298310 RS_COLUMN_MIMO2_SGI,
311+ RS_COLUMN_LEGACY_ANT_A,
312+ RS_COLUMN_LEGACY_ANT_B,
299313 },
300314 .checks = {
301315 rs_mimo_allow,
@@ -311,6 +325,8 @@ static const struct rs_tx_column rs_tx_columns[] = { · 9 unmodified lines
311325 RS_COLUMN_SISO_ANT_A,
312326 RS_COLUMN_SISO_ANT_B,
313327 RS_COLUMN_MIMO2,
328+ RS_COLUMN_LEGACY_ANT_A,
329+ RS_COLUMN_LEGACY_ANT_B,
314330 },
315331 .checks = {
316332 rs_mimo_allow,
@@ -503,10 +519,12 @@ static void rs_rate_scale_clear_window(struct iwl_rate_scale_data *window) · 186 unmodified lines
503519 window->average_tpt = IWL_INVALID_VALUE;
504520 }
505521
506−static void rs_rate_scale_clear_tbl_windows(struct iwl_scale_tbl_info *tbl)
522+static void rs_rate_scale_clear_tbl_windows(struct iwl_mvm *mvm,
523+ struct iwl_scale_tbl_info *tbl)
507524 {
508525 int i;
509526
527+ IWL_DEBUG_RATE(mvm, "Clearing up window stats\n");
510528 for (i = 0; i < IWL_RATE_COUNT; i++)
511529 rs_rate_scale_clear_window(&tbl->win[i]);
512530 }
@@ -992,6 +1010,13 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, · 479 unmodified lines
9921010 return;
9931011 }
9941012
1013+#ifdef CPTCFG_MAC80211_DEBUGFS
1014+ /* Disable last tx check if we are debugging with fixed rate */
1015+ if (lq_sta->dbg_fixed_rate) {
1016+ IWL_DEBUG_RATE(mvm, "Fixed rate. avoid rate scaling\n");
1017+ return;
1018+ }
1019+#endif
9951020 if (!ieee80211_is_data(hdr->frame_control) ||
9961021 info->flags & IEEE80211_TX_CTL_NO_ACK)
9971022 return;
@@ -1034,6 +1059,18 @@ static void rs_tx_status(void *mvm_r, struct ieee80211_supported_band *sband, · 36 unmodified lines
10341059 mac_index++;
10351060 }
10361061
1062+ if (time_after(jiffies,
1063+ (unsigned long)(lq_sta->last_tx + RS_IDLE_TIMEOUT))) {
1064+ int tid;
1065+ IWL_DEBUG_RATE(mvm, "Tx idle for too long. reinit rs\n");
1066+ for (tid = 0; tid < IWL_MAX_TID_COUNT; tid++)
1067+ ieee80211_stop_tx_ba_session(sta, tid);
1068+
1069+ iwl_mvm_rs_rate_init(mvm, sta, sband->band, false);
1070+ return;
1071+ }
1072+ lq_sta->last_tx = jiffies;
1073+
10371074 /* Here we actually compare this rate to the latest LQ command */
10381075 if ((mac_index < 0) ||
10391076 (rate.sgi != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) ||
@@ -1186,9 +1223,26 @@ static void rs_set_stay_in_table(struct iwl_mvm *mvm, u8 is_legacy, · 146 unmodified lines
11861223 lq_sta->visited_columns = 0;
11871224 }
11881225
1226+static int rs_get_max_allowed_rate(struct iwl_lq_sta *lq_sta,
1227+ const struct rs_tx_column *column)
1228+{
1229+ switch (column->mode) {
1230+ case RS_LEGACY:
1231+ return lq_sta->max_legacy_rate_idx;
1232+ case RS_SISO:
1233+ return lq_sta->max_siso_rate_idx;
1234+ case RS_MIMO2:
1235+ return lq_sta->max_mimo2_rate_idx;
1236+ default:
1237+ WARN_ON_ONCE(1);
1238+ }
1239+
1240+ return lq_sta->max_legacy_rate_idx;
1241+}
1242+
11891243 static const u16 *rs_get_expected_tpt_table(struct iwl_lq_sta *lq_sta,
1190− const struct rs_tx_column *column,
1191− u32 bw)
1244+ const struct rs_tx_column *column,
1245+ u32 bw)
11921246 {
11931247 /* Used to choose among HT tables */
11941248 const u16 (*ht_tbl_pointer)[IWL_RATE_COUNT];
@@ -1438,7 +1492,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) · 243 unmodified lines
14381492
14391493 IWL_DEBUG_RATE(mvm,
14401494 "LQ: stay in table clear win\n");
1441− rs_rate_scale_clear_tbl_windows(tbl);
1495+ rs_rate_scale_clear_tbl_windows(mvm, tbl);
14421496 }
14431497 }
14441498
@@ -1446,8 +1500,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search) · 1 unmodified line
14461500 * bitmaps and stats in active table (this will become the new
14471501 * "search" table). */
14481502 if (lq_sta->rs_state == RS_STATE_SEARCH_CYCLE_STARTED) {
1449− IWL_DEBUG_RATE(mvm, "Clearing up window stats\n");
1450− rs_rate_scale_clear_tbl_windows(tbl);
1503+ rs_rate_scale_clear_tbl_windows(mvm, tbl);
14511504 }
14521505 }
14531506 }
@@ -1485,14 +1538,14 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, · 31 unmodified lines
14851538 struct ieee80211_sta *sta,
14861539 struct iwl_scale_tbl_info *tbl)
14871540 {
1488− int i, j, n;
1541+ int i, j, max_rate;
14891542 enum rs_column next_col_id;
14901543 const struct rs_tx_column *curr_col = &rs_tx_columns[tbl->column];
14911544 const struct rs_tx_column *next_col;
14921545 allow_column_func_t allow_func;
14931546 u8 valid_ants = mvm->fw->valid_tx_ant;
14941547 const u16 *expected_tpt_tbl;
1495− s32 tpt, max_expected_tpt;
1548+ u16 tpt, max_expected_tpt;
14961549
14971550 for (i = 0; i < MAX_NEXT_COLUMNS; i++) {
14981551 next_col_id = curr_col->next_columns[i];
@@ -1535,11 +1588,11 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, · 36 unmodified lines
15351588 if (WARN_ON_ONCE(!expected_tpt_tbl))
15361589 continue;
15371590
1538− max_expected_tpt = 0;
1539− for (n = 0; n < IWL_RATE_COUNT; n++)
1540− if (expected_tpt_tbl[n] > max_expected_tpt)
1541− max_expected_tpt = expected_tpt_tbl[n];
1591+ max_rate = rs_get_max_allowed_rate(lq_sta, next_col);
1592+ if (WARN_ON_ONCE(max_rate == IWL_RATE_INVALID))
1593+ continue;
15421594
1595+ max_expected_tpt = expected_tpt_tbl[max_rate];
15431596 if (tpt >= max_expected_tpt) {
15441597 IWL_DEBUG_RATE(mvm,
15451598 "Skip column %d: can't beat current TPT. Max expected %d current %d\n",
@@ -1547,14 +1600,15 @@ static enum rs_column rs_get_next_column(struct iwl_mvm *mvm, · 1 unmodified line
15471600 continue;
15481601 }
15491602
1603+ IWL_DEBUG_RATE(mvm,
1604+ "Found potential column %d. Max expected %d current %d\n",
1605+ next_col_id, max_expected_tpt, tpt);
15501606 break;
15511607 }
15521608
15531609 if (i == MAX_NEXT_COLUMNS)
15541610 return RS_COLUMN_INVALID;
15551611
1556− IWL_DEBUG_RATE(mvm, "Found potential column %d\n", next_col_id);
1557−
15581612 return next_col_id;
15591613 }
15601614
@@ -1640,85 +1694,76 @@ static enum rs_action rs_get_rate_action(struct iwl_mvm *mvm, · 79 unmodified lines
16401694 {
16411695 enum rs_action action = RS_ACTION_STAY;
16421696
1643− /* Too many failures, decrease rate */
16441697 if ((sr <= RS_SR_FORCE_DECREASE) || (current_tpt == 0)) {
16451698 IWL_DEBUG_RATE(mvm,
1646− "decrease rate because of low SR\n");
1647− action = RS_ACTION_DOWNSCALE;
1648− /* No throughput measured yet for adjacent rates; try increase. */
1649− } else if ((low_tpt == IWL_INVALID_VALUE) &&
1650− (high_tpt == IWL_INVALID_VALUE)) {
1651− if (high != IWL_RATE_INVALID && sr >= IWL_RATE_INCREASE_TH) {
1652− IWL_DEBUG_RATE(mvm,
1653− "Good SR and no high rate measurement. "
1654− "Increase rate\n");
1655− action = RS_ACTION_UPSCALE;
1656− } else if (low != IWL_RATE_INVALID) {
1657− IWL_DEBUG_RATE(mvm,
1658− "Remain in current rate\n");
1659− action = RS_ACTION_STAY;
1660− }
1699+ "Decrease rate because of low SR\n");
1700+ return RS_ACTION_DOWNSCALE;
16611701 }
16621702
1663− /* Both adjacent throughputs are measured, but neither one has better
1664− * throughput; we're using the best rate, don't change it!
1665− */
1666− else if ((low_tpt != IWL_INVALID_VALUE) &&
1667− (high_tpt != IWL_INVALID_VALUE) &&
1668− (low_tpt < current_tpt) &&
1669− (high_tpt < current_tpt)) {
1703+ if ((low_tpt == IWL_INVALID_VALUE) &&
1704+ (high_tpt == IWL_INVALID_VALUE) &&
1705+ (high != IWL_RATE_INVALID)) {
16701706 IWL_DEBUG_RATE(mvm,
1671− "Both high and low are worse. "
1672− "Maintain rate\n");
1673− action = RS_ACTION_STAY;
1707+ "No data about high/low rates. Increase rate\n");
1708+ return RS_ACTION_UPSCALE;
16741709 }
16751710
1676− /* At least one adjacent rate's throughput is measured,
1677− * and may have better performance.
1678− */
1679− else {
1680− /* Higher adjacent rate's throughput is measured */
1681− if (high_tpt != IWL_INVALID_VALUE) {
1682− /* Higher rate has better throughput */
1683− if (high_tpt > current_tpt &&
1684− sr >= IWL_RATE_INCREASE_TH) {
1685− IWL_DEBUG_RATE(mvm,
1686− "Higher rate is better and good "
1687− "SR. Increate rate\n");
1688− action = RS_ACTION_UPSCALE;
1689− } else {
1690− IWL_DEBUG_RATE(mvm,
1691− "Higher rate isn't better OR "
1692− "no good SR. Maintain rate\n");
1693− action = RS_ACTION_STAY;
1694− }
1711+ if ((high_tpt == IWL_INVALID_VALUE) &&
1712+ (high != IWL_RATE_INVALID) &&
1713+ (low_tpt != IWL_INVALID_VALUE) &&
1714+ (low_tpt < current_tpt)) {
1715+ IWL_DEBUG_RATE(mvm,
1716+ "No data about high rate and low rate is worse. Increase rate\n");
1717+ return RS_ACTION_UPSCALE;
1718+ }
16951719
1696− /* Lower adjacent rate's throughput is measured */
1697− } else if (low_tpt != IWL_INVALID_VALUE) {
1698− /* Lower rate has better throughput */
1699− if (low_tpt > current_tpt) {
1700− IWL_DEBUG_RATE(mvm,
1701− "Lower rate is better. "
1702− "Decrease rate\n");
1703− action = RS_ACTION_DOWNSCALE;
1704− } else if (sr >= IWL_RATE_INCREASE_TH) {
1705− IWL_DEBUG_RATE(mvm,
1706− "Lower rate isn't better and "
1707− "good SR. Increase rate\n");
1708− action = RS_ACTION_UPSCALE;
1709− }
1710− }
1720+ if ((high_tpt != IWL_INVALID_VALUE) &&
1721+ (high_tpt > current_tpt)) {
1722+ IWL_DEBUG_RATE(mvm,
1723+ "Higher rate is better. Increate rate\n");
1724+ return RS_ACTION_UPSCALE;
17111725 }
17121726
1713− /* Sanity check; asked for decrease, but success rate or throughput
1714− * has been good at old rate. Don't change it.
1715− */
1716− if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID) &&
1717− ((sr > IWL_RATE_HIGH_TH) ||
1718− (current_tpt > (100 * tbl->expected_tpt[low])))) {
1727+ if ((low_tpt != IWL_INVALID_VALUE) &&
1728+ (high_tpt != IWL_INVALID_VALUE) &&
1729+ (low_tpt < current_tpt) &&
1730+ (high_tpt < current_tpt)) {
1731+ IWL_DEBUG_RATE(mvm,
1732+ "Both high and low are worse. Maintain rate\n");
1733+ return RS_ACTION_STAY;
1734+ }
1735+
1736+ if ((low_tpt != IWL_INVALID_VALUE) &&
1737+ (low_tpt > current_tpt)) {
1738+ IWL_DEBUG_RATE(mvm,
1739+ "Lower rate is better\n");
1740+ action = RS_ACTION_DOWNSCALE;
1741+ goto out;
1742+ }
1743+
1744+ if ((low_tpt == IWL_INVALID_VALUE) &&
1745+ (low != IWL_RATE_INVALID)) {
17191746 IWL_DEBUG_RATE(mvm,
1720− "Sanity check failed. Maintain rate\n");
1721− action = RS_ACTION_STAY;
1747+ "No data about lower rate\n");
1748+ action = RS_ACTION_DOWNSCALE;
1749+ goto out;
1750+ }
1751+
1752+ IWL_DEBUG_RATE(mvm, "Maintain rate\n");
1753+
1754+out:
1755+ if ((action == RS_ACTION_DOWNSCALE) && (low != IWL_RATE_INVALID)) {
1756+ if (sr >= RS_SR_NO_DECREASE) {
1757+ IWL_DEBUG_RATE(mvm,
1758+ "SR is above NO DECREASE. Avoid downscale\n");
1759+ action = RS_ACTION_STAY;
1760+ } else if (current_tpt > (100 * tbl->expected_tpt[low])) {
1761+ IWL_DEBUG_RATE(mvm,
1762+ "Current TPT is higher than max expected in low rate. Avoid downscale\n");
1763+ action = RS_ACTION_STAY;
1764+ } else {
1765+ IWL_DEBUG_RATE(mvm, "Decrease rate\n");
1766+ }
17221767 }
17231768
17241769 return action;
@@ -1792,6 +1837,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm, · 67 unmodified lines
17921837 "Aggregation changed: prev %d current %d. Update expected TPT table\n",
17931838 prev_agg, lq_sta->is_agg);
17941839 rs_set_expected_tpt_table(lq_sta, tbl);
1840+ rs_rate_scale_clear_tbl_windows(mvm, tbl);
17951841 }
17961842
17971843 /* current tx rate */
@@ -2021,7 +2067,7 @@ lq_update: · 223 unmodified lines
20212067 if (lq_sta->search_better_tbl) {
20222068 /* Access the "search" table, clear its history. */
20232069 tbl = &(lq_sta->lq_info[(1 - lq_sta->active_tbl)]);
2024− rs_rate_scale_clear_tbl_windows(tbl);
2070+ rs_rate_scale_clear_tbl_windows(mvm, tbl);
20252071
20262072 /* Use new "search" start rate */
20272073 index = tbl->rate.index;
@@ -2042,8 +2088,18 @@ lq_update: · 14 unmodified lines
20422088 * stay with best antenna legacy modulation for a while
20432089 * before next round of mode comparisons. */
20442090 tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]);
2045− if (is_legacy(&tbl1->rate) && !sta->ht_cap.ht_supported) {
2091+ if (is_legacy(&tbl1->rate)) {
20462092 IWL_DEBUG_RATE(mvm, "LQ: STAY in legacy table\n");
2093+
2094+ if (tid != IWL_MAX_TID_COUNT) {
2095+ tid_data = &sta_priv->tid_data[tid];
2096+ if (tid_data->state != IWL_AGG_OFF) {
2097+ IWL_DEBUG_RATE(mvm,
2098+ "Stop aggregation on tid %d\n",
2099+ tid);
2100+ ieee80211_stop_tx_ba_session(sta, tid);
2101+ }
2102+ }
20472103 rs_set_stay_in_table(mvm, 1, lq_sta);
20482104 } else {
20492105 /* If we're in an HT mode, and all 3 mode switch actions
@@ -2342,9 +2398,10 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, · 292 unmodified lines
23422398 lq_sta->lq.sta_id = sta_priv->sta_id;
23432399
23442400 for (j = 0; j < LQ_SIZE; j++)
2345− rs_rate_scale_clear_tbl_windows(&lq_sta->lq_info[j]);
2401+ rs_rate_scale_clear_tbl_windows(mvm, &lq_sta->lq_info[j]);
23462402
23472403 lq_sta->flush_timer = 0;
2404+ lq_sta->last_tx = jiffies;
23482405
23492406 IWL_DEBUG_RATE(mvm,
23502407 "LQ: *** rate scale station global init for station %d ***\n",
@@ -2388,11 +2445,22 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta, · 37 unmodified lines
23882445 lq_sta->is_vht = true;
23892446 }
23902447
2391− IWL_DEBUG_RATE(mvm,
2392− "SISO-RATE=%X MIMO2-RATE=%X VHT=%d\n",
2448+ lq_sta->max_legacy_rate_idx = find_last_bit(&lq_sta->active_legacy_rate,
2449+ BITS_PER_LONG);
2450+ lq_sta->max_siso_rate_idx = find_last_bit(&lq_sta->active_siso_rate,
2451+ BITS_PER_LONG);
2452+ lq_sta->max_mimo2_rate_idx = find_last_bit(&lq_sta->active_mimo2_rate,
2453+ BITS_PER_LONG);
2454+
2455+ IWL_DEBUG_RATE(mvm, "RATE MASK: LEGACY=%lX SISO=%lX MIMO2=%lX VHT=%d\n",
2456+ lq_sta->active_legacy_rate,
23932457 lq_sta->active_siso_rate,
23942458 lq_sta->active_mimo2_rate,
23952459 lq_sta->is_vht);
2460+ IWL_DEBUG_RATE(mvm, "MAX RATE: LEGACY=%d SISO=%d MIMO2=%d\n",
2461+ lq_sta->max_legacy_rate_idx,
2462+ lq_sta->max_siso_rate_idx,
2463+ lq_sta->max_mimo2_rate_idx);
23962464
23972465 /* These values will be overridden later */
23982466 lq_sta->lq.single_stream_ant_msk =
@@ -2547,6 +2615,7 @@ static void rs_build_rates_table(struct iwl_mvm *mvm, · 148 unmodified lines
25472615 if (is_siso(&rate)) {
25482616 num_rates = RS_SECONDARY_SISO_NUM_RATES;
25492617 num_retries = RS_SECONDARY_SISO_RETRIES;
2618+ lq_cmd->mimo_delim = index;
25502619 } else if (is_legacy(&rate)) {
25512620 num_rates = RS_SECONDARY_LEGACY_NUM_RATES;
25522621 num_retries = RS_LEGACY_RETRIES_PER_RATE;
@@ -2749,7 +2818,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, · 196 unmodified lines
27492818 return -ENOMEM;
27502819
27512820 desc += sprintf(buff+desc, "sta_id %d\n", lq_sta->lq.sta_id);
2752− desc += sprintf(buff+desc, "failed=%d success=%d rate=0%X\n",
2821+ desc += sprintf(buff+desc, "failed=%d success=%d rate=0%lX\n",
27532822 lq_sta->total_failed, lq_sta->total_success,
27542823 lq_sta->active_legacy_rate);
27552824 desc += sprintf(buff+desc, "fixed rate 0x%X\n",
drivers/net/wireless/iwlwifi/mvm/rs.h+11−3
@@ -156,6 +156,7 @@ enum { · 155 unmodified lines
156156 #define IWL_RATE_HIGH_TH 10880 /* 85% */
157157 #define IWL_RATE_INCREASE_TH 6400 /* 50% */
158158 #define RS_SR_FORCE_DECREASE 1920 /* 15% */
159+#define RS_SR_NO_DECREASE 10880 /* 85% */
159160
160161 #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
161162 #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
@@ -310,13 +311,20 @@ struct iwl_lq_sta { · 148 unmodified lines
310311 u32 visited_columns; /* Bitmask marking which Tx columns were
311312 * explored during a search cycle
312313 */
314+ u64 last_tx;
313315 bool is_vht;
314316 enum ieee80211_band band;
315317
316318 /* The following are bitmaps of rates; IWL_RATE_6M_MASK, etc. */
317− u16 active_legacy_rate;
318− u16 active_siso_rate;
319− u16 active_mimo2_rate;
319+ unsigned long active_legacy_rate;
320+ unsigned long active_siso_rate;
321+ unsigned long active_mimo2_rate;
322+
323+ /* Highest rate per Tx mode */
324+ u8 max_legacy_rate_idx;
325+ u8 max_siso_rate_idx;
326+ u8 max_mimo2_rate_idx;
327+
320328 s8 max_rate_idx; /* Max rate set by user */
321329 u8 missed_rate_counter;
322330
drivers/net/wireless/iwlwifi/mvm/sf.c+2−1
@@ -274,7 +274,8 @@ int iwl_mvm_sf_update(struct iwl_mvm *mvm, struct ieee80211_vif *changed_vif, · 273 unmodified lines
274274 return -EINVAL;
275275 if (changed_vif->type != NL80211_IFTYPE_STATION) {
276276 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) {
278279 mvmvif = iwl_mvm_vif_from_mac80211(changed_vif);
279280 sta_id = mvmvif->ap_sta_id;
280281 new_state = SF_FULL_ON;
drivers/net/wireless/iwlwifi/pcie/drv.c+2−0
@@ -373,12 +373,14 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { · 372 unmodified lines
373373 {IWL_PCI_DEVICE(0x095A, 0x500A, iwl7265_2n_cfg)},
374374 {IWL_PCI_DEVICE(0x095B, 0x5200, iwl7265_2n_cfg)},
375375 {IWL_PCI_DEVICE(0x095A, 0x5002, iwl7265_n_cfg)},
376+ {IWL_PCI_DEVICE(0x095A, 0x5102, iwl7265_n_cfg)},
376377 {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)},
377378 {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)},
378379 {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)},
379380 {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)},
380381 {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)},
381382 {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)},
383+ {IWL_PCI_DEVICE(0x095A, 0x9200, iwl7265_2ac_cfg)},
382384 {IWL_PCI_DEVICE(0x095A, 0x9510, iwl7265_2ac_cfg)},
383385 {IWL_PCI_DEVICE(0x095A, 0x9310, iwl7265_2ac_cfg)},
384386 {IWL_PCI_DEVICE(0x095A, 0x9410, iwl7265_2ac_cfg)},
drivers/net/wireless/mwifiex/main.c+6−6
@@ -292,6 +292,12 @@ process_start: · 291 unmodified lines
292292 while ((skb = skb_dequeue(&adapter->usb_rx_data_q)))
293293 mwifiex_handle_rx_packet(adapter, skb);
294294
295+ /* Check for event */
296+ if (adapter->event_received) {
297+ adapter->event_received = false;
298+ mwifiex_process_event(adapter);
299+ }
300+
295301 /* Check for Cmd Resp */
296302 if (adapter->cmd_resp_received) {
297303 adapter->cmd_resp_received = false;
@@ -304,12 +310,6 @@ process_start: · 6 unmodified lines
304310 }
305311 }
306312
307− /* Check for event */
308− if (adapter->event_received) {
309− adapter->event_received = false;
310− mwifiex_process_event(adapter);
311− }
312−
313313 /* Check if we need to confirm Sleep Request
314314 received previously */
315315 if (adapter->ps_state == PS_STATE_PRE_SLEEP) {
drivers/net/wireless/mwifiex/sta_ioctl.c+4−3
@@ -60,9 +60,10 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter, · 59 unmodified lines
6060 int status;
6161
6262 /* 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) {
6667 dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status);
6768 mwifiex_cancel_all_pending_cmd(adapter);
6869 return status;
drivers/net/wireless/rsi/rsi_91x_core.c+1−1
@@ -88,7 +88,7 @@ static u8 rsi_core_determine_hal_queue(struct rsi_common *common) · 87 unmodified lines
8888 bool recontend_queue = false;
8989 u32 q_len = 0;
9090 u8 q_num = INVALID_QUEUE;
91− u8 ii, min = 0;
91+ u8 ii = 0, min = 0;
9292
9393 if (skb_queue_len(&common->tx_queue[MGMT_SOFT_Q])) {
9494 if (!common->mgmt_q_block)
drivers/net/wireless/rsi/rsi_91x_mgmt.c+11−10
@@ -841,16 +841,6 @@ int rsi_set_channel(struct rsi_common *common, u16 channel) · 840 unmodified lines
841841 rsi_dbg(MGMT_TX_ZONE,
842842 "%s: Sending scan req frame\n", __func__);
843843
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−
854844 if (common->band == IEEE80211_BAND_5GHZ) {
855845 if ((channel >= 36) && (channel <= 64))
856846 channel = ((channel - 32) / 4);
@@ -868,6 +858,16 @@ int rsi_set_channel(struct rsi_common *common, u16 channel) · 11 unmodified lines
868858 }
869859 }
870860
861+ skb = dev_alloc_skb(FRAME_DESC_SZ);
862+ if (!skb) {
863+ rsi_dbg(ERR_ZONE, "%s: Failed in allocation of skb\n",
864+ __func__);
865+ return -ENOMEM;
866+ }
867+
868+ memset(skb->data, 0, FRAME_DESC_SZ);
869+ mgmt_frame = (struct rsi_mac_frame *)skb->data;
870+
871871 mgmt_frame->desc_word[0] = cpu_to_le16(RSI_WIFI_MGMT_Q << 12);
872872 mgmt_frame->desc_word[1] = cpu_to_le16(SCAN_REQUEST);
873873 mgmt_frame->desc_word[4] = cpu_to_le16(channel);
@@ -966,6 +966,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common) · 92 unmodified lines
966966 if (!selected_rates) {
967967 rsi_dbg(ERR_ZONE, "%s: Failed in allocation of mem\n",
968968 __func__);
969+ dev_kfree_skb(skb);
969970 return -ENOMEM;
970971 }
971972
drivers/net/wireless/ti/wl18xx/event.h+20−0
@@ -68,6 +68,26 @@ struct wl18xx_event_mailbox { · 67 unmodified lines
6868
6969 /* bitmap of inactive stations (by HLID) */
7070 __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];
7191 } __packed;
7292
7393 int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
drivers/net/wireless/ti/wlcore/event.c+5−0
@@ -158,6 +158,11 @@ EXPORT_SYMBOL_GPL(wlcore_event_channel_switch); · 157 unmodified lines
158158
159159 void wlcore_event_dummy_packet(struct wl1271 *wl)
160160 {
161+ if (wl->plt) {
162+ wl1271_info("Got DUMMY_PACKET event in PLT mode. FW bug, ignoring.");
163+ return;
164+ }
165+
161166 wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID");
162167 wl1271_tx_dummy_packet(wl);
163168 }
include/linux/mdio-gpio.h+5−0
@@ -17,6 +17,11 @@ struct mdio_gpio_platform_data { · 16 unmodified lines
1717 /* GPIO numbers for bus pins */
1818 unsigned int mdc;
1919 unsigned int mdio;
20+ unsigned int mdo;
21+
22+ bool mdc_active_low;
23+ bool mdio_active_low;
24+ bool mdo_active_low;
2025
2126 unsigned int phy_mask;
2227 int irqs[PHY_MAX_ADDR];
include/linux/phy.h+3−0
@@ -75,6 +75,7 @@ typedef enum { · 74 unmodified lines
7575 PHY_INTERFACE_MODE_SMII,
7676 PHY_INTERFACE_MODE_XGMII,
7777 PHY_INTERFACE_MODE_MOCA,
78+ PHY_INTERFACE_MODE_QSGMII,
7879 PHY_INTERFACE_MODE_MAX,
7980 } phy_interface_t;
8081
@@ -116,6 +117,8 @@ static inline const char *phy_modes(phy_interface_t interface) · 35 unmodified lines
116117 return "xgmii";
117118 case PHY_INTERFACE_MODE_MOCA:
118119 return "moca";
120+ case PHY_INTERFACE_MODE_QSGMII:
121+ return "qsgmii";
119122 default:
120123 return "unknown";
121124 }
include/net/flow.h+9−1
@@ -11,6 +11,14 @@ · 10 unmodified lines
1111 #include <linux/in6.h>
1212 #include <linux/atomic.h>
1313
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+
1422 struct flowi_common {
1523 int flowic_oif;
1624 int flowic_iif;
@@ -80,7 +88,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif, · 63 unmodified lines
8088 __be16 dport, __be16 sport)
8189 {
8290 fl4->flowi4_oif = oif;
83− fl4->flowi4_iif = 0;
91+ fl4->flowi4_iif = LOOPBACK_IFINDEX;
8492 fl4->flowi4_mark = mark;
8593 fl4->flowi4_tos = tos;
8694 fl4->flowi4_scope = scope;
include/net/net_namespace.h+1−8
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #include <linux/list.h>
1010 #include <linux/sysctl.h>
1111
12+#include <net/flow.h>
1213 #include <net/netns/core.h>
1314 #include <net/netns/mib.h>
1415 #include <net/netns/unix.h>
@@ -131,14 +132,6 @@ struct net { · 116 unmodified lines
131132 atomic_t fnhe_genid;
132133 };
133134
134−/*
135− * ifindex generation is per-net namespace, and loopback is
136− * always the 1st device in ns (see net_dev_init), thus any
137− * loopback device should get ifindex 1
138− */
139−
140−#define LOOPBACK_IFINDEX 1
141−
142135 #include <linux/seq_file_net.h>
143136
144137 /* Init's network namespace */
include/net/sctp/structs.h+3−1
@@ -1241,6 +1241,7 @@ struct sctp_endpoint { · 1240 unmodified lines
12411241 /* SCTP-AUTH: endpoint shared keys */
12421242 struct list_head endpoint_shared_keys;
12431243 __u16 active_key_id;
1244+ __u8 auth_enable;
12441245 };
12451246
12461247 /* Recover the outter endpoint structure. */
@@ -1269,7 +1270,8 @@ struct sctp_endpoint *sctp_endpoint_is_match(struct sctp_endpoint *, · 22 unmodified lines
12691270 int sctp_has_association(struct net *net, const union sctp_addr *laddr,
12701271 const union sctp_addr *paddr);
12711272
1272−int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
1273+int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
1274+ const struct sctp_association *asoc,
12731275 sctp_cid_t, sctp_init_chunk_t *peer_init,
12741276 struct sctp_chunk *chunk, struct sctp_chunk **err_chunk);
12751277 int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk,
kernel/seccomp.c+2−0
@@ -255,6 +255,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog) · 254 unmodified lines
255255 goto free_prog;
256256
257257 /* Allocate a new seccomp_filter */
258+ ret = -ENOMEM;
258259 filter = kzalloc(sizeof(struct seccomp_filter) +
259260 sizeof(struct sock_filter_int) * new_len,
260261 GFP_KERNEL|__GFP_NOWARN);
@@ -264,6 +265,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog) · 3 unmodified lines
264265 ret = sk_convert_filter(fp, fprog->len, filter->insnsi, &new_len);
265266 if (ret)
266267 goto free_filter;
268+ kfree(fp);
267269
268270 atomic_set(&filter->usage, 1);
269271 filter->len = new_len;
net/8021q/vlan_dev.c+41−5
@@ -493,10 +493,48 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) · 492 unmodified lines
493493 }
494494 }
495495
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+
496534 static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
497535 {
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);
500538 }
501539
502540 /*
@@ -608,9 +646,7 @@ static int vlan_dev_init(struct net_device *dev) · 105 unmodified lines
608646
609647 SET_NETDEV_DEVTYPE(dev, &vlan_type);
610648
611− if (is_vlan_dev(real_dev))
612− subclass = 1;
613−
649+ subclass = vlan_calculate_locking_subclass(dev);
614650 vlan_dev_set_lockdep_class(dev, subclass);
615651
616652 vlan_dev_priv(dev)->vlan_pcpu_stats = netdev_alloc_pcpu_stats(struct vlan_pcpu_stats);
net/core/dev.c+1−0
@@ -5238,6 +5238,7 @@ void __dev_set_rx_mode(struct net_device *dev) · 5237 unmodified lines
52385238 if (ops->ndo_set_rx_mode)
52395239 ops->ndo_set_rx_mode(dev);
52405240 }
5241+EXPORT_SYMBOL(__dev_set_rx_mode);
52415242
52425243 void dev_set_rx_mode(struct net_device *dev)
52435244 {
net/ipv4/fib_frontend.c+1−1
@@ -250,7 +250,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, · 249 unmodified lines
250250 bool dev_match;
251251
252252 fl4.flowi4_oif = 0;
253− fl4.flowi4_iif = oif;
253+ fl4.flowi4_iif = oif ? : LOOPBACK_IFINDEX;
254254 fl4.daddr = src;
255255 fl4.saddr = dst;
256256 fl4.flowi4_tos = tos;
net/ipv4/fib_semantics.c+1−0
@@ -631,6 +631,7 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi, · 630 unmodified lines
631631 .daddr = nh->nh_gw,
632632 .flowi4_scope = cfg->fc_scope + 1,
633633 .flowi4_oif = nh->nh_oif,
634+ .flowi4_iif = LOOPBACK_IFINDEX,
634635 };
635636
636637 /* It is not necessary, but requires a bit of thinking */
net/ipv4/ip_tunnel.c+7−8
@@ -722,19 +722,18 @@ static void ip_tunnel_update(struct ip_tunnel_net *itn, · 721 unmodified lines
722722 int ip_tunnel_ioctl(struct net_device *dev, struct ip_tunnel_parm *p, int cmd)
723723 {
724724 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);
729728
730729 BUG_ON(!itn->fb_tunnel_dev);
731730 switch (cmd) {
732731 case SIOCGETTUNNEL:
733− t = NULL;
734− if (dev == itn->fb_tunnel_dev)
732+ if (dev == itn->fb_tunnel_dev) {
735733 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+ }
738737 memcpy(p, &t->parms, sizeof(*p));
739738 break;
740739
net/ipv4/ipmr.c+1−1
@@ -455,7 +455,7 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) · 454 unmodified lines
455455 struct mr_table *mrt;
456456 struct flowi4 fl4 = {
457457 .flowi4_oif = dev->ifindex,
458− .flowi4_iif = skb->skb_iif,
458+ .flowi4_iif = skb->skb_iif ? : LOOPBACK_IFINDEX,
459459 .flowi4_mark = skb->mark,
460460 };
461461 int err;
net/ipv4/netfilter/ipt_rpfilter.c+1−4
@@ -89,11 +89,8 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) · 88 unmodified lines
8989 if (ipv4_is_multicast(iph->daddr)) {
9090 if (ipv4_is_zeronet(iph->saddr))
9191 return ipv4_is_local_multicast(iph->daddr) ^ invert;
92− flow.flowi4_iif = 0;
93− } else {
94− flow.flowi4_iif = LOOPBACK_IFINDEX;
9592 }
96−
93+ flow.flowi4_iif = LOOPBACK_IFINDEX;
9794 flow.daddr = iph->saddr;
9895 flow.saddr = rpfilter_get_saddr(iph->daddr);
9996 flow.flowi4_oif = 0;
net/ipv4/route.c+1−2
@@ -1700,8 +1700,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, · 1699 unmodified lines
17001700
17011701 if (res.type == RTN_LOCAL) {
17021702 err = fib_validate_source(skb, saddr, daddr, tos,
1703− LOOPBACK_IFINDEX,
1704− dev, in_dev, &itag);
1703+ 0, dev, in_dev, &itag);
17051704 if (err < 0)
17061705 goto martian_source_keep_err;
17071706 goto local_input;
net/ipv6/ip6_tunnel.c+4−4
@@ -1340,8 +1340,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 1339 unmodified lines
13401340 int err = 0;
13411341 struct ip6_tnl_parm p;
13421342 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;
13451345 struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);
13461346
13471347 switch (cmd) {
@@ -1353,11 +1353,11 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 5 unmodified lines
13531353 }
13541354 ip6_tnl_parm_from_user(&p1, &p);
13551355 t = ip6_tnl_locate(net, &p1, 0);
1356+ if (t == NULL)
1357+ t = netdev_priv(dev);
13561358 } else {
13571359 memset(&p, 0, sizeof(p));
13581360 }
1359− if (t == NULL)
1360− t = netdev_priv(dev);
13611361 ip6_tnl_parm_to_user(&p, &t->parms);
13621362 if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) {
13631363 err = -EFAULT;
net/ipv6/ip6mr.c+1−1
@@ -700,7 +700,7 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, · 699 unmodified lines
700700 struct mr6_table *mrt;
701701 struct flowi6 fl6 = {
702702 .flowi6_oif = dev->ifindex,
703− .flowi6_iif = skb->skb_iif,
703+ .flowi6_iif = skb->skb_iif ? : LOOPBACK_IFINDEX,
704704 .flowi6_mark = skb->mark,
705705 };
706706 int err;
net/ipv6/sit.c+4−13
@@ -1127,8 +1127,8 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) · 1126 unmodified lines
11271127 int err = 0;
11281128 struct ip_tunnel_parm p;
11291129 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;
11321132 struct sit_net *sitn = net_generic(net, sit_net_id);
11331133 #ifdef CONFIG_IPV6_SIT_6RD
11341134 struct ip_tunnel_6rd ip6rd;
@@ -1139,16 +1139,15 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) · 4 unmodified lines
11391139 #ifdef CONFIG_IPV6_SIT_6RD
11401140 case SIOCGET6RD:
11411141 #endif
1142− t = NULL;
11431142 if (dev == sitn->fb_tunnel_dev) {
11441143 if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) {
11451144 err = -EFAULT;
11461145 break;
11471146 }
11481147 t = ipip6_tunnel_locate(net, &p, 0);
1148+ if (t == NULL)
1149+ t = netdev_priv(dev);
11491150 }
1150− if (t == NULL)
1151− t = netdev_priv(dev);
11521151
11531152 err = -EFAULT;
11541153 if (cmd == SIOCGETTUNNEL) {
@@ -1244,9 +1243,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) · 89 unmodified lines
12441243 err = -EINVAL;
12451244 if (dev == sitn->fb_tunnel_dev)
12461245 goto done;
1247− err = -ENOENT;
1248− if (!(t = netdev_priv(dev)))
1249− goto done;
12501246 err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data);
12511247 break;
12521248
@@ -1262,9 +1258,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) · 9 unmodified lines
12621258 err = -EFAULT;
12631259 if (copy_from_user(&prl, ifr->ifr_ifru.ifru_data, sizeof(prl)))
12641260 goto done;
1265− err = -ENOENT;
1266− if (!(t = netdev_priv(dev)))
1267− goto done;
12681261
12691262 switch (cmd) {
12701263 case SIOCDELPRL:
@@ -1292,8 +1285,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd) · 21 unmodified lines
12921285 sizeof(ip6rd)))
12931286 goto done;
12941287
1295− t = netdev_priv(dev);
1296−
12971288 if (cmd != SIOCDEL6RD) {
12981289 err = ipip6_tunnel_update_6rd(t, &ip6rd);
12991290 if (err < 0)
net/mac80211/chan.c+9−2
@@ -249,7 +249,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local, · 248 unmodified lines
249249
250250 if (!local->use_chanctx) {
251251 local->_oper_chandef = *chandef;
252− ieee80211_hw_config(local, 0);
252+ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
253253 } else {
254254 err = drv_add_chanctx(local, ctx);
255255 if (err) {
@@ -286,7 +286,7 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local, · 30 unmodified lines
286286 check_single_channel = true;
287287 local->hw.conf.radar_enabled = false;
288288
289− ieee80211_hw_config(local, 0);
289+ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
290290 } else {
291291 drv_remove_chanctx(local, ctx);
292292 }
@@ -492,6 +492,13 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, · 199 unmodified lines
492492 rx_chains_static = max(rx_chains_static, needed_static);
493493 rx_chains_dynamic = max(rx_chains_dynamic, needed_dynamic);
494494 }
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+
495502 rcu_read_unlock();
496503
497504 if (!local->use_chanctx) {
net/mac80211/main.c+3−1
@@ -148,6 +148,8 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local) · 147 unmodified lines
148148 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
149149 if (!rcu_access_pointer(sdata->vif.chanctx_conf))
150150 continue;
151+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
152+ continue;
151153 power = min(power, sdata->vif.bss_conf.txpower);
152154 }
153155 rcu_read_unlock();
@@ -199,7 +201,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, · 45 unmodified lines
199201 {
200202 struct ieee80211_local *local = sdata->local;
201203
202− if (!changed)
204+ if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
203205 return;
204206
205207 drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
net/mac80211/offchannel.c+1−0
@@ -355,6 +355,7 @@ void ieee80211_sw_roc_work(struct work_struct *work) · 354 unmodified lines
355355 struct ieee80211_roc_work *dep;
356356
357357 /* start this ROC */
358+ ieee80211_offchannel_stop_vifs(local);
358359
359360 /* switch channel etc */
360361 ieee80211_recalc_idle(local);
net/mac80211/status.c+1−0
@@ -618,6 +618,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) · 617 unmodified lines
618618 sta, true, acked);
619619
620620 if ((local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) &&
621+ (ieee80211_is_data(hdr->frame_control)) &&
621622 (rates_idx != -1))
622623 sta->last_tx_rate = info->status.rates[rates_idx];
623624
net/sctp/auth.c+6−11
@@ -386,14 +386,13 @@ nomem: · 385 unmodified lines
386386 */
387387 int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp)
388388 {
389− struct net *net = sock_net(asoc->base.sk);
390389 struct sctp_auth_bytes *secret;
391390 struct sctp_shared_key *ep_key;
392391
393392 /* If we don't support AUTH, or peer is not capable
394393 * we don't need to do anything.
395394 */
396− if (!net->sctp.auth_enable || !asoc->peer.auth_capable)
395+ if (!asoc->ep->auth_enable || !asoc->peer.auth_capable)
397396 return 0;
398397
399398 /* If the key_id is non-zero and we couldn't find an
@@ -440,16 +439,16 @@ struct sctp_shared_key *sctp_auth_get_shkey( · 40 unmodified lines
440439 */
441440 int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp)
442441 {
443− struct net *net = sock_net(ep->base.sk);
444442 struct crypto_hash *tfm = NULL;
445443 __u16 id;
446444
447− /* if the transforms are already allocted, we are done */
448− if (!net->sctp.auth_enable) {
445+ /* If AUTH extension is disabled, we are done */
446+ if (!ep->auth_enable) {
449447 ep->auth_hmacs = NULL;
450448 return 0;
451449 }
452450
451+ /* If the transforms are already allocated, we are done */
453452 if (ep->auth_hmacs)
454453 return 0;
455454
@@ -665,12 +664,10 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param) · 209 unmodified lines
665664 /* Check if peer requested that this chunk is authenticated */
666665 int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
667666 {
668− struct net *net;
669667 if (!asoc)
670668 return 0;
671669
672− net = sock_net(asoc->base.sk);
673− if (!net->sctp.auth_enable || !asoc->peer.auth_capable)
670+ if (!asoc->ep->auth_enable || !asoc->peer.auth_capable)
674671 return 0;
675672
676673 return __sctp_auth_cid(chunk, asoc->peer.peer_chunks);
@@ -679,12 +676,10 @@ int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) · 2 unmodified lines
679676 /* Check if we requested that peer authenticate this chunk. */
680677 int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
681678 {
682− struct net *net;
683679 if (!asoc)
684680 return 0;
685681
686− net = sock_net(asoc->base.sk);
687− if (!net->sctp.auth_enable)
682+ if (!asoc->ep->auth_enable)
688683 return 0;
689684
690685 return __sctp_auth_cid(chunk,
net/sctp/endpointola.c+2−1
@@ -68,7 +68,8 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, · 67 unmodified lines
6868 if (!ep->digest)
6969 return NULL;
7070
71− if (net->sctp.auth_enable) {
71+ ep->auth_enable = net->sctp.auth_enable;
72+ if (ep->auth_enable) {
7273 /* Allocate space for HMACS and CHUNKS authentication
7374 * variables. There are arrays that we encode directly
7475 * into parameters to make the rest of the operations easier.
net/sctp/sm_make_chunk.c+17−15
@@ -219,6 +219,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, · 218 unmodified lines
219219 gfp_t gfp, int vparam_len)
220220 {
221221 struct net *net = sock_net(asoc->base.sk);
222+ struct sctp_endpoint *ep = asoc->ep;
222223 sctp_inithdr_t init;
223224 union sctp_params addrs;
224225 size_t chunksize;
@@ -278,7 +279,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, · 53 unmodified lines
278279 chunksize += vparam_len;
279280
280281 /* Account for AUTH related parameters */
281− if (net->sctp.auth_enable) {
282+ if (ep->auth_enable) {
282283 /* Add random parameter length*/
283284 chunksize += sizeof(asoc->c.auth_random);
284285
@@ -363,7 +364,7 @@ struct sctp_chunk *sctp_make_init(const struct sctp_association *asoc, · 78 unmodified lines
363364 }
364365
365366 /* Add SCTP-AUTH chunks to the parameter list */
366− if (net->sctp.auth_enable) {
367+ if (ep->auth_enable) {
367368 sctp_addto_chunk(retval, sizeof(asoc->c.auth_random),
368369 asoc->c.auth_random);
369370 if (auth_hmacs)
@@ -2010,7 +2011,7 @@ static void sctp_process_ext_param(struct sctp_association *asoc, · 1640 unmodified lines
20102011 /* if the peer reports AUTH, assume that he
20112012 * supports AUTH.
20122013 */
2013− if (net->sctp.auth_enable)
2014+ if (asoc->ep->auth_enable)
20142015 asoc->peer.auth_capable = 1;
20152016 break;
20162017 case SCTP_CID_ASCONF:
@@ -2102,6 +2103,7 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc, · 85 unmodified lines
21022103 * SCTP_IERROR_NO_ERROR - continue with the chunk
21032104 */
21042105 static sctp_ierror_t sctp_verify_param(struct net *net,
2106+ const struct sctp_endpoint *ep,
21052107 const struct sctp_association *asoc,
21062108 union sctp_params param,
21072109 sctp_cid_t cid,
@@ -2152,7 +2154,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net, · 44 unmodified lines
21522154 goto fallthrough;
21532155
21542156 case SCTP_PARAM_RANDOM:
2155− if (!net->sctp.auth_enable)
2157+ if (!ep->auth_enable)
21562158 goto fallthrough;
21572159
21582160 /* SCTP-AUTH: Secion 6.1
@@ -2169,7 +2171,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net, · 10 unmodified lines
21692171 break;
21702172
21712173 case SCTP_PARAM_CHUNKS:
2172− if (!net->sctp.auth_enable)
2174+ if (!ep->auth_enable)
21732175 goto fallthrough;
21742176
21752177 /* SCTP-AUTH: Section 3.2
@@ -2185,7 +2187,7 @@ static sctp_ierror_t sctp_verify_param(struct net *net, · 9 unmodified lines
21852187 break;
21862188
21872189 case SCTP_PARAM_HMAC_ALGO:
2188− if (!net->sctp.auth_enable)
2190+ if (!ep->auth_enable)
21892191 goto fallthrough;
21902192
21912193 hmacs = (struct sctp_hmac_algo_param *)param.p;
@@ -2220,10 +2222,9 @@ fallthrough: · 28 unmodified lines
22202222 }
22212223
22222224 /* Verify the INIT packet before we process it. */
2223−int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
2224− sctp_cid_t cid,
2225− sctp_init_chunk_t *peer_init,
2226− struct sctp_chunk *chunk,
2225+int sctp_verify_init(struct net *net, const struct sctp_endpoint *ep,
2226+ const struct sctp_association *asoc, sctp_cid_t cid,
2227+ sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk,
22272228 struct sctp_chunk **errp)
22282229 {
22292230 union sctp_params param;
@@ -2264,8 +2265,8 @@ int sctp_verify_init(struct net *net, const struct sctp_association *asoc, · 34 unmodified lines
22642265
22652266 /* Verify all the variable length parameters */
22662267 sctp_walk_params(param, peer_init, init_hdr.params) {
2267−
2268− result = sctp_verify_param(net, asoc, param, cid, chunk, errp);
2268+ result = sctp_verify_param(net, ep, asoc, param, cid,
2269+ chunk, errp);
22692270 switch (result) {
22702271 case SCTP_IERROR_ABORT:
22712272 case SCTP_IERROR_NOMEM:
@@ -2497,6 +2498,7 @@ static int sctp_process_param(struct sctp_association *asoc, · 225 unmodified lines
24972498 struct sctp_af *af;
24982499 union sctp_addr_param *addr_param;
24992500 struct sctp_transport *t;
2501+ struct sctp_endpoint *ep = asoc->ep;
25002502
25012503 /* We maintain all INIT parameters in network byte order all the
25022504 * time. This allows us to not worry about whether the parameters
@@ -2636,7 +2638,7 @@ do_addr_param: · 133 unmodified lines
26362638 goto fall_through;
26372639
26382640 case SCTP_PARAM_RANDOM:
2639− if (!net->sctp.auth_enable)
2641+ if (!ep->auth_enable)
26402642 goto fall_through;
26412643
26422644 /* Save peer's random parameter */
@@ -2649,7 +2651,7 @@ do_addr_param: · 6 unmodified lines
26492651 break;
26502652
26512653 case SCTP_PARAM_HMAC_ALGO:
2652− if (!net->sctp.auth_enable)
2654+ if (!ep->auth_enable)
26532655 goto fall_through;
26542656
26552657 /* Save peer's HMAC list */
@@ -2665,7 +2667,7 @@ do_addr_param: · 9 unmodified lines
26652667 break;
26662668
26672669 case SCTP_PARAM_CHUNKS:
2668− if (!net->sctp.auth_enable)
2670+ if (!ep->auth_enable)
26692671 goto fall_through;
26702672
26712673 asoc->peer.peer_chunks = kmemdup(param.p,
net/sctp/sm_statefuns.c+3−3
@@ -357,7 +357,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(struct net *net, · 356 unmodified lines
357357
358358 /* Verify the INIT chunk before processing it. */
359359 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,
361361 (sctp_init_chunk_t *)chunk->chunk_hdr, chunk,
362362 &err_chunk)) {
363363 /* This chunk contains fatal error. It is to be discarded.
@@ -524,7 +524,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(struct net *net, · 160 unmodified lines
524524
525525 /* Verify the INIT chunk before processing it. */
526526 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,
528528 (sctp_init_chunk_t *)chunk->chunk_hdr, chunk,
529529 &err_chunk)) {
530530
@@ -1430,7 +1430,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init( · 899 unmodified lines
14301430
14311431 /* Verify the INIT chunk before processing it. */
14321432 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,
14341434 (sctp_init_chunk_t *)chunk->chunk_hdr, chunk,
14351435 &err_chunk)) {
14361436 /* This chunk contains fatal error. It is to be discarded.
net/sctp/socket.c+26−28
@@ -3321,10 +3321,10 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk, · 3320 unmodified lines
33213321 char __user *optval,
33223322 unsigned int optlen)
33233323 {
3324− struct net *net = sock_net(sk);
3324+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
33253325 struct sctp_authchunk val;
33263326
3327− if (!net->sctp.auth_enable)
3327+ if (!ep->auth_enable)
33283328 return -EACCES;
33293329
33303330 if (optlen != sizeof(struct sctp_authchunk))
@@ -3341,7 +3341,7 @@ static int sctp_setsockopt_auth_chunk(struct sock *sk, · 10 unmodified lines
33413341 }
33423342
33433343 /* 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);
33453345 }
33463346
33473347 /*
@@ -3354,12 +3354,12 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk, · 6 unmodified lines
33543354 char __user *optval,
33553355 unsigned int optlen)
33563356 {
3357− struct net *net = sock_net(sk);
3357+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
33583358 struct sctp_hmacalgo *hmacs;
33593359 u32 idents;
33603360 int err;
33613361
3362− if (!net->sctp.auth_enable)
3362+ if (!ep->auth_enable)
33633363 return -EACCES;
33643364
33653365 if (optlen < sizeof(struct sctp_hmacalgo))
@@ -3376,7 +3376,7 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk, · 10 unmodified lines
33763376 goto out;
33773377 }
33783378
3379− err = sctp_auth_ep_set_hmacs(sctp_sk(sk)->ep, hmacs);
3379+ err = sctp_auth_ep_set_hmacs(ep, hmacs);
33803380 out:
33813381 kfree(hmacs);
33823382 return err;
@@ -3392,12 +3392,12 @@ static int sctp_setsockopt_auth_key(struct sock *sk, · 9 unmodified lines
33923392 char __user *optval,
33933393 unsigned int optlen)
33943394 {
3395− struct net *net = sock_net(sk);
3395+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
33963396 struct sctp_authkey *authkey;
33973397 struct sctp_association *asoc;
33983398 int ret;
33993399
3400− if (!net->sctp.auth_enable)
3400+ if (!ep->auth_enable)
34013401 return -EACCES;
34023402
34033403 if (optlen <= sizeof(struct sctp_authkey))
@@ -3418,7 +3418,7 @@ static int sctp_setsockopt_auth_key(struct sock *sk, · 14 unmodified lines
34183418 goto out;
34193419 }
34203420
3421− ret = sctp_auth_set_key(sctp_sk(sk)->ep, asoc, authkey);
3421+ ret = sctp_auth_set_key(ep, asoc, authkey);
34223422 out:
34233423 kzfree(authkey);
34243424 return ret;
@@ -3434,11 +3434,11 @@ static int sctp_setsockopt_active_key(struct sock *sk, · 9 unmodified lines
34343434 char __user *optval,
34353435 unsigned int optlen)
34363436 {
3437− struct net *net = sock_net(sk);
3437+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
34383438 struct sctp_authkeyid val;
34393439 struct sctp_association *asoc;
34403440
3441− if (!net->sctp.auth_enable)
3441+ if (!ep->auth_enable)
34423442 return -EACCES;
34433443
34443444 if (optlen != sizeof(struct sctp_authkeyid))
@@ -3450,8 +3450,7 @@ static int sctp_setsockopt_active_key(struct sock *sk, · 5 unmodified lines
34503450 if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP))
34513451 return -EINVAL;
34523452
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);
34553454 }
34563455
34573456 /*
@@ -3463,11 +3462,11 @@ static int sctp_setsockopt_del_key(struct sock *sk, · 5 unmodified lines
34633462 char __user *optval,
34643463 unsigned int optlen)
34653464 {
3466− struct net *net = sock_net(sk);
3465+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
34673466 struct sctp_authkeyid val;
34683467 struct sctp_association *asoc;
34693468
3470− if (!net->sctp.auth_enable)
3469+ if (!ep->auth_enable)
34713470 return -EACCES;
34723471
34733472 if (optlen != sizeof(struct sctp_authkeyid))
@@ -3479,8 +3478,7 @@ static int sctp_setsockopt_del_key(struct sock *sk, · 5 unmodified lines
34793478 if (!asoc && val.scact_assoc_id && sctp_style(sk, UDP))
34803479 return -EINVAL;
34813480
3482− return sctp_auth_del_key_id(sctp_sk(sk)->ep, asoc,
3483− val.scact_keynumber);
3481+ return sctp_auth_del_key_id(ep, asoc, val.scact_keynumber);
34843482
34853483 }
34863484
@@ -5387,16 +5385,16 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len, · 1900 unmodified lines
53875385 static int sctp_getsockopt_hmac_ident(struct sock *sk, int len,
53885386 char __user *optval, int __user *optlen)
53895387 {
5390− struct net *net = sock_net(sk);
5388+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
53915389 struct sctp_hmacalgo __user *p = (void __user *)optval;
53925390 struct sctp_hmac_algo_param *hmacs;
53935391 __u16 data_len = 0;
53945392 u32 num_idents;
53955393
5396− if (!net->sctp.auth_enable)
5394+ if (!ep->auth_enable)
53975395 return -EACCES;
53985396
5399− hmacs = sctp_sk(sk)->ep->auth_hmacs_list;
5397+ hmacs = ep->auth_hmacs_list;
54005398 data_len = ntohs(hmacs->param_hdr.length) - sizeof(sctp_paramhdr_t);
54015399
54025400 if (len < sizeof(struct sctp_hmacalgo) + data_len)
@@ -5417,11 +5415,11 @@ static int sctp_getsockopt_hmac_ident(struct sock *sk, int len, · 14 unmodified lines
54175415 static int sctp_getsockopt_active_key(struct sock *sk, int len,
54185416 char __user *optval, int __user *optlen)
54195417 {
5420− struct net *net = sock_net(sk);
5418+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
54215419 struct sctp_authkeyid val;
54225420 struct sctp_association *asoc;
54235421
5424− if (!net->sctp.auth_enable)
5422+ if (!ep->auth_enable)
54255423 return -EACCES;
54265424
54275425 if (len < sizeof(struct sctp_authkeyid))
@@ -5436,7 +5434,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len, · 8 unmodified lines
54365434 if (asoc)
54375435 val.scact_keynumber = asoc->active_key_id;
54385436 else
5439− val.scact_keynumber = sctp_sk(sk)->ep->active_key_id;
5437+ val.scact_keynumber = ep->active_key_id;
54405438
54415439 len = sizeof(struct sctp_authkeyid);
54425440 if (put_user(len, optlen))
@@ -5450,7 +5448,7 @@ static int sctp_getsockopt_active_key(struct sock *sk, int len, · 7 unmodified lines
54505448 static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len,
54515449 char __user *optval, int __user *optlen)
54525450 {
5453− struct net *net = sock_net(sk);
5451+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
54545452 struct sctp_authchunks __user *p = (void __user *)optval;
54555453 struct sctp_authchunks val;
54565454 struct sctp_association *asoc;
@@ -5458,7 +5456,7 @@ static int sctp_getsockopt_peer_auth_chunks(struct sock *sk, int len, · 1 unmodified line
54585456 u32 num_chunks = 0;
54595457 char __user *to;
54605458
5461− if (!net->sctp.auth_enable)
5459+ if (!ep->auth_enable)
54625460 return -EACCES;
54635461
54645462 if (len < sizeof(struct sctp_authchunks))
@@ -5495,7 +5493,7 @@ num: · 30 unmodified lines
54955493 static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len,
54965494 char __user *optval, int __user *optlen)
54975495 {
5498− struct net *net = sock_net(sk);
5496+ struct sctp_endpoint *ep = sctp_sk(sk)->ep;
54995497 struct sctp_authchunks __user *p = (void __user *)optval;
55005498 struct sctp_authchunks val;
55015499 struct sctp_association *asoc;
@@ -5503,7 +5501,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, · 1 unmodified line
55035501 u32 num_chunks = 0;
55045502 char __user *to;
55055503
5506− if (!net->sctp.auth_enable)
5504+ if (!ep->auth_enable)
55075505 return -EACCES;
55085506
55095507 if (len < sizeof(struct sctp_authchunks))
@@ -5520,7 +5518,7 @@ static int sctp_getsockopt_local_auth_chunks(struct sock *sk, int len, · 10 unmodified lines
55205518 if (asoc)
55215519 ch = (struct sctp_chunks_param *)asoc->c.auth_chunks;
55225520 else
5523− ch = sctp_sk(sk)->ep->auth_chunk_list;
5521+ ch = ep->auth_chunk_list;
55245522
55255523 if (!ch)
55265524 goto num;
net/sctp/sysctl.c+35−1
@@ -64,6 +64,9 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write, · 63 unmodified lines
6464 static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,
6565 void __user *buffer, size_t *lenp,
6666 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);
6770
6871 static struct ctl_table sctp_table[] = {
6972 {
@@ -266,7 +269,7 @@ static struct ctl_table sctp_net_table[] = { · 196 unmodified lines
266269 .data = &init_net.sctp.auth_enable,
267270 .maxlen = sizeof(int),
268271 .mode = 0644,
269− .proc_handler = proc_dointvec,
272+ .proc_handler = proc_sctp_do_auth,
270273 },
271274 {
272275 .procname = "addr_scope_policy",
@@ -400,6 +403,37 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write, · 127 unmodified lines
400403 return ret;
401404 }
402405
406+static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
407+ void __user *buffer, size_t *lenp,
408+ loff_t *ppos)
409+{
410+ struct net *net = current->nsproxy->net_ns;
411+ struct ctl_table tbl;
412+ int new_value, ret;
413+
414+ memset(&tbl, 0, sizeof(struct ctl_table));
415+ tbl.maxlen = sizeof(unsigned int);
416+
417+ if (write)
418+ tbl.data = &new_value;
419+ else
420+ tbl.data = &net->sctp.auth_enable;
421+
422+ ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
423+
424+ if (write) {
425+ struct sock *sk = net->sctp.ctl_sock;
426+
427+ net->sctp.auth_enable = new_value;
428+ /* Update the value in the control socket */
429+ lock_sock(sk);
430+ sctp_sk(sk)->ep->auth_enable = new_value;
431+ release_sock(sk);
432+ }
433+
434+ return ret;
435+}
436+
403437 int sctp_sysctl_net_register(struct net *net)
404438 {
405439 struct ctl_table *table = sctp_net_table;
net/socket.c+2−2
@@ -1880,8 +1880,8 @@ out: · 1879 unmodified lines
18801880 * Receive a datagram from a socket.
18811881 */
18821882
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)
18851885 {
18861886 return sys_recvfrom(fd, ubuf, size, flags, NULL, NULL);
18871887 }