1. 28 Feb, 2020 30 commits
  2. 27 Feb, 2020 10 commits
    • Andrew Lunn's avatar
      net: dsa: mv88e6xxx: Fix masking of egress port · 3ee339eb
      Andrew Lunn authored
      Add missing ~ to the usage of the mask.
      Reported-by: default avatarKevin Benson <Kevin.Benson@zii.aero>
      Reported-by: default avatarChris Healy <Chris.Healy@zii.aero>
      Fixes: 5c74c54c ("net: dsa: mv88e6xxx: Split monitor port configuration")
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3ee339eb
    • Amit Cohen's avatar
      mlxsw: pci: Wait longer before accessing the device after reset · ac004e84
      Amit Cohen authored
      During initialization the driver issues a reset to the device and waits
      for 100ms before checking if the firmware is ready. The waiting is
      necessary because before that the device is irresponsive and the first
      read can result in a completion timeout.
      
      While 100ms is sufficient for Spectrum-1 and Spectrum-2, it is
      insufficient for Spectrum-3.
      
      Fix this by increasing the timeout to 200ms.
      
      Fixes: da382875 ("mlxsw: spectrum: Extend to support Spectrum-3 ASIC")
      Signed-off-by: default avatarAmit Cohen <amitc@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ac004e84
    • Jiri Pirko's avatar
      mlxsw: reg: Update module_type values in PMTM register and map them to width · ec4a514a
      Jiri Pirko authored
      There are couple new values that PMTM register can return
      in module_type field. Add them and map them to module width in
      mlxsw_core_module_max_width(). Fix the existing names on the way.
      Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ec4a514a
    • Gustavo A. R. Silva's avatar
      WAN: Replace zero-length array with flexible-array member · 37e1244a
      Gustavo A. R. Silva authored
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      37e1244a
    • Gustavo A. R. Silva's avatar
      NFC: Replace zero-length array with flexible-array member · da60fbe7
      Gustavo A. R. Silva authored
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da60fbe7
    • Alex Maftei (amaftei)'s avatar
      sfc: fix timestamp reconstruction at 16-bit rollover points · 23797b98
      Alex Maftei (amaftei) authored
      We can't just use the top bits of the last sync event as they could be
      off-by-one every 65,536 seconds, giving an error in reconstruction of
      65,536 seconds.
      
      This patch uses the difference in the bottom 16 bits (mod 2^16) to
      calculate an offset that needs to be applied to the last sync event to
      get to the current time.
      Signed-off-by: default avatarAlexandru-Mihai Maftei <amaftei@solarflare.com>
      Acked-by: default avatarMartin Habets <mhabets@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      23797b98
    • Stefano Garzarella's avatar
      vsock: fix potential deadlock in transport->release() · 3f74957f
      Stefano Garzarella authored
      Some transports (hyperv, virtio) acquire the sock lock during the
      .release() callback.
      
      In the vsock_stream_connect() we call vsock_assign_transport(); if
      the socket was previously assigned to another transport, the
      vsk->transport->release() is called, but the sock lock is already
      held in the vsock_stream_connect(), causing a deadlock reported by
      syzbot:
      
          INFO: task syz-executor280:9768 blocked for more than 143 seconds.
            Not tainted 5.6.0-rc1-syzkaller #0
          "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
          syz-executor280 D27912  9768   9766 0x00000000
          Call Trace:
           context_switch kernel/sched/core.c:3386 [inline]
           __schedule+0x934/0x1f90 kernel/sched/core.c:4082
           schedule+0xdc/0x2b0 kernel/sched/core.c:4156
           __lock_sock+0x165/0x290 net/core/sock.c:2413
           lock_sock_nested+0xfe/0x120 net/core/sock.c:2938
           virtio_transport_release+0xc4/0xd60 net/vmw_vsock/virtio_transport_common.c:832
           vsock_assign_transport+0xf3/0x3b0 net/vmw_vsock/af_vsock.c:454
           vsock_stream_connect+0x2b3/0xc70 net/vmw_vsock/af_vsock.c:1288
           __sys_connect_file+0x161/0x1c0 net/socket.c:1857
           __sys_connect+0x174/0x1b0 net/socket.c:1874
           __do_sys_connect net/socket.c:1885 [inline]
           __se_sys_connect net/socket.c:1882 [inline]
           __x64_sys_connect+0x73/0xb0 net/socket.c:1882
           do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
           entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      To avoid this issue, this patch remove the lock acquiring in the
      .release() callback of hyperv and virtio transports, and it holds
      the lock when we call vsk->transport->release() in the vsock core.
      
      Reported-by: syzbot+731710996d79d0d58fbc@syzkaller.appspotmail.com
      Fixes: 408624af ("vsock: use local transport when it is loaded")
      Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f74957f
    • David S. Miller's avatar
      Merge branch 'rework-phylink-interface-for-split-MAC-PCS-support' · 6dd7f1a1
      David S. Miller authored
      Russell King says:
      
      ====================
      rework phylink interface for split MAC/PCS support
      
      The following series changes the phylink interface to allow us to
      better support split MAC / MAC PCS setups.  The fundamental change
      required for this turns out to be quite simple.
      
      Today, mac_config() is used for everything to do with setting the
      parameters for the MAC, and mac_link_up() is used to inform the
      MAC driver that the link is now up (and so to allow packet flow.)
      mac_config() also has had a few implementation issues, with folk
      who believe that members such as "speed" and "duplex" are always
      valid, where "link" gets used inappropriately, etc.
      
      With the proposed patches, all this changes subtly - but in a
      backwards compatible way at this stage.
      
      We pass the the full resolved link state (speed, duplex, pause) to
      mac_link_up(), and it is now guaranteed that these parameters to
      this function will always be valid (no more SPEED_UNKNOWN or
      DUPLEX_UNKNOWN here - unless phylink is fed with such things.)
      
      Drivers should convert over to using the state in mac_link_up()
      rather than configuring the speed, duplex and pause in the
      mac_config() method. The patch series includes a number of MAC
      drivers which I've thought have been easy targets - I've left the
      remainder as I think they need maintainer input. However, *all*
      drivers will need conversion for future phylink development.
      
      v2: add ocelot/felix and qca/ar9331 DSA drivers to patch 2, add
        received tested-by so far.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6dd7f1a1
    • Russell King's avatar
      net: mvpp2: use resolved link config in mac_link_up() · 24cb72df
      Russell King authored
      Convert the Marvell mvpp2 ethernet driver to use the finalised link
      parameters in mac_link_up() rather than the parameters in mac_config().
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24cb72df
    • Russell King's avatar
      net: mvneta: use resolved link config in mac_link_up() · ff03f0b1
      Russell King authored
      Convert the Marvell mvneta ethernet driver to use the finalised link
      parameters in mac_link_up() rather than the parameters in mac_config().
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff03f0b1