1. 05 Jul, 2020 22 commits
    • David S. Miller's avatar
      Merge branch 'Phylink-integration-improvements-for-Felix-DSA-driver' · dbacfd8c
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Phylink integration improvements for Felix DSA driver
      
      This is an overhaul of the Felix switch driver's phylink operations.
      
      Patches 1, 3, 4 and 5 are cleanup, patch 2 is adding a new feature and
      and patch 6 is adaptation to the new format of an existing phylink API
      (mac_link_up).
      
      Changes since v2:
      - Replaced "PHYLINK" with "phylink".
      - Rewrote commit message of patch 5/6.
      
      Changes since v1:
      - Now using phy_clear_bits and phy_set_bits instead of plain writes to
        MII_BMCR. This combines former patches 1/7 and 6/7 into a single new
        patch 1/6.
      - Updated commit message of patch 5/6.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dbacfd8c
    • Vladimir Oltean's avatar
      net: dsa: felix: use resolved link config in mac_link_up() · 7e14a2dc
      Vladimir Oltean authored
      Phylink now requires that parameters established through
      auto-negotiation be written into the MAC at the time of the
      mac_link_up() callback. In the case of felix, that means taking the port
      out of reset, setting the correct timers for PAUSE frames, and
      enabling/disabling TX flow control.
      
      This patch also splits the inband and noinband configuration of the
      vsc9959 PCS (currently found in a function called "init") into 2
      different functions, which have a nomenclature closer to phylink:
      "config", for inband setup, and "link_up", for noinband (forced) setup.
      
      This is necessary as a preparation step for giving up control of the PCS
      to phylink, which will be done in further patch series.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e14a2dc
    • Vladimir Oltean's avatar
      net: dsa: felix: delete .phylink_mac_an_restart code · b4c23545
      Vladimir Oltean authored
      Phylink uses the .mac_an_restart method to offer the user an
      implementation of the "ethtool -r" behavior, when the media-side auto
      negotiation can be restarted by the local MAC PCS. This is the case for
      fiber modes 1000Base-X and 2500Base-X (IEEE clause 37) that don't have
      an Ethernet PHY connected locally, and the media is connected to the MAC
      PCS directly.
      
      On the other hand, the Cisco SGMII and USXGMII standards also have an
      auto negotiation mechanism based on IEEE 802.3 clause 37 (their
      respective specs require a MAC PCS and a PHY PCS to implement the same
      state machine, which is described in IEEE 802.3 "Auto-Negotiation Figure
      37-6"), so the ability to restart auto-negotiation is intrinsically
      symmetrical (the MAC PCS can do it too).
      
      However, it appears that not all SGMII/USXGMII PHYs have logic to
      restart the MDI-side auto-negotiation process when they detect a
      transition of the SGMII link from data mode to configuration mode.
      Some do (VSC8234) and some don't (AR8033, MV88E1111). IEEE and/or Cisco
      specification wordings to not help to prove whether propagating the "AN
      restart" event from MII side ("mr_restart_an") to MDI side
      ("mr_restart_negotiation") is required behavior - neither of them
      specifies any mandatory interaction between the clause 37 AN state
      machine from Figure 37-6 and the clause 28 AN state machine from Figure
      28-18.
      
      Therefore, even if a certain behavior could be proven as being required,
      real-life SGMII/USXGMII PHYs are inconsistent enough that a clause 37 AN
      restart cannot be used by phylink to reliably trigger a media-side
      renegotiation, when the user requests it via ethtool.
      
      The only remaining use that the .mac_an_restart callback might possibly
      have, given what we know now, is to implement some silicon quirks, but
      so far that has proven to not be necessary.
      
      So remove this code for now, since it never gets called and we don't
      foresee any circumstance in which it might be, either.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b4c23545
    • Vladimir Oltean's avatar
      net: dsa: felix: set proper pause frame timers based on link speed · 151a7cee
      Vladimir Oltean authored
      state->speed holds a value of 10, 100, 1000 or 2500, but
      SYS_MAC_FC_CFG_FC_LINK_SPEED expects a value in the range 0, 1, 2 or 3.
      
      So set the correct speed encoding into this register.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      151a7cee
    • Vladimir Oltean's avatar
      net: dsa: felix: unconditionally configure MAC speed to 1000Mbps · da1c4ba1
      Vladimir Oltean authored
      In VSC9959, the PCS is the one who performs rate adaptation (symbol
      duplication) to the speed negotiated by the PHY. The MAC is unaware of
      that and must remain configured for gigabit. If it is configured at
      OCELOT_SPEED_10 or OCELOT_SPEED_100, it'll start transmitting PAUSE
      frames out of control and never recover, _even if_ we then reconfigure
      it at OCELOT_SPEED_1000 afterwards.
      
      This patch fixes a bug that luckily did not have any functional impact.
      We were writing 10, 100, 1000 etc into this 2-bit field in
      DEV_CLOCK_CFG, but the hardware expects values in the range 0, 1, 2, 3.
      So all speed values were getting truncated to 0, which is
      OCELOT_SPEED_2500, and which also appears to be fine.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da1c4ba1
    • Vladimir Oltean's avatar
      net: dsa: felix: support half-duplex link modes · b1c7b874
      Vladimir Oltean authored
      Ping tested:
      
        [   11.808455] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control rx/tx
        [   11.816497] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
      
        [root@LS1028ARDB ~] # ethtool -s swp0 advertise 0x4
        [   18.844591] mscc_felix 0000:00:00.5 swp0: Link is Down
        [   22.048337] mscc_felix 0000:00:00.5 swp0: Link is Up - 100Mbps/Half - flow control off
      
        [root@LS1028ARDB ~] # ip addr add 192.168.1.1/24 dev swp0
      
        [root@LS1028ARDB ~] # ping 192.168.1.2
        PING 192.168.1.2 (192.168.1.2): 56 data bytes
        (...)
        ^C--- 192.168.1.2 ping statistics ---
        3 packets transmitted, 3 packets received, 0% packet loss
        round-trip min/avg/max = 0.383/0.611/1.051 ms
      
        [root@LS1028ARDB ~] # ethtool -s swp0 advertise 0x10
        [  355.637747] mscc_felix 0000:00:00.5 swp0: Link is Down
        [  358.788034] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Half - flow control off
      
        [root@LS1028ARDB ~] # ping 192.168.1.2
        PING 192.168.1.2 (192.168.1.2): 56 data bytes
        (...)
        ^C
        --- 192.168.1.2 ping statistics ---
        16 packets transmitted, 16 packets received, 0% packet loss
        round-trip min/avg/max = 0.301/0.384/1.138 ms
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b1c7b874
    • Vladimir Oltean's avatar
      net: dsa: felix: clarify the intention of writes to MII_BMCR · 3f2628d6
      Vladimir Oltean authored
      The driver appears to write to BMCR_SPEED and BMCR_DUPLEX, fields which
      are read-only, since they are actually configured through the
      vendor-specific IF_MODE (0x14) register.
      
      But the reason we're writing back the read-only values of MII_BMCR is to
      alter these writable fields:
      
      BMCR_RESET
      BMCR_LOOPBACK
      BMCR_ANENABLE
      BMCR_PDOWN
      BMCR_ISOLATE
      BMCR_ANRESTART
      
      In particular, the only field which is really relevant to this driver is
      BMCR_ANENABLE. Clarify that intention by spelling it out, using
      phy_set_bits and phy_clear_bits.
      
      The driver also made a few writes to BMCR_RESET and BMCR_ANRESTART which
      are unnecessary and may temporarily disrupt the link to the PHY. Remove
      them.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f2628d6
    • David S. Miller's avatar
      Merge branch 'qlogic-use-generic-power-management' · e1f04670
      David S. Miller authored
      Vaibhav Gupta says:
      
      ====================
      qlogic: use generic power management
      
      Linux Kernel Mentee: Remove Legacy Power Management.
      
      The purpose of this patch series is to remove legacy power management callbacks
      from qlogic ethernet drivers.
      
      The callbacks performing suspend() and resume() operations are still calling
      pci_save_state(), pci_set_power_state(), etc. and handling the power management
      themselves, which is not recommended.
      
      The conversion requires the removal of the those function calls and change the
      callback definition accordingly and make use of dev_pm_ops structure.
      
      All patches are compile-tested only.
      
      V2: Fix unused variable warning in v1.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e1f04670
    • Vaibhav Gupta's avatar
      qlcninc: use generic power management · 7ada9a5e
      Vaibhav Gupta authored
      With legacy PM, drivers themselves were responsible for managing the
      device's power states and taking care of register states. And they use PCI
      helper functions to do it.
      
      After upgrading to the generic structure, PCI core will take care of
      required tasks and drivers should do only device-specific operations.
      
      .suspend() calls __qlcnic_shutdown, which then calls qlcnic_82xx_shutdown;
      .resume()  calls __qlcnic_resume,   which then calls qlcnic_82xx_resume;
      
      Both ...82xx..() are define in
      drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c and are used only in
      drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c.
      
      Hence upgrade them and remove PCI function calls, like pci_save_state() and
      pci_enable_wake(), inside them
      
      Compile-tested only.
      Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7ada9a5e
    • Vaibhav Gupta's avatar
      netxen_nic: use generic power management · 063ad9bc
      Vaibhav Gupta authored
      With legacy PM, drivers themselves were responsible for managing the
      device's power states and takes care of register states. And they use PCI
      helper functions to do it.
      
      After upgrading to the generic structure, PCI core will take care of
      required tasks and drivers should do only device-specific operations.
      
      In this driver:
      netxen_nic_resume() calls netxen_nic_attach_func() which then invokes PCI
      helper functions like pci_enable_device(), pci_set_power_state() and
      pci_restore_state(). Other function:
       - netxen_io_slot_reset()
      also calls netxen_nic_attach_func().
      
      Also, netxen_io_slot_reset() returns specific value based on the return value
      of netxen_nic_attach_func() as whole. Thus, cannot simply move some piece of
      code from netxen_nic_attach_func() to it.
      
      Hence, define a new function netxen_nic_attach_late_func() to do the tasks
      which has to be done after PCI helper functions have done their job.
      
      Now, netxen_nic_attach_func() invokes netxen_nic_attach_late_func(), thus
      netxen_io_slot_reset() behaves normally.
      And, netxen_nic_resume() calls netxen_nic_attach_late_func() to avoid PCI
      helper functions calls.
      
      Compile-tested only.
      Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      063ad9bc
    • Codrin Ciubotariu's avatar
      net: dsa: microchip: remove unused private members · b20a6b29
      Codrin Ciubotariu authored
      Private structure members live_ports, on_ports, rx_ports, tx_ports are
      initialized but not used anywhere. Let's remove them.
      Suggested-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarCodrin Ciubotariu <codrin.ciubotariu@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b20a6b29
    • Codrin Ciubotariu's avatar
      net: dsa: microchip: split adjust_link() in phylink_mac_link_{up|down}() · 143a102e
      Codrin Ciubotariu authored
      The DSA subsystem moved to phylink and adjust_link() became deprecated in
      the process. This patch removes adjust_link from the KSZ DSA switches and
      adds phylink_mac_link_up() and phylink_mac_link_down().
      Signed-off-by: default avatarCodrin Ciubotariu <codrin.ciubotariu@microchip.com>
      Reviewed-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      143a102e
    • David S. Miller's avatar
      Merge branch 'mptcp-add-REUSEADDR-REUSEPORT-V6ONLY-setsockopt-support' · bdd2ed27
      David S. Miller authored
      Florian Westphal says:
      
      ====================
      mptcp: add REUSEADDR/REUSEPORT/V6ONLY setsockopt support
      
      restarting an mptcp-patched sshd yields following error:
      
        sshd: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
        sshd: error: setsockopt IPV6_V6ONLY: Operation not supported
        sshd: error: Bind to port 22 on :: failed: Address already in use.
        sshd: fatal: Cannot bind any address.
      
      This series adds support for the needed setsockopts:
      
      First patch skips the generic SOL_SOCKET handler for MPTCP:
      in mptcp case, the setsockopt needs to alter the tcp socket, not the mptcp
      parent socket.
      
      Second patch adds minimal SOL_SOCKET support: REUSEPORT and REUSEADDR.
      Rest is still handled by the generic SOL_SOCKET code.
      
      Last patch adds IPV6ONLY support.  This makes ipv6 work for openssh:
      It creates two listening sockets, before this patch, binding the ipv6
      socket will fail because the port is already bound by the ipv4 one.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bdd2ed27
    • Florian Westphal's avatar
      mptcp: support IPV6_V6ONLY setsockopt · c9b95a13
      Florian Westphal authored
      Without this, Opensshd fails to open an ipv6 socket listening
      socket:
        error: setsockopt IPV6_V6ONLY: Operation not supported
        error: Bind to port 22 on :: failed: Address already in use.
      
      Opensshd opens an ipv4 and and ipv6 listening socket, but because
      IPV6_V6ONLY setsockopt fails, the port number is already in use.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c9b95a13
    • Florian Westphal's avatar
      mptcp: add REUSEADDR/REUSEPORT support · fd1452d8
      Florian Westphal authored
      This will e.g. make 'sshd restart' work when MPTCP is used, as we will
      now set this option on the listener socket instead of only the mptcp
      socket (where it has no effect).
      
      We still need to copy the setting to the master socket so that a
      subsequent getsockopt() returns the expected value.
      Reported-by: default avatarChristoph Paasch <cpaasch@apple.com>
      Suggested-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd1452d8
    • Florian Westphal's avatar
      net: use mptcp setsockopt function for SOL_SOCKET on mptcp sockets · 83f0c10b
      Florian Westphal authored
      setsockopt(mptcp_fd, SOL_SOCKET, ...)...  appears to work (returns 0),
      but it has no effect -- this is because the MPTCP layer never has a
      chance to copy the settings to the subflow socket.
      
      Skip the generic handling for the mptcp case and instead call the
      mptcp specific handler instead for SOL_SOCKET too.
      
      Next patch adds more specific handling for SOL_SOCKET to mptcp.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      83f0c10b
    • Tanner Love's avatar
      selftests/net: update initializer syntax to use c99 designators · f551e2fd
      Tanner Love authored
      Before, clang version 9 threw errors such as: error:
      use of GNU old-style field designator extension [-Werror,-Wgnu-designator]
                      { tstamp: true, swtstamp: true }
                        ^~~~~~~
                        .tstamp =
      Fix these warnings in tools/testing/selftests/net in the same manner as
      commit 121e357a ("selftests/harness: Update named initializer syntax").
      N.B. rxtimestamp.c is the only affected file in the directory.
      Signed-off-by: default avatarTanner Love <tannerlove@google.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f551e2fd
    • David S. Miller's avatar
      Merge branch 'bnx2x-Perform-IdleChk-dump' · 565f499c
      David S. Miller authored
      Sudarsana Reddy Kalluru says:
      
      ====================
      bnx2x: Perform IdleChk dump.
      
      Idlechk test verifies that the chip is in idle state. If there are any
      errors, Idlechk dump would capture the same. This data will help in
      debugging the device related issues.
      The patch series adds driver support for dumping IdleChk data during the
      debug dump collection.
      Patch (1) adds register definitions required in this implementation.
      Patch (2) adds the implementation for Idlechk tests.
      Patch (3) adds driver changes to invoke Idlechk implementation.
      
      Changes from previous version:
      -------------------------------
      v3: Combined the test data creation and implementation to a single patch.
      v2: Addressed issues reported by kernel test robot.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      565f499c
    • Sudarsana Reddy Kalluru's avatar
      bnx2x: Perform Idlechk dump during the debug collection. · a4666570
      Sudarsana Reddy Kalluru authored
      The patch adds driver changes to perform Idlechk dump during the debug
      data collection.
      Signed-off-by: default avatarSudarsana Reddy Kalluru <skalluru@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4666570
    • Sudarsana Reddy Kalluru's avatar
      bnx2x: Add support for idlechk tests. · cdf711f2
      Sudarsana Reddy Kalluru authored
      This patch populates a database of idlechk tests (registers and
      predicates) and performs the idlechk using this data.
      Signed-off-by: default avatarSudarsana Reddy Kalluru <skalluru@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cdf711f2
    • Sudarsana Reddy Kalluru's avatar
      bnx2x: Add Idlechk related register definitions. · 4365f35b
      Sudarsana Reddy Kalluru authored
      The patch adds register definitions required for Idlechk implementation.
      Signed-off-by: default avatarSudarsana Reddy Kalluru <skalluru@marvell.com>
      Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4365f35b
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · f91c031e
      David S. Miller authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2020-07-04
      
      The following pull-request contains BPF updates for your *net-next* tree.
      
      We've added 73 non-merge commits during the last 17 day(s) which contain
      a total of 106 files changed, 5233 insertions(+), 1283 deletions(-).
      
      The main changes are:
      
      1) bpftool ability to show PIDs of processes having open file descriptors
         for BPF map/program/link/BTF objects, relying on BPF iterator progs
         to extract this info efficiently, from Andrii Nakryiko.
      
      2) Addition of BPF iterator progs for dumping TCP and UDP sockets to
         seq_files, from Yonghong Song.
      
      3) Support access to BPF map fields in struct bpf_map from programs
         through BTF struct access, from Andrey Ignatov.
      
      4) Add a bpf_get_task_stack() helper to be able to dump /proc/*/stack
         via seq_file from BPF iterator progs, from Song Liu.
      
      5) Make SO_KEEPALIVE and related options available to bpf_setsockopt()
         helper, from Dmitry Yakunin.
      
      6) Optimize BPF sk_storage selection of its caching index, from Martin
         KaFai Lau.
      
      7) Removal of redundant synchronize_rcu()s from BPF map destruction which
         has been a historic leftover, from Alexei Starovoitov.
      
      8) Several improvements to test_progs to make it easier to create a shell
         loop that invokes each test individually which is useful for some CIs,
         from Jesper Dangaard Brouer.
      
      9) Fix bpftool prog dump segfault when compiled without skeleton code on
         older clang versions, from John Fastabend.
      
      10) Bunch of cleanups and minor improvements, from various others.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f91c031e
  2. 03 Jul, 2020 18 commits