1. 11 May, 2018 16 commits
    • William Tu's avatar
      erspan: auto detect truncated ipv6 packets. · d5db21a3
      William Tu authored
      Currently the truncated bit is set only when 1) the mirrored packet
      is larger than mtu and 2) the ipv4 packet tot_len is larger than
      the actual skb->len.  This patch adds another case for detecting
      whether ipv6 packet is truncated or not, by checking the ipv6 header
      payload_len and the skb->len.
      Reported-by: default avatarXiaoyan Jin <xiaoyanj@vmware.com>
      Signed-off-by: default avatarWilliam Tu <u9012063@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d5db21a3
    • David S. Miller's avatar
      Merge branch 'mlxsw-spectrum_span-Two-minor-adjustments' · 755bbc1c
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      mlxsw: spectrum_span: Two minor adjustments
      
      Petr says:
      
      This patch set fixes a couple of nits in mlxsw's SPAN implementation:
      two counts of inaccurate variable name and one count of unsuitable error
      code, fixed, respectively, in patches #1 and #2.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      755bbc1c
    • Petr Machata's avatar
      mlxsw: spectrum_span: Use a more fitting error code · c41c0dd7
      Petr Machata authored
      ENOENT is suitable when an item is looked for in a collection and can't
      be found. The failure here is actually a depletion of a resource, where
      ENOBUFS is the more fitting error code.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c41c0dd7
    • Petr Machata's avatar
      mlxsw: spectrum_span: Rename misnamed variable l3edev · fc74ecbc
      Petr Machata authored
      Calling the variable l3edev was relevant when neighbor lookup was the
      last stage in the simulated pipeline. Now that mlxsw handles bridges and
      vlan devices as well, calling it "L3" is a misnomer.
      
      Thus in mlxsw_sp_span_dmac(), rename to "dev", because that function is
      just a service routine where the distinction between tunnel and egress
      device isn't necessary.
      
      In mlxsw_sp_span_entry_tunnel_parms_common(), rename to "edev" to
      emphasize that the routine traces packet egress.
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fc74ecbc
    • Eric Dumazet's avatar
      udp: avoid refcount_t saturation in __udp_gso_segment() · 575b65bc
      Eric Dumazet authored
      For some reason, Willem thought that the issue we fixed for TCP
      in commit 7ec318fe ("tcp: gso: avoid refcount_t warning from
      tcp_gso_segment()") was not relevant for UDP GSO.
      
      But syzbot found its way.
      
      refcount_t: saturated; leaking memory.
      WARNING: CPU: 0 PID: 10261 at lib/refcount.c:78 refcount_add_not_zero+0x2d4/0x320 lib/refcount.c:78
      Kernel panic - not syncing: panic_on_warn set ...
      
      CPU: 0 PID: 10261 Comm: syz-executor5 Not tainted 4.17.0-rc3+ #38
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x1b9/0x294 lib/dump_stack.c:113
       panic+0x22f/0x4de kernel/panic.c:184
       __warn.cold.8+0x163/0x1b3 kernel/panic.c:536
       report_bug+0x252/0x2d0 lib/bug.c:186
       fixup_bug arch/x86/kernel/traps.c:178 [inline]
       do_error_trap+0x1de/0x490 arch/x86/kernel/traps.c:296
       do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
       invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:992
      RIP: 0010:refcount_add_not_zero+0x2d4/0x320 lib/refcount.c:78
      RSP: 0018:ffff880196db6b90 EFLAGS: 00010282
      RAX: 0000000000000026 RBX: 00000000ffffff01 RCX: ffffc900040d9000
      RDX: 0000000000004a29 RSI: ffffffff8160f6f1 RDI: ffff880196db66f0
      RBP: ffff880196db6c78 R08: ffff8801b33d6740 R09: 0000000000000002
      R10: ffff8801b33d6740 R11: 0000000000000000 R12: 0000000000000000
      R13: 00000000ffffffff R14: ffff880196db6c50 R15: 0000000000020101
       refcount_add+0x1b/0x70 lib/refcount.c:102
       __udp_gso_segment+0xaa5/0xee0 net/ipv4/udp_offload.c:272
       udp4_ufo_fragment+0x592/0x7a0 net/ipv4/udp_offload.c:301
       inet_gso_segment+0x639/0x12b0 net/ipv4/af_inet.c:1342
       skb_mac_gso_segment+0x3ad/0x720 net/core/dev.c:2792
       __skb_gso_segment+0x3bb/0x870 net/core/dev.c:2865
       skb_gso_segment include/linux/netdevice.h:4050 [inline]
       validate_xmit_skb+0x54d/0xd90 net/core/dev.c:3122
       __dev_queue_xmit+0xbf8/0x34c0 net/core/dev.c:3579
       dev_queue_xmit+0x17/0x20 net/core/dev.c:3620
       neigh_direct_output+0x15/0x20 net/core/neighbour.c:1401
       neigh_output include/net/neighbour.h:483 [inline]
       ip_finish_output2+0xa5f/0x1840 net/ipv4/ip_output.c:229
       ip_finish_output+0x828/0xf80 net/ipv4/ip_output.c:317
       NF_HOOK_COND include/linux/netfilter.h:277 [inline]
       ip_output+0x21b/0x850 net/ipv4/ip_output.c:405
       dst_output include/net/dst.h:444 [inline]
       ip_local_out+0xc5/0x1b0 net/ipv4/ip_output.c:124
       ip_send_skb+0x40/0xe0 net/ipv4/ip_output.c:1434
       udp_send_skb.isra.37+0x5eb/0x1000 net/ipv4/udp.c:825
       udp_push_pending_frames+0x5c/0xf0 net/ipv4/udp.c:853
       udp_v6_push_pending_frames+0x380/0x3e0 net/ipv6/udp.c:1105
       udp_lib_setsockopt+0x59a/0x600 net/ipv4/udp.c:2403
       udpv6_setsockopt+0x95/0xa0 net/ipv6/udp.c:1447
       sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:3046
       __sys_setsockopt+0x1bd/0x390 net/socket.c:1903
       __do_sys_setsockopt net/socket.c:1914 [inline]
       __se_sys_setsockopt net/socket.c:1911 [inline]
       __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1911
       do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: ad405857 ("udp: better wmem accounting on gso")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Cc: Alexander Duyck <alexander.h.duyck@intel.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      575b65bc
    • Eric Dumazet's avatar
      tcp: switch pacing timer to softirq based hrtimer · 73a6bab5
      Eric Dumazet authored
      linux-4.16 got support for softirq based hrtimers.
      TCP can switch its pacing hrtimer to this variant, since this
      avoids going through a tasklet and some atomic operations.
      
      pacing timer logic looks like other (jiffies based) tcp timers.
      
      v2: use hrtimer_try_to_cancel() in tcp_clear_xmit_timers()
          to correctly release reference on socket if needed.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      73a6bab5
    • David S. Miller's avatar
      Merge branch 'dsa-Plug-in-PHYLINK-support' · 4cbd7a7d
      David S. Miller authored
      Florian Fainelli says:
      
      ====================
      net: dsa: Plug in PHYLINK support
      
      This patch series adds PHYLINK support to DSA which is necessary to support more
      complex PHY and pluggable modules setups.
      
      Patch series can be found here:
      
      https://github.com/ffainelli/linux/commits/dsa-phylink-v2
      
      This was tested on:
      
      - dsa-loop
      - bcm_sf2
      - mv88e6xxx
      - b53
      
      With a variety of test cases:
      - internal & external MDIO PHYs
      - MoCA with link notification through interrupt/MMIO register
      - built-in PHYs
      - ifconfig up/down for several cycles works
      - bind/unbind of the drivers
      
      Changes in v2:
      
      - fixed link configuration for mv88e6xxx (Andrew) after introducing polling
      
      This is technically v2 of what was posted back in March 2018, changes from last
      time:
      
      - fixed probe/remove of drivers
      - fixed missing gpiod_put() for link GPIOs
      - fixed polling of link GPIOs (Russell I would need your SoB on the patch you
        provided offline initially, added some modifications to it)
      - tested across a wider set of platforms
      
      And everything should still work as expected. Please be aware of the following:
      
      - switch drivers (like bcm_sf2) which may have user-facing network ports using
        fixed links would need to implement phylink_mac_ops to remain functional.
        PHYLINK does not create a phy_device for fixed links, therefore our
        call to adjust_link() from phylink_mac_link_{up,down} would not be calling
        into the driver. This *should not* affect CPU/DSA ports which are configured
        through adjust_link() but have no network devices
      
      - support for SFP/SFF is now possible, but switch drivers will still need some
        modifications to properly support those, including, but not limited to using
        the correct binding information. This will be submitted on top of this series
      
      Please do test on your respective platforms/switches and let me know if you
      find any issues, hopefully everything still works like before.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4cbd7a7d
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: Get rid of PHYLIB functions · 58d56fcc
      Florian Fainelli authored
      Now that we have converted the bcm_sf2 driver to implement PHYLINK MAC
      operations, we can remove the PHYLIB callbacks: adjust_link() and
      fixed_link_update() which are no longer called by DSA.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      58d56fcc
    • Florian Fainelli's avatar
      net: dsa: Plug in PHYLINK support · aab9c406
      Florian Fainelli authored
      Add support for PHYLINK within the DSA subsystem in order to support more
      complex devices such as pluggable (SFP) and non-pluggable (SFF) modules, 10G
      PHYs, and traditional PHYs. Using PHYLINK allows us to drop some amount of
      complexity we had while probing fixed and non-fixed PHYs using Device Tree.
      
      Because PHYLINK separates the Ethernet MAC/port configuration into different
      stages, we let switch drivers implement those, and for now, we maintain
      functionality by calling dsa_slave_adjust_link() during
      phylink_mac_link_{up,down} which provides semantically equivalent steps.
      
      Drivers willing to take advantage of PHYLINK should implement the phylink_mac_*
      operations that DSA wraps.
      
      We cannot quite remove the adjust_link() callback just yet, because a number of
      drivers rely on that for configuring their "CPU" and "DSA" ports, this is done
      dsa_port_setup_phy_of() and dsa_port_fixed_link_register_of() still.
      
      Drivers that utilize fixed links for user-facing ports (e.g: bcm_sf2) will need
      to implement phylink_mac_ops from now on to preserve functionality, since PHYLINK
      *does not* create a phy_device instance for fixed links.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aab9c406
    • Russell King's avatar
      net: dsa: mv88e6xxx: add PHYLINK support · c9a2356f
      Russell King authored
      Add rudimentary phylink support to mv88e6xxx. This allows the driver
      using user ports with fixed links to keep operating normally. User ports
      with normal PHYs are not affected since the switch automatically manages
      their link parameters. User facing ports which use a SFP/SFF with a
      non-fixed link mode might require a call to phylink_mac_change() to
      operate properly.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      [Andrew: fixed link setting after adding link polling]
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      [florian: expand commit message]
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c9a2356f
    • Florian Fainelli's avatar
      net: dsa: Eliminate dsa_slave_get_link() · c4aef9fc
      Florian Fainelli authored
      Since we use PHYLIB to manage the per-port link indication, this will
      also be reflected correctly in the network device's carrier state, so we
      can use ethtool_op_get_link() instead.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c4aef9fc
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: Implement phylink_mac_ops · bc0cb653
      Florian Fainelli authored
      Make the bcm_sf2 driver implement phylink_mac_ops since it needs to
      support a wide variety of network interfaces: internal & external MDIO
      PHYs, fixed PHYs, MoCA with MMIO link status.
      
      A large amount of what needs to be done already exists under
      bcm_sf2_sw_adjust_link() so we are essentially breaking this down into
      the necessary operation for PHYLINK to work: mac_config, mac_link_up,
      mac_link_down and validate. We can now entirely get rid of most of what
      fixed_link_update() provided because only the link information is actually
      necessary. We still have to force DUPLEX_FULL for legacy Device Tree bindings
      that did not specify that before.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bc0cb653
    • Florian Fainelli's avatar
      net: dsa: Add PHYLINK switch operations · 11d8f3dd
      Florian Fainelli authored
      In preparation for adding support for PHYLINK within DSA, define a number of
      operations that we will need and that switch drivers can start implementing.
      Proper integration with PHYLINK will follow in subsequent patches.
      
      We start selecting PHYLINK (which implies PHYLIB) in net/dsa/Kconfig
      such that drivers can be guaranteed that this dependency is properly
      taken care of and can start referencing PHYLINK helper functions without
      requiring stubs or anything.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11d8f3dd
    • Russell King's avatar
      net: phy: phylink: Poll link GPIOs · 9cd00a8a
      Russell King authored
      When using a fixed link with a link GPIO, we need to poll that GPIO to
      determine link state changes. This is consistent with what fixed_phy.c does.
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9cd00a8a
    • Florian Fainelli's avatar
      net: phy: phylink: Release link GPIO · daab3349
      Florian Fainelli authored
      We are not releasing the link GPIO descriptor with gpiod_put() which results in
      subsequent probing to get -EBUSY when calling fwnode_get_named_gpiod(). Fix this
      by doing the release in phylink_destroy().
      
      Fixes: 9525ae83 ("phylink: add phylink infrastructure")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      daab3349
    • Florian Fainelli's avatar
      net: phy: phylink: Use gpiod_get_value_cansleep() · bb322a90
      Florian Fainelli authored
      The GPIO provider for the link GPIO line might require the use of the
      _cansleep() API, utilize that. This is safe to do since we run in workqueue
      context.
      
      Fixes: 9525ae83 ("phylink: add phylink infrastructure")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bb322a90
  2. 10 May, 2018 24 commits