1. 15 May, 2020 10 commits
    • Colin Ian King's avatar
      net: dsa: felix: fix incorrect clamp calculation for burst · b014d043
      Colin Ian King authored
      Currently burst is clamping on rate and not burst, the assignment
      of burst from the clamping discards the previous assignment of burst.
      This looks like a cut-n-paste error from the previous clamping
      calculation on ramp.  Fix this by replacing ramp with burst.
      
      Addresses-Coverity: ("Unused value")
      Fixes: 0fbabf87 ("net: dsa: felix: add support Credit Based Shaper(CBS) for hardware offload")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b014d043
    • Bartosz Golaszewski's avatar
      net: phy: mdio-moxart: remove unneeded include · 140ad6c8
      Bartosz Golaszewski authored
      mdio-moxart doesn't use regulators in the driver code. We can remove
      the regulator include.
      Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      140ad6c8
    • Dan Murphy's avatar
      dt-bindings: dp83867: Convert DP83867 to yaml · 74ac28f1
      Dan Murphy authored
      Convert the dp83867 binding to yaml.
      Signed-off-by: default avatarDan Murphy <dmurphy@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      74ac28f1
    • Dan Murphy's avatar
      dt-bindings: net: dp83869: Update licensing info · e90b651e
      Dan Murphy authored
      Add BSD 2 Clause to the licensing.
      
      CC: Rob Herring <robh@kernel.org>
      Signed-off-by: default avatarDan Murphy <dmurphy@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e90b651e
    • Luo bin's avatar
      hinic: update huawei ethernet driver maintainer · 3f044d26
      Luo bin authored
      update huawei ethernet driver maintainer from aviad to Bin luo
      Signed-off-by: default avatarLuo bin <luobin9@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3f044d26
    • Luo bin's avatar
      hinic: add set_ringparam ethtool_ops support · bcab6782
      Luo bin authored
      support to change TX/RX queue depth with ethtool -G
      Signed-off-by: default avatarLuo bin <luobin9@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bcab6782
    • Jakub Kicinski's avatar
      devlink: refactor end checks in devlink_nl_cmd_region_read_dumpit · 5a46b062
      Jakub Kicinski authored
      Clean up after recent fixes, move address calculations
      around and change the variable init, so that we can have
      just one start_offset == end_offset check.
      
      Make the check a little stricter to preserve the -EINVAL
      error if requested start offset is larger than the region
      itself.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a46b062
    • David S. Miller's avatar
      Merge branch 'am65-cpsw-add-taprio-EST-offload-support' · c7ad3657
      David S. Miller authored
      Murali Karicheri says:
      
      ====================
      am65-cpsw: add taprio/EST offload support
      
      AM65 CPSW h/w supports Enhanced Scheduled Traffic (EST – defined
      in P802.1Qbv/D2.2 that later got included in IEEE 802.1Q-2018)
      configuration. EST allows express queue traffic to be scheduled
      (placed) on the wire at specific repeatable time intervals. In
      Linux kernel, EST configuration is done through tc command and
      the taprio scheduler in the net core implements a software only
      scheduler (SCH_TAPRIO). If the NIC is capable of EST configuration,
      user indicate "flag 2" in the command which is then parsed by
      taprio scheduler in net core and indicate that the command is to
      be offloaded to h/w. taprio then offloads the command to the
      driver by calling ndo_setup_tc() ndo ops. This patch implements
      ndo_setup_tc() as well as other changes required to offload EST
      configuration to CPSW h/w
      
      For more details please refer patch 2/2.
      
      This series is based on original work done by Ivan Khoronzhuk
      <ivan.khoronzhuk@linaro.org> to add taprio offload support to
      AM65 CPSW 2G.
      
      1. Example configuration 3 Gates
      
      ifconfig eth0 down
      ethtool -L eth0 tx 3
      
      ethtool --set-priv-flags eth0 p0-rx-ptype-rrobin off
      
      ifconfig eth0 192.168.2.20
      
      tc qdisc replace dev eth0 parent root handle 100 taprio \
          num_tc 3 \
          map 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 0 \
          queues 1@0 1@1 1@2 \
          base-time 0000 \
          sched-entry S 4 125000 \
          sched-entry S 2 125000 \
          sched-entry S 1 250000 \
          flags 2
      
      2. Example configuration 8 Gates
      
      ifconfig eth0 down
      ethtool -L eth0 tx 8
      
      ethtool --set-priv-flags eth0 p0-rx-ptype-rrobin off
      
      ifconfig eth0 192.168.2.20
      
      tc qdisc replace dev eth0 parent root handle 100 taprio \
          num_tc 8 \
          map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 \
          queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \
          base-time 0000 \
          sched-entry S 80 125000 \
          sched-entry S 40 125000 \
          sched-entry S 20 125000 \
          sched-entry S 10 125000 \
          sched-entry S 08 125000 \
          sched-entry S 04 125000 \
          sched-entry S 02 125000 \
          sched-entry S 01 125000 \
          flags 2
      
      Classify frames to particular priority using skbedit so that they land at
      a specific queue in cpsw h/w which is Gated by the EST gate which opens based
      on the sched-entry.
      
      tc qdisc add dev eth0 clsact
      
      In the below for example an iperf3 session with destination port 5007
      will go through Q7.
      
      tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5007 0xffff action skbedit priority 7
      
      tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5006 0xffff action skbedit priority 6
      tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5005 0xffff action skbedit priority 5
      tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5004 0xffff action skbedit priority 4
      tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5003 0xffff action skbedit priority 3
      tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5002 0xffff action skbedit priority 2
      tc filter add dev eth0 egress protocol ip prio 1 u32 match ip dport 5001 0xffff action skbedit priority 1
      
      iperf3 -c 192.168.2.10 -u -l1470 -b32M -t1 -p 5007
      
      Testing was done by capturing frames at the PC using wireshark and checking for
      the bust interval or cycle time of UDP frames with a specific port number.
      Verified that the distance between first frame of a burst (cycle-time) is 1
      milli second and burst duration is within 125 usec based on the received packet
      timestamp shown in wireshark packet display.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c7ad3657
    • Ivan Khoronzhuk's avatar
      ethernet: ti: am65-cpsw-qos: add TAPRIO offload support · 8127224c
      Ivan Khoronzhuk authored
      AM65 CPSW h/w supports Enhanced Scheduled Traffic (EST – defined
      in P802.1Qbv/D2.2 that later got included in IEEE 802.1Q-2018)
      configuration. EST allows express queue traffic to be scheduled
      (placed) on the wire at specific repeatable time intervals. In
      Linux kernel, EST configuration is done through tc command and
      the taprio scheduler in the net core implements a software only
      scheduler (SCH_TAPRIO). If the NIC is capable of EST configuration,
      user indicate "flag 2" in the command which is then parsed by
      taprio scheduler in net core and indicate that the command is to
      be offloaded to h/w. taprio then offloads the command to the
      driver by calling ndo_setup_tc() ndo ops. This patch implements
      ndo_setup_tc() to offload EST configuration to CPSW h/w.
      
      Currently driver supports only SetGateStates operation. EST
      operates on a repeating time interval generated by the CPTS EST
      function generator. Each Ethernet port has a global EST fetch
      RAM that can be configured as 2 buffers, each of 64 locations
      or one large buffer of 128 locations. In 2 buffer configuration,
      a ping pong mechanism is used to hold the active schedule (oper)
      in one buffer and new (admin) command in the other. Each 22-bit
      fetch command consists of a 14-bit fetch count (14 MSB’s) and an
      8-bit priority fetch allow (8 LSB’s) that will be applied for the
      fetch count time in wireside clocks. Driver process each of the
      sched-entry in the offload command and update the fetch RAM.
      Driver configures duration in sched-entry into the fetch count
      and Gate mask into the priority fetch bits of the RAM. Then
      configures the CPTS EST function generator to activate the
      schedule. Currently driver supports only 2 buffer configuration
      which means driver supports a max cycle time of ~8 msec.
      
      CPSW supports a configurable number of priority queues (up to 8)
      and needs to be switched to this mode from the default round
      robin mode before EST can be offloaded. User configures
      these through ethtool commands (-L for changing number of
      queues and --set-priv-flags to disable round robin mode).
      Driver doesn't enable EST if pf_p0_rx_ptype_rrobin privat flag
      is set. The flag is common for all ports, and so can't be just
      overridden by taprio configuration w/o user involvement.
      Command fails if pf_p0_rx_ptype_rrobin is already set in the
      driver.
      
      Scheds (commands) configuration depends on interface speed so
      driver translates the duration to the fetch count based on
      link speed. Each schedule can be constructed with several
      command entries in fetch RAM  depending on interval. For example
      if each sched has timer interval < ~130us on 1000 Mb link then
      each sched consumes one command and have 1:1 mapping. When
      Ethernet link goes down, driver purge the configuration if link
      is down for more than 1 second.
      
      The patch allows to update the timer and scheds memory only if it's
      really needed, and skip cases required the user to stop timer by
      configuring only shceds memory.
      Signed-off-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8127224c
    • Ivan Khoronzhuk's avatar
      ethernet: ti: am65-cpts: add routines to support taprio offload · ec008fa2
      Ivan Khoronzhuk authored
      TAPRIO/EST offload support in CPSW2G requires EST scheduler
      function enabled in CPTS. So this patch add a function to
      set cycle time for EST scheduler.  It also add a function for
      getting time in ns of PHC clock for taprio qdisc configuration.
      Mostly to verify if timer update is needed or to get actual
      state of oper/admin schedule.
      Signed-off-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ec008fa2
  2. 14 May, 2020 20 commits
  3. 13 May, 2020 10 commits
    • DENG Qingfang's avatar
      net: dsa: mt7530: set CPU port to fallback mode · 38152ea3
      DENG Qingfang authored
      Currently, setting a bridge's self PVID to other value and deleting
      the default VID 1 renders untagged ports of that VLAN unable to talk to
      the CPU port:
      
      	bridge vlan add dev br0 vid 2 pvid untagged self
      	bridge vlan del dev br0 vid 1 self
      	bridge vlan add dev sw0p0 vid 2 pvid untagged
      	bridge vlan del dev sw0p0 vid 1
      	# br0 cannot send untagged frames out of sw0p0 anymore
      
      That is because the CPU port is set to security mode and its PVID is
      still 1, and untagged frames are dropped due to VLAN member violation.
      
      Set the CPU port to fallback mode so untagged frames can pass through.
      
      Fixes: 83163f7d ("net: dsa: mediatek: add VLAN support for MT7530")
      Signed-off-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      38152ea3
    • Daniel González Cabanelas's avatar
      net: mvneta: speed down the PHY, if WoL used, to save energy · 5e3768a4
      Daniel González Cabanelas authored
      Some PHYs connected to this ethernet hardware support the WoL feature.
      But when WoL is enabled and the machine is powered off, the PHY remains
      waiting for a magic packet at max speed (i.e. 1Gbps), which is a waste of
      energy.
      
      Slow down the PHY speed before stopping the ethernet if WoL is enabled,
      and save some energy while the machine is powered off or sleeping.
      
      Tested using an Armada 370 based board (LS421DE) equipped with a Marvell
      88E1518 PHY.
      Signed-off-by: default avatarDaniel González Cabanelas <dgcbueu@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5e3768a4
    • Colin Ian King's avatar
      sfc: fix dereference of table before it is null checked · 6545be82
      Colin Ian King authored
      Currently pointer table is being dereferenced on a null check of
      table->must_restore_filters before it is being null checked, leading
      to a potential null pointer dereference issue.  Fix this by null
      checking table before dereferencing it when checking for a null
      table->must_restore_filters.
      
      Addresses-Coverity: ("Dereference before null check")
      Fixes: e4fe938c ("sfc: move 'must restore' flags out of ef10-specific nic_data")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Acked-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6545be82
    • Michael Walle's avatar
      net: phy: at803x: add cable diagnostics support · 6cb75767
      Michael Walle authored
      The AR8031/AR8033 and the AR8035 support cable diagnostics. Adding
      driver support is straightforward, so lets add it.
      
      The PHY just do one pair at a time, so we have to start the test four
      times. The cable_test_get_status() can block and therefore we can just
      busy poll the test completion and continue with the next pair until we
      are done.
      The time delta counter seems to run at 125MHz which just gives us a
      resolution of about 82.4cm per tick.
      
      100m cable, A/B/C/D open:
        Cable test started for device eth0.
        Cable test completed for device eth0.
        Pair: Pair A, result: Open Circuit
        Pair: Pair A, fault length: 107.94m
        Pair: Pair B, result: Open Circuit
        Pair: Pair B, fault length: 104.64m
        Pair: Pair C, result: Open Circuit
        Pair: Pair C, fault length: 105.47m
        Pair: Pair D, result: Open Circuit
        Pair: Pair D, fault length: 107.94m
      
      1m cable, A/B connected, C shorted, D open:
        Cable test started for device eth0.
        Cable test completed for device eth0.
        Pair: Pair A, result: OK
        Pair: Pair B, result: OK
        Pair: Pair C, result: Short within Pair
        Pair: Pair C, fault length: 0.82m
        Pair: Pair D, result: Open Circuit
        Pair: Pair D, fault length: 0.82m
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6cb75767
    • Christoph Hellwig's avatar
      ipv6: set msg_control_is_user in do_ipv6_getsockopt · 1b2f08df
      Christoph Hellwig authored
      While do_ipv6_getsockopt does not call the high-level recvmsg helper,
      the msghdr eventually ends up being passed to put_cmsg anyway, and thus
      needs msg_control_is_user set to the proper value.
      
      Fixes: 1f466e1f ("net: cleanly handle kernel vs user buffers for ->msg_control")
      Reported-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1b2f08df
    • David S. Miller's avatar
      Merge branch 'net-phy-broadcom-cable-tester-support' · 87f785e9
      David S. Miller authored
      Michael Walle says:
      
      ====================
      net: phy: broadcom: cable tester support
      
      Add cable tester support for the Broadcom PHYs. Support for it was
      developed on a BCM54140 Quad PHY which RDB register access.
      
      If there is a link partner the results are not as good as with an open
      cable. I guess we could retry if the measurement until all pairs had at
      least one valid result.
      
      changes since v1:
       - added Reviewed-by: tags
       - removed "div by 2" for cross shorts, just mention it in the commit
         message. The results are inconclusive if the tests are repeated. So
         just report the length as is for now.
       - fixed typo in commit message
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      87f785e9
    • Michael Walle's avatar
      net: phy: bcm54140: add cable diagnostics support · f956af3f
      Michael Walle authored
      Use the generic cable tester functions from bcm-phy-lib to add cable
      tester support.
      
      100m cable, A/B/C/D open:
        Cable test started for device eth0.
        Cable test completed for device eth0.
        Pair: Pair A, result: Open Circuit
        Pair: Pair B, result: Open Circuit
        Pair: Pair C, result: Open Circuit
        Pair: Pair D, result: Open Circuit
        Pair: Pair A, fault length: 106.60m
        Pair: Pair B, fault length: 103.32m
        Pair: Pair C, fault length: 104.96m
        Pair: Pair D, fault length: 106.60m
      
      1m cable, A/B connected, pair C shorted, D open:
        Cable test started for device eth0.
        Cable test completed for device eth0.
        Pair: Pair A, result: OK
        Pair: Pair B, result: OK
        Pair: Pair C, result: Short within Pair
        Pair: Pair D, result: Open Circuit
        Pair: Pair C, fault length: 0.82m
        Pair: Pair D, fault length: 1.64m
      
      1m cable, A/B connected, pair C shorted with D:
        Cable test started for device eth0.
        Cable test completed for device eth0.
        Pair: Pair A, result: OK
        Pair: Pair B, result: OK
        Pair: Pair C, result: Short to another pair
        Pair: Pair D, result: Short to another pair
        Pair: Pair C, fault length: 1.64m
        Pair: Pair D, fault length: 1.64m
      
      The granularity of the length measurement seems to be 82cm.
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f956af3f
    • Michael Walle's avatar
      net: phy: broadcom: add cable test support · 11ecf8c5
      Michael Walle authored
      Most modern broadcom PHYs support ECD (enhanced cable diagnostics). Add
      support for it in the bcm-phy-lib so they can easily be used in the PHY
      driver.
      
      There are two access methods for ECD: legacy by expansion registers and
      via the new RDB registers which are exclusive. Provide functions in two
      variants where the PHY driver can choose from. To keep things simple for
      now, we just switch the register access to expansion registers in the
      RDB variant for now. On the flipside, we have to keep a bus lock to
      prevent any other non-legacy access on the PHY.
      
      The results of the intra-pair tests are inconclusive (at least for the
      BCM54140). Most of the times half the length is reported but sometimes
      the length is correct.
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      11ecf8c5
    • Michael Walle's avatar
      net: phy: broadcom: add bcm_phy_modify_exp() · e184a907
      Michael Walle authored
      Add the convenience function to do a read-modify-write. This has the
      additional benefit of saving one write to the selection register.
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e184a907
    • Michael Walle's avatar
      net: phy: broadcom: add exp register access methods without buslock · 7d7e7bce
      Michael Walle authored
      Add helper to read and write expansion registers without taking the mdio
      lock.
      
      Please note, that this changes the semantics of the read and write.
      Before there was no lock between selecting the expansion register and
      the actual read/write. This may lead to access failures if there are
      parallel accesses. Instead take the bus lock during the whole access
      cycle.
      Signed-off-by: default avatarMichael Walle <michael@walle.cc>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d7e7bce