1. May 15, 2020
  2. May 14, 2020
    • 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