1. 24 Jul, 2020 32 commits
  2. 23 Jul, 2020 8 commits
    • Vladimir Oltean's avatar
      net: dsa: stop overriding master's ndo_get_phys_port_name · 5df5661a
      Vladimir Oltean authored
      The purpose of this override is to give the user an indication of what
      the number of the CPU port is (in DSA, the CPU port is a hardware
      implementation detail and not a network interface capable of traffic).
      
      However, it has always failed (by design) at providing this information
      to the user in a reliable fashion.
      
      Prior to commit 3369afba ("net: Call into DSA netdevice_ops
      wrappers"), the behavior was to only override this callback if it was
      not provided by the DSA master.
      
      That was its first failure: if the DSA master itself was a DSA port or a
      switchdev, then the user would not see the number of the CPU port in
      /sys/class/net/eth0/phys_port_name, but the number of the DSA master
      port within its respective physical switch.
      
      But that was actually ok in a way. The commit mentioned above changed
      that behavior, and now overrides the master's ndo_get_phys_port_name
      unconditionally. That comes with problems of its own, which are worse in
      a way.
      
      The idea is that it's typical for switchdev users to have udev rules for
      consistent interface naming. These are based, among other things, on
      the phys_port_name attribute. If we let the DSA switch at the bottom
      to start randomly overriding ndo_get_phys_port_name with its own CPU
      port, we basically lose any predictability in interface naming, or even
      uniqueness, for that matter.
      
      So, there are reasons to let DSA override the master's callback (to
      provide a consistent interface, a number which has a clear meaning and
      must not be interpreted according to context), and there are reasons to
      not let DSA override it (it breaks udev matching for the DSA master).
      
      But, there is an alternative method for users to retrieve the number of
      the CPU port of each DSA switch in the system:
      
        $ devlink port
        pci/0000:00:00.5/0: type eth netdev swp0 flavour physical port 0
        pci/0000:00:00.5/2: type eth netdev swp2 flavour physical port 2
        pci/0000:00:00.5/4: type notset flavour cpu port 4
        spi/spi2.0/0: type eth netdev sw0p0 flavour physical port 0
        spi/spi2.0/1: type eth netdev sw0p1 flavour physical port 1
        spi/spi2.0/2: type eth netdev sw0p2 flavour physical port 2
        spi/spi2.0/4: type notset flavour cpu port 4
        spi/spi2.1/0: type eth netdev sw1p0 flavour physical port 0
        spi/spi2.1/1: type eth netdev sw1p1 flavour physical port 1
        spi/spi2.1/2: type eth netdev sw1p2 flavour physical port 2
        spi/spi2.1/3: type eth netdev sw1p3 flavour physical port 3
        spi/spi2.1/4: type notset flavour cpu port 4
      
      So remove this duplicated, unreliable and troublesome method. From this
      patch on, the phys_port_name attribute of the DSA master will only
      contain information about itself (if at all). If the users need reliable
      information about the CPU port they're probably using devlink anyway.
      Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Acked-by: default avatarflorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5df5661a
    • Vishal Kulkarni's avatar
      cxgb4: add loopback ethtool self-test · 7235ffae
      Vishal Kulkarni authored
      In this test, loopback pkt is created and sent on default queue.
      The packet goes until the Multi Port Switch (MPS) just before
      the MAC and based on the specified channel number, it either
      goes outside the wire on one of the physical ports or looped
      back to Rx path by MPS. In this case, we're specifying loopback
      channel, instead of physical ports, so the packet gets looped
      back to Rx path, instead of getting transmitted on the wire.
      
      v3:
      - Modify commit message to include test details.
      v2:
      - Add only loopback self-test.
      Signed-off-by: default avatarVishal Kulkarni <vishal@chelsio.com>
      Acked-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7235ffae
    • David S. Miller's avatar
      Merge branch 'l2tp-further-checkpatch-pl-cleanups' · 15be4ea3
      David S. Miller authored
      Tom Parkin says:
      
      ====================
      l2tp: further checkpatch.pl cleanups
      
      l2tp hasn't been kept up to date with the static analysis checks offered
      by checkpatch.pl.
      
      This patchset builds on the series "l2tp: cleanup checkpatch.pl
      warnings".  It includes small refactoring changes which improve code
      quality and resolve a subset of the checkpatch warnings for the l2tp
      codebase.
      ====================
      Reviewed-by: default avatarJames Chapman <jchapman@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      15be4ea3
    • Tom Parkin's avatar
      l2tp: cleanup kzalloc calls · 70c05bfa
      Tom Parkin authored
      Passing "sizeof(struct blah)" in kzalloc calls is less readable,
      potentially prone to future bugs if the type of the pointer is changed,
      and triggers checkpatch warnings.
      
      Tweak the kzalloc calls in l2tp which use this form to avoid the
      warning.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      70c05bfa
    • Tom Parkin's avatar
      l2tp: cleanup netlink tunnel create address handling · 0787840d
      Tom Parkin authored
      When creating an L2TP tunnel using the netlink API, userspace must
      either pass a socket FD for the tunnel to use (for managed tunnels),
      or specify the tunnel source/destination address (for unmanaged
      tunnels).
      
      Since source/destination addresses may be AF_INET or AF_INET6, the l2tp
      netlink code has conditionally compiled blocks to support IPv6.
      
      Rather than embedding these directly into l2tp_nl_cmd_tunnel_create
      (where it makes the code difficult to read and confuses checkpatch to
      boot) split the handling of address-related attributes into a separate
      function.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0787840d
    • Tom Parkin's avatar
      l2tp: cleanup netlink send of tunnel address information · 584ca31f
      Tom Parkin authored
      l2tp_nl_tunnel_send has conditionally compiled code to support AF_INET6,
      which makes the code difficult to follow and triggers checkpatch
      warnings.
      
      Split the code out into functions to handle the AF_INET v.s. AF_INET6
      cases, which both improves readability and resolves the checkpatch
      warnings.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      584ca31f
    • Tom Parkin's avatar
      l2tp: check socket address type in l2tp_dfs_seq_tunnel_show · 26d9a271
      Tom Parkin authored
      checkpatch warns about indentation and brace balancing around the
      conditionally compiled code for AF_INET6 support in
      l2tp_dfs_seq_tunnel_show.
      
      By adding another check on the socket address type we can make the code
      more readable while removing the checkpatch warning.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      26d9a271
    • Tom Parkin's avatar
      l2tp: cleanup unnecessary braces in if statements · 6c0ec37b
      Tom Parkin authored
      These checks are all simple and don't benefit from extra braces to
      clarify intent.  Remove them for easier-reading code.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6c0ec37b