1. 20 Oct, 2016 12 commits
    • Jarod Wilson's avatar
      net: use core MTU range checking in WAN drivers · 8b6b4135
      Jarod Wilson authored
      - set min/max_mtu in all hdlc drivers, remove hdlc_change_mtu
      - sent max_mtu in lec driver, remove lec_change_mtu
      - set min/max_mtu in x25_asy driver
      
      CC: netdev@vger.kernel.org
      CC: Krzysztof Halasa <khc@pm.waw.pl>
      CC: Krzysztof Halasa <khalasa@piap.pl>
      CC: Jan "Yenya" Kasprzak <kas@fi.muni.cz>
      CC: Francois Romieu <romieu@fr.zoreil.com>
      CC: Kevin Curtis <kevin.curtis@farsite.co.uk>
      CC: Zhao Qiang <qiang.zhao@nxp.com>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b6b4135
    • Jarod Wilson's avatar
      net: use core MTU range checking in wireless drivers · 9c22b4a3
      Jarod Wilson authored
      - set max_mtu in wil6210 driver
      - set max_mtu in atmel driver
      - set min/max_mtu in cisco airo driver, remove airo_change_mtu
      - set min/max_mtu in ipw2100/ipw2200 drivers, remove libipw_change_mtu
      - set min/max_mtu in p80211netdev, remove wlan_change_mtu
      - set min/max_mtu in net/mac80211/iface.c and remove ieee80211_change_mtu
      - set min/max_mtu in wimax/i2400m and remove i2400m_change_mtu
      - set min/max_mtu in intersil/hostap and remove prism2_change_mtu
      - set min/max_mtu in intersil/orinoco
      - set min/max_mtu in tty/n_gsm and remove gsm_change_mtu
      
      CC: netdev@vger.kernel.org
      CC: linux-wireless@vger.kernel.org
      CC: Maya Erez <qca_merez@qca.qualcomm.com>
      CC: Simon Kelley <simon@thekelleys.org.uk>
      CC: Stanislav Yakovlev <stas.yakovlev@gmail.com>
      CC: Johannes Berg <johannes@sipsolutions.net>
      CC: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Acked-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c22b4a3
    • Jarod Wilson's avatar
      net: use core MTU range checking in USB NIC drivers · f77f0aee
      Jarod Wilson authored
      usbnet:
      - Remove stale new_mtu <= 0 check in usbnet.c
      - Set min_mtu = 0, max_mtu = 65535 (sub-drivers must set their own
        max_mtu and/or min_mtu as needed)
      
      r8152:
      - Set appropriate max_mtu for different variants (1500 or 9194)
      
      lan78xx:
      - Set max_mtu = 9000
      
      asix_driver:
      - max_mtu = 16384 for ax88178 variant
      
      ax88179:
      - max_mtu = 4088
      
      cdc_ncm:
      - max_mtu from hardware
      
      cdc-phonet:
      - min_mtu = 6, max_mtu = 65541
      
      sierra_net:
      - max_mtu = 1500, call usbnet_change_mtu directly
      - sierra_net_change_mtu checked for MTU > 1500, then called
        usbnet_change_mtu, but if we set max_mtu to let the network core handle
        the range check, then we can simply call usbnet_change_mtu directly
      
      smsc75xx:
      - max_mtu = 9000
      
      CC: netdev@vger.kernel.org
      CC: Woojung Huh <woojung.huh@microchip.com>
      CC: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
      CC: Hayes Wang <hayeswang@realtek.com>
      CC: Oliver Neukum <oneukum@suse.com>
      CC: Steve Glendinning <steve.glendinning@shawell.net>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f77f0aee
    • Jarod Wilson's avatar
      ethernet: use net core MTU range checking in more drivers · d894be57
      Jarod Wilson authored
      Somehow, I missed a healthy number of ethernet drivers in the last pass.
      Most of these drivers either were in need of an updated max_mtu to make
      jumbo frames possible to enable again. In a few cases, also setting a
      different min_mtu to match previous lower bounds. There are also a few
      drivers that had no upper bounds checking, so they're getting a brand new
      ETH_MAX_MTU that is identical to IP_MAX_MTU, but accessible by includes
      all ethernet and ethernet-like drivers all have already.
      
      acenic:
      - min_mtu = 0, max_mtu = 9000
      
      amazon/ena:
      - min_mtu = 128, max_mtu = adapter->max_mtu
      
      amd/xgbe:
      - min_mtu = 0, max_mtu = 9000
      
      sb1250:
      - min_mtu = 0, max_mtu = 1518
      
      cxgb3:
      - min_mtu = 81, max_mtu = 65535
      
      cxgb4:
      - min_mtu = 81, max_mtu = 9600
      
      cxgb4vf:
      - min_mtu = 81, max_mtu = 65535
      
      benet:
      - min_mtu = 256, max_mtu = 9000
      
      ibmveth:
      - min_mtu = 68, max_mtu = 65535
      
      ibmvnic:
      - min_mtu = adapter->min_mtu, max_mtu = adapter->max_mtu
      - remove now redundant ibmvnic_change_mtu
      
      jme:
      - min_mtu = 1280, max_mtu = 9202
      
      mv643xx_eth:
      - min_mtu = 64, max_mtu = 9500
      
      mlxsw:
      - min_mtu = 0, max_mtu = 65535
      - Basically bypassing the core checks, and instead relying on dynamic
        checks in the respective switch drivers' ndo_change_mtu functions
      
      ns83820:
      - min_mtu = 0
      - remove redundant ns83820_change_mtu, only checked for mtu > 1500
      
      netxen:
      - min_mtu = 0, max_mtu = 8000 (P2), max_mtu = 9600 (P3)
      
      qlge:
      - min_mtu = 1500, max_mtu = 9000
      - driver only supports setting mtu to 1500 or 9000, so the core check only
        rules out < 1500 and > 9000, qlge_change_mtu still needs to check that
        the value is 1500 or 9000
      
      qualcomm/emac:
      - min_mtu = 46, max_mtu = 9194
      
      xilinx_axienet:
      - min_mtu = 64, max_mtu = 9000
      
      Fixes: 61e84623 ("net: centralize net_device min/max MTU checking")
      CC: netdev@vger.kernel.org
      CC: Jes Sorensen <jes@trained-monkey.org>
      CC: Netanel Belgazal <netanel@annapurnalabs.com>
      CC: Tom Lendacky <thomas.lendacky@amd.com>
      CC: Santosh Raspatur <santosh@chelsio.com>
      CC: Hariprasad S <hariprasad@chelsio.com>
      CC: Sathya Perla <sathya.perla@broadcom.com>
      CC: Ajit Khaparde <ajit.khaparde@broadcom.com>
      CC: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
      CC: Somnath Kotur <somnath.kotur@broadcom.com>
      CC: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>
      CC: John Allen <jallen@linux.vnet.ibm.com>
      CC: Guo-Fu Tseng <cooldavid@cooldavid.org>
      CC: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      CC: Jiri Pirko <jiri@mellanox.com>
      CC: Ido Schimmel <idosch@mellanox.com>
      CC: Manish Chopra <manish.chopra@qlogic.com>
      CC: Sony Chacko <sony.chacko@qlogic.com>
      CC: Rajesh Borundia <rajesh.borundia@qlogic.com>
      CC: Timur Tabi <timur@codeaurora.org>
      CC: Anirudha Sarangi <anirudh@xilinx.com>
      CC: John Linn <John.Linn@xilinx.com>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d894be57
    • Wei Yongjun's avatar
      myri10ge: fix typo in parameter description · 1a61a8f1
      Wei Yongjun authored
      Fix typo in parameter description.
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1a61a8f1
    • Wei Yongjun's avatar
      net: ethernet: mediatek: use dev_kfree_skb_any instead of dev_kfree_skb · 81ad2b7d
      Wei Yongjun authored
      Replace dev_kfree_skb with dev_kfree_skb_any in mtk_start_xmit()
      which can be called from hard irq context (netpoll) and from
      other contexts. mtk_start_xmit() only frees skbs that it has
      dropped.
      
      This is detected by Coccinelle semantic patch.
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      81ad2b7d
    • Wei Yongjun's avatar
      dwc_eth_qos: use dev_kfree_skb_any instead of dev_kfree_skb · d80f45ff
      Wei Yongjun authored
      Replace dev_kfree_skb with dev_kfree_skb_any in dwceqos_start_xmit()
      which can be called from hard irq context (netpoll) and from
      other contexts. dwceqos_start_xmit() only frees skbs that it has
      dropped.
      
      This is detected by Coccinelle semantic patch.
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d80f45ff
    • Shaohui Xie's avatar
      net: phy: aquantia: add PHY ID of AQR106 and AQR107 · 547412fe
      Shaohui Xie authored
      The AQR106 and AQR107 can use the existing driver.
      Signed-off-by: default avatarShaohui Xie <Shaohui.Xie@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      547412fe
    • Uwe Kleine-König's avatar
      net: fec: drop check for clk==NULL before calling clk_* · 01e5943a
      Uwe Kleine-König authored
      clk_prepare, clk_enable and their counterparts (at least the common clk
      ones, but also most others) do check for the clk being NULL anyhow (and
      return 0 then), so there is no gain when the caller checks, too.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      01e5943a
    • Eric Dumazet's avatar
      tcp: relax listening_hash operations · 9652dc2e
      Eric Dumazet authored
      softirq handlers use RCU protection to lookup listeners,
      and write operations all happen from process context.
      We do not need to block BH for dump operations.
      
      Also SYN_RECV since request sockets are stored in the ehash table :
      
       1) inet_diag_dump_icsk() no longer need to clear
          cb->args[3] and cb->args[4] that were used as cursors while
          iterating the old per listener hash table.
      
       2) Also factorize a test : No need to scan listening_hash[]
          if r->id.idiag_dport is not zero.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9652dc2e
    • Robert Jarzmik's avatar
      net: smc91x: fix neponset breakage by pxa u16 writes · 25c07e2c
      Robert Jarzmik authored
      The patch isolating the u16 writes for pxa assumed all machine_is_*()
      calls were removed, and therefore removed the mach-types.h include which
      provided them.
      
      Unfortunately 2 machine_is_*() remained in smc91x.c file including
      smc91x.h from which the include was removed, triggering the error:
       drivers/net/ethernet/smsc/smc91x.c: In function ‘smc_drv_probe’:
       drivers/net/ethernet/smsc/smc91x.c:2380:2: error: implicit declaration
       of function ‘machine_is_assabet’
       [-Werror=implicit-function-declaration]
      	if (machine_is_assabet() && machine_has_neponset())
      
      This adds back the wrongly removed include.
      
      Fixes: d09d747a ("net: smc91x: isolate u16 writes alignment workaround")
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      25c07e2c
    • Thomas Graf's avatar
      ila: Fix tailroom allocation of lwtstate · c5098ebb
      Thomas Graf authored
      Tailroom is supposed to be of length sizeof(struct ila_lwt) but
      sizeof(struct ila_params) is currently allocated.
      
      This leads to the dst_cache and connected member of ila_lwt being
      referenced out of bounds.
      
      struct ila_lwt {
      	struct ila_params p;
      	struct dst_cache dst_cache;
      	u32 connected : 1;
      };
      
      Fixes: 65d7ab8d ("net: Identifier Locator Addressing module")
      Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c5098ebb
  2. 19 Oct, 2016 9 commits
  3. 18 Oct, 2016 19 commits
    • Wei Yongjun's avatar
      qed: Remove useless set memory to zero use memset() · 4251e747
      Wei Yongjun authored
      The memory return by kzalloc() has already be set to zero, so
      remove useless memset(0).
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4251e747
    • Wei Yongjun's avatar
      net: dsa: mv88e6xxx: fix non static symbol warning · aa0938c6
      Wei Yongjun authored
      Fixes the following sparse warning:
      
      drivers/net/dsa/mv88e6xxx/chip.c:2866:5: warning:
       symbol 'mv88e6xxx_g1_set_switch_mac' was not declared. Should it be static?
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aa0938c6
    • hayeswang's avatar
      r8152: add new products of Lenovo · d248cafc
      hayeswang authored
      Add the following four products of Lenovo and sort the order of the list.
      
      	VID		PID
      	0x17ef		0x3062
      	0x17ef		0x3069
      	0x17ef		0x720c
      	0x17ef		0x7214
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d248cafc
    • Gao Feng's avatar
      net: vlan: Use sizeof instead of literal number · 9c403b6b
      Gao Feng authored
      Use sizeof variable instead of literal number to enhance the readability.
      Signed-off-by: default avatarGao Feng <fgao@ikuai8.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c403b6b
    • David S. Miller's avatar
      Merge branch 'smc91x-dt' · 7cafb0ba
      David S. Miller authored
      Robert Jarzmik says:
      
      ====================
      support smc91x on mainstone and devicetree
      
      This series aims at bringing support to mainstone board on a
      device-tree based build, as what is already in place for legacy
      mainstone.
      
      The bulk of the mainstone "specific" behavior is that a u16 write
      doesn't work on a address of the form 4*n + 2, while it works on 4*n.
      
      The legacy workaround was in SMC_outw(), with calls to
      machine_is_mainstone(). These calls don't work with a pxa27x-dt
      machine type, which is used when a generic device-tree pxa27x machine
      is used to boot the mainstone board.
      
      Therefore, this series enables the smc91c111 adapter of the mainstone
      board to work on a device-tree build, exaclty as it's been working for
      years with the legacy arch/arm/mach-pxa/mainstone.c definition.
      
      As a sum up, this extends an existing mechanism to device-tree based
      pxa platforms.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7cafb0ba
    • Robert Jarzmik's avatar
      net: smsc91x: add u16 workaround for pxa platforms · c4055a8c
      Robert Jarzmik authored
      Add a workaround for mainstone, idp and stargate2 boards, for u16 writes
      which must be aligned on 32 bits addresses.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Cc: Jeremy Linton <jeremy.linton@arm.com>
      Acked-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c4055a8c
    • Robert Jarzmik's avatar
      net: smc91x: take into account half-word workaround · 9c365f31
      Robert Jarzmik authored
      For device-tree builds, platforms such as mainstone, idp and stargate2
      must have their u16 writes all aligned on 32 bit boundaries. This is
      already enabled in platform data builds, and this patch adds it to
      device-tree builds.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c365f31
    • Robert Jarzmik's avatar
      net: smc91x: isolate u16 writes alignment workaround · d09d747a
      Robert Jarzmik authored
      Writes to u16 has a special handling on 3 PXA platforms, where the
      hardware wiring forces these writes to be u32 aligned.
      
      This patch isolates this handling for PXA platforms as before, but
      enables this "workaround" to be set up dynamically, which will be the
      case in device-tree build types.
      
      This patch was tested on 2 PXA platforms : mainstone, which relies on
      the workaround, and lubbock, which doesn't.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d09d747a
    • Robert Jarzmik's avatar
      ARM: pxa: enhance smc91x platform data · 9a974342
      Robert Jarzmik authored
      Instead of having the smc91x driver relying on machine_is_*() calls,
      provide this data through platform data, ie. idp, mainstone and
      stargate.
      
      This way, the driver doesn't need anymore machine_is_*() calls, which
      wouldn't work anymore with a device-tree build.
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9a974342
    • Bert Kenward's avatar
      ethernet/sfc: use core min/max MTU checking · cd94e519
      Bert Kenward authored
      Fixes: 61e84623 ("net: centralize net_device min/max MTU checking")
      Signed-off-by: default avatarBert Kenward <bkenward@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd94e519
    • David S. Miller's avatar
      Merge branch 'phy-led-triggers' · a8446676
      David S. Miller authored
      Zach Brown says:
      
      ====================
      Add support for led triggers on phy link state change
      
      Fix skge driver that declared enum contants that conflicted with enum
      constants in linux/leds.h
      
      Create function that encapsulates actions taken during the adjust phy link step
      of phy state changes.
      
      Create function that provides list of speeds currently supported by the phy.
      
      Add support for led triggers on phy link state changes by adding
      a config option. When set the config option will create a set of led triggers
      for each phy device. Users can use the led triggers to represent link state
      changes on the phy.
      
      v2:
       * New patch that creates phy_adjust_link function to encapsulate actions taken
         when adjusting phy link during phy state changes
       * led trigger speed strings changed to match existing phy speed strings
       * New function that maps speeds to led triggers
       * Replace magic constants with definitions when declaring trigger name
         buffer and number of triggers.
      v3:
       * Changed LED_ON to LED_REG_ON in skge driver to avoid possible future
         conflict and improve consistency.
       * Dropped rtl8712 patch that was accepted separately.
      v4:
       * tweaked commit message
      v5
       * Changed commit message to explain relationship between the new triggers and
         leds driven by phys.
       * Added new patch that creates phy_supported_speeds function.
       * Moved phy_leds_triggers_register and phy_leds_triggers_unregister to
         phy_attach and phy_detach respectively. This change is so the
         phydev->supported field will be filled by the time the triggers are
         registered.
       * Changed hardcoded list of triggers to dynamic list determined by speeds
         return by phy_supported_speeds.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a8446676
    • Zach Brown's avatar
      net: phy: leds: add support for led triggers on phy link state change · 2e0bc452
      Zach Brown authored
      Create an option CONFIG_LED_TRIGGER_PHY (default n), which will create a
      set of led triggers for each instantiated PHY device. There is one LED
      trigger per link-speed, per-phy.
      The triggers are registered during phy_attach and unregistered during
      phy_detach.
      
      This allows for a user to configure their system to allow a set of LEDs
      not controlled by the phy to represent link state changes on the phy.
      LEDS controlled by the phy are unaffected.
      
      For example, we have a board where some of the leds in the
      RJ45 socket are controlled by the phy, but others are not. Using the
      triggers provided by this patch the leds not controlled by the phy can
      be configured to show the current speed of the ethernet connection. The
      leds controlled by the phy are unaffected.
      Signed-off-by: default avatarJosh Cartwright <josh.cartwright@ni.com>
      Signed-off-by: default avatarNathan Sullivan <nathan.sullivan@ni.com>
      Signed-off-by: default avatarZach Brown <zach.brown@ni.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2e0bc452
    • Zach Brown's avatar
      net: phy: Create phy_supported_speeds function which lists speeds currently... · 1f9127ca
      Zach Brown authored
      net: phy: Create phy_supported_speeds function which lists speeds currently supported by a phydevice
      
      phy_supported_speeds provides a means to get a list of all the speeds a
      phy device currently supports.
      Signed-off-by: default avatarZach Brown <zach.brown@ni.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f9127ca
    • Zach Brown's avatar
      net: phy: Encapsulate actions performed during link state changes into function phy_adjust_link · 61a17965
      Zach Brown authored
      During phy state machine state transitions some set of actions should
      occur whenever the link state changes. These actions should be
      encapsulated into a single function
      
      This patch adds the phy_adjust_link function, which is called whenever
      phydev->adjust_link would have been called before. Actions that should
      occur whenever the phy link is adjusted can now be added to the
      phy_adjust_link function.
      Signed-off-by: default avatarZach Brown <zach.brown@ni.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      61a17965
    • Zach Brown's avatar
      skge: Rename LED_OFF and LED_ON in marvel skge driver to avoid conflicts with leds namespace · 0e0f27dd
      Zach Brown authored
      Adding led support for phy causes namespace conflicts for some
      phy drivers.
      
      The marvel skge driver declared an enum for representing the states of
      Link LED Register. The enum contained constant LED_OFF which conflicted
      with declartation found in linux/leds.h.
      LED_OFF changed to LED_REG_OFF
      Also changed LED_ON to LED_REG_ON to avoid possible future conflict and
      for consistency.
      Signed-off-by: default avatarZach Brown <zach.brown@ni.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0e0f27dd
    • David S. Miller's avatar
      Merge branch 'netdev-adjacency' · 5bb61cb5
      David S. Miller authored
      David Ahern says:
      
      ====================
      net: Fix netdev adjacency tracking
      
      The netdev adjacency tracking is failing to create proper dependencies
      for some topologies. For example this topology
      
              +--------+
              |  myvrf |
              +--------+
                |    |
                |  +---------+
                |  | macvlan |
                |  +---------+
                |    |
            +----------+
            |  bridge  |
            +----------+
                |
            +--------+
            | bond1  |
            +--------+
                |
            +--------+
            |  eth3  |
            +--------+
      
      hits 1 of 2 problems depending on the order of enslavement. The base set of
      commands for both cases:
      
          ip link add bond1 type bond
          ip link set bond1 up
          ip link set eth3 down
          ip link set eth3 master bond1
          ip link set eth3 up
      
          ip link add bridge type bridge
          ip link set bridge up
          ip link add macvlan link bridge type macvlan
          ip link set macvlan up
      
          ip link add myvrf type vrf table 1234
          ip link set myvrf up
      
          ip link set bridge master myvrf
      
      Case 1 enslave macvlan to the vrf before enslaving the bond to the bridge:
      
          ip link set macvlan master myvrf
          ip link set bond1 master bridge
      
      Attempts to delete the VRF:
          ip link delete myvrf
      
      trigger the BUG in __netdev_adjacent_dev_remove:
      
      [  587.405260] tried to remove device eth3 from myvrf
      [  587.407269] ------------[ cut here ]------------
      [  587.408918] kernel BUG at /home/dsa/kernel.git/net/core/dev.c:5661!
      [  587.411113] invalid opcode: 0000 [#1] SMP
      [  587.412454] Modules linked in: macvlan bridge stp llc bonding vrf
      [  587.414765] CPU: 0 PID: 726 Comm: ip Not tainted 4.8.0+ #109
      [  587.416766] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
      [  587.420241] task: ffff88013ab6eec0 task.stack: ffffc90000628000
      [  587.422163] RIP: 0010:[<ffffffff813cef03>]  [<ffffffff813cef03>] __netdev_adjacent_dev_remove+0x40/0x12c
      ...
      [  587.446053] Call Trace:
      [  587.446424]  [<ffffffff813d1542>] __netdev_adjacent_dev_unlink+0x20/0x3c
      [  587.447390]  [<ffffffff813d16a3>] netdev_upper_dev_unlink+0xfa/0x15e
      [  587.448297]  [<ffffffffa00003a3>] vrf_del_slave+0x13/0x2a [vrf]
      [  587.449153]  [<ffffffffa00004a4>] vrf_dev_uninit+0xea/0x114 [vrf]
      [  587.450036]  [<ffffffff813d19b0>] rollback_registered_many+0x22b/0x2da
      [  587.450974]  [<ffffffff813d1aac>] unregister_netdevice_many+0x17/0x48
      [  587.451903]  [<ffffffff813de444>] rtnl_delete_link+0x3c/0x43
      [  587.452719]  [<ffffffff813dedcd>] rtnl_dellink+0x180/0x194
      
      When the BUG is converted to a WARN_ON it shows 4 missing adjacencies:
        eth3 - myvrf, mvrf - eth3, bond1 - myvrf and myvrf - bond1
      
      All of those are because the __netdev_upper_dev_link function does not
      properly link macvlan lower devices to myvrf when it is enslaved.
      
      The second case just flips the ordering of the enslavements:
          ip link set bond1 master bridge
          ip link set macvlan master myvrf
      
      Then run:
          ip link delete bond1
          ip link delete myvrf
      
      The vrf delete command hangs because myvrf has a reference that has not
      been released. In this case the removal code does not account for 2 paths
      between eth3 and myvrf - one from bridge to vrf and the other through the
      macvlan.
      
      Rather than try to maintain a linked list of all upper and lower devices
      per netdevice, only track the direct neighbors. The remaining stack can
      be determined by recursively walking the neighbors.
      
      The existing netdev_for_each_all_upper_dev_rcu,
      netdev_for_each_all_lower_dev and netdev_for_each_all_lower_dev_rcu macros
      are replaced with APIs that walk the upper and lower device lists. The
      new APIs take a callback function and a data arg that is passed to the
      callback for each device in the list. Drivers using the old macros are
      converted in separate patches to make it easier on reviewers. It is an
      API conversion only; no functional change is intended.
      
      v3
      - address Stephen's comment to simplify logic and remove typecasts
      
      v2
      - fixed bond0 references in cover-letter
      - fixed definition of netdev_next_lower_dev_rcu to mirror the upper_dev
        version.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5bb61cb5
    • David Ahern's avatar
      net: dev: Improve debug statements for adjacency tracking · 67b62f98
      David Ahern authored
      Adjacency code only has debugs for the insert case. Add debugs for
      the remove path and make both consistently worded to make it easier
      to follow the insert and removal with reference counts.
      
      In addition, change the BUG to a WARN_ON. A missing adjacency at
      removal time is not cause for a panic.
      Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      67b62f98
    • David Ahern's avatar
      net: Add warning if any lower device is still in adjacency list · 0f524a80
      David Ahern authored
      Lower list should be empty just like upper.
      Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0f524a80
    • David Ahern's avatar
      net: Remove all_adj_list and its references · f1170fd4
      David Ahern authored
      Only direct adjacencies are maintained. All upper or lower devices can
      be learned via the new walk API which recursively walks the adj_list for
      upper devices or lower devices.
      Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f1170fd4