1. 09 2月, 2019 3 次提交
    • R
      net: marvell: mvpp2: only reprogram what is necessary on mac_config · d14e078f
      Russell King 提交于
      mac_config() can be called at any point, and the expected behaviour
      from MAC drivers is to only reprogram when necessary - and certainly
      avoid taking the link down on every call.
      
      Unfortunately, mvpp2 does exactly that - it takes the link down, and
      reprograms everything, and then releases the forced-link down.
      
      This is bad, it can cause the link to bounce:
      
      - SFP detects signal, disables LOS indication.
      - SFP code calls into phylink, calling phylink_sfp_link_up() which
        triggers a resolve.
      - phylink_resolve() calls phylink_get_mac_state() and finds the MAC
        reporting link up.
      - phylink wants to configure the pause mode on the MAC, so calls
        phylink_mac_config()
      - mvpp2 takes the link down temporarily, generating a MAC link down
        event followed by another MAC link event.
      - phylink calls mac_link_up() and then processes the MAC link down
        event.
      - phylink_resolve() gets called again, registers the link down, and
        calls mach_link_down() before re-running itself.
      - phylink_resolve() starts again at step 3 above.  This sequence
        repeats.
      
      GMAC versions prior to mvpp2 do not require the link to be taken down
      except when certain link properties (eg, switching between SGMII and
      1000base-X mode, or enabling/disabling in-band negotiation) are
      changed.  Implement this for mvpp2.
      Tested-by: NSven Auhagen <sven.auhagen@voleatech.de>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d14e078f
    • R
      net: marvell: mvpp2: fix stuck in-band SGMII negotiation · 316734fd
      Russell King 提交于
      It appears that the mvpp22 can get stuck with SGMII negotiation.  The
      symptoms are that in-band negotiation never completes and the partner
      (eg, PHY) never reports SGMII link up, or if it supports negotiation
      bypass, goes into negotiation bypass mode (which will happen when the
      PHY sees that the MAC is alive but gets no response.)
      
      Triggering the PHY end of the link to re-negotiate results in the
      bypass bit clearing on the PHY, and then re-setting - indicating that
      the problem is at the mvpp22 GMAC end.
      
      Asserting the GMAC reset and de-asserting it resolves the issue.
      Arrange to assert the GMAC reset at probe time, and deassert it only
      after we have configured the GMAC for the appropriate mode.  This
      resolves the issue.
      Tested-by: NSven Auhagen <sven.auhagen@voleatech.de>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      316734fd
    • R
      net: marvell: mvpp2: phylink compliance updates · 388ca27f
      Russell King 提交于
      Sven Auhagen reported issues with negotiation on a couple of his
      platforms using a mixture of SFP and PHYs in various different
      modes.  Debugging to root cause proved difficult, but essentially
      the problem comes down to the mvpp2 phylink implementation being
      slightly at odds with what is expected.
      
      phylink operates in three modes: phy, fixed-link, and in-band mode.
      
      In the first two modes, the expected behaviour from a MAC driver is
      that phylink resolves the operating mode and passes the mode to the
      MAC driver for it to program, including when the link should be
      brought up or taken down.  This is basically the same as the libphy
      approach.  This does not negate the requirement to advertise a correct
      control word for interface modes that have control words where that
      can be reasonably controlled.
      
      The second mode is in-band mode, where the MAC is expected to use the
      in-band control word to determine the operating mode.
      
      The mvneta driver implements the correct pattern required to support
      this: configure the port interface type separately from the in-band
      mode(s).  This is now specified in the phylink documentation patches.
      
      mvpp2 was programming in-band mode for SGMII and the 802.3z modes no
      what, and avoided forcing the link up in fixed/phy modes.  This caused
      a problem with some boards where the PHY is by default programmed to
      enter AN bypass mode, the PHY would report that the link was up, but
      the mvpp2 never completed the exchange of control word.
      
      Another issue that mvpp2 has is it sets SGMII AN format control word
      for both SGMII and 802.3z modes. The format of the control word is
      defined by MVPP2_GMAC_INBAND_AN_MASK, which should be set for SGMII
      and clear for 802.3z. Available Marvell documentation for earlier
      GMAC implementations does not make this clear, but this has been
      ascertained via extensive testing on earlier GMAC implementations,
      and then confirmed with a Macchiatobin Single Shot connected to a
      Clearfog: when MVPP2_GMAC_INBAND_AN_MASK is set, the clearfog does
      not receive the advertised pause mode settings.
      
      Lastly, there is no flow control in the in-band control word in Cisco
      SGMII, setting the flow control autonegotiation bit even with a PHY
      that has the Marvell extension to send this information does not result
      in the flow control being enabled at the MAC.  We need to do this
      manually using the information provided via phylink.
      
      Re-code mvpp2's mac_config() and mac_link_up() to follow this pattern.
      This allows Sven Auhagen's board and Macchiatobin to reliably bring
      the link up with the 88e1512 PHY with phylink operating in PHY mode
      with COMPHY built as a module but the rest of the networking built-in,
      and u-boot having brought up the interface.  in-band mode requires an
      additional patch to resolve another problem.
      Tested-by: NSven Auhagen <sven.auhagen@voleatech.de>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      388ca27f
  2. 06 2月, 2019 2 次提交
    • R
      net: marvell: mvpp2: fix lack of link interrupts · bf2fa125
      Russell King 提交于
      Sven Auhagen reports that if he changes a SFP+ module for a SFP module
      on the Macchiatobin Single Shot, the link does not come back up.  For
      Sven, it is as easy as:
      
      - Insert a SFP+ module connected, and use ping6 to verify link is up.
      - Remove SFP+ module
      - Insert SFP 1000base-X module use ping6 to verify link is up: Link
        up event did not trigger and the link is down
      
      but that doesn't show the problem for me.  Locally, this has been
      reproduced by:
      
      - Boot with no modules.
      - Insert SFP+ module, confirm link is up.
      - Replace module with 25000base-X module.  Confirm link is up.
      - Set remote end down, link is reported as dropped at both ends.
      - Set remote end up, link is reported up at remote end, but not local
        end due to lack of link interrupt.
      
      Fix this by setting up both GMAC and XLG interrupts for port 0, but
      only unmasking the appropriate interrupt according to the current mode
      set in the mac_config() method.  However, only do the mask/unmask
      dance when we are really changing the link mode to avoid missing any
      link interrupts.
      Tested-by: NSven Auhagen <sven.auhagen@voleatech.de>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bf2fa125
    • R
      net: marvell: mvpp2: use phy_interface_mode_is_8023z() helper · 4a4cec72
      Russell King 提交于
      Use the phy_interface_mode_is_8023z() helper for detecting interface
      modes that use 802.3z serial encoding.  This is equivalent to testing
      for both 1000base-X and 2500base-X.
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4a4cec72
  3. 08 1月, 2019 1 次提交
  4. 28 12月, 2018 1 次提交
  5. 20 12月, 2018 1 次提交
  6. 19 12月, 2018 1 次提交
  7. 12 12月, 2018 1 次提交
  8. 05 12月, 2018 2 次提交
  9. 31 10月, 2018 1 次提交
    • M
      net: mvpp2: Fix affinity hint allocation · a6b3a3fa
      Marc Zyngier 提交于
      The mvpp2 driver has the curious behaviour of passing a stack variable
      to irq_set_affinity_hint(), which results in the kernel exploding
      the first time anyone accesses this information. News flash: userspace
      does, and irqbalance will happily take the machine down. Great stuff.
      
      An easy fix is to track the mask within the queue_vector structure,
      and to make sure it has the same lifetime as the interrupt itself.
      
      Fixes: e531f767 ("net: mvpp2: handle cases where more CPUs are available than s/w threads")
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a6b3a3fa
  10. 06 10月, 2018 1 次提交
  11. 25 9月, 2018 2 次提交
  12. 20 9月, 2018 12 次提交
  13. 19 9月, 2018 1 次提交
  14. 17 9月, 2018 1 次提交
    • A
      net: mvpp2: let phylink manage the carrier state · 41948ccb
      Antoine Tenart 提交于
      Net drivers using phylink shouldn't mess with the link carrier
      themselves and should let phylink manage it. The mvpp2 driver wasn't
      following this best practice as the mac_config() function made calls to
      change the link carrier state. This led to wrongly reported carrier link
      state which then triggered other issues. This patch fixes this
      behaviour.
      
      But the PPv2 driver relied on this misbehaviour in two cases: for fixed
      links and when not using phylink (ACPI mode). The later was fixed by
      adding an explicit call to link_up(), which when the ACPI mode will use
      phylink should be removed.
      
      The fixed link case was relying on the mac_config() function to set the
      link up, as we found an issue in phylink_start() which assumes the
      carrier is off. If not, the link_up() function is never called. To fix
      this, a call to netif_carrier_off() is added just before phylink_start()
      so that we do not introduce a regression in the driver.
      
      Fixes: 4bb04326 ("net: mvpp2: phylink support")
      Reported-by: NRussell King <linux@armlinux.org.uk>
      Signed-off-by: NAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      41948ccb
  15. 30 8月, 2018 1 次提交
    • B
      net: mvpp2: initialize port of_node pointer · c4053ef3
      Baruch Siach 提交于
      Without a valid of_node in struct device we can't find the mvpp2 port
      device by its DT node. Specifically, this breaks
      of_find_net_device_by_node().
      
      For example, the Armada 8040 based Clearfog GT-8K uses Marvell 88E6141
      switch connected to the &cp1_eth2 port:
      
      &cp1_mdio {
      	...
      
      	switch0: switch0@4 {
      		compatible = "marvell,mv88e6085";
      		...
      
      		ports {
      			...
      
      			port@5 {
      				reg = <5>;
      				label = "cpu";
      				ethernet = <&cp1_eth2>;
      			};
      		};
      	};
      };
      
      Without this patch, dsa_register_switch() returns -EPROBE_DEFER because
      of_find_net_device_by_node() can't find the device_node of the &cp1_eth2
      device.
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NBaruch Siach <baruch@tkos.co.il>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c4053ef3
  16. 16 7月, 2018 2 次提交
    • M
      net: mvpp2: add a debugfs interface for the Header Parser · 21da57a2
      Maxime Chevallier 提交于
      Marvell PPv2 Packer Header Parser has a TCAM based filter, that is not
      trivial to configure and debug. Being able to dump TCAM entries from
      userspace can be really helpful to help development of new features
      and debug existing ones.
      
      This commit adds a basic debugfs interface for the PPv2 driver, focusing
      on TCAM related features.
      
      <mnt>/mvpp2/ --- f2000000.ethernet
                    \- f4000000.ethernet --- parser --- 000 ...
                                          |          \- 001
                                          |          \- ...
                                          |          \- 255 --- ai
                                          |                  \- header_data
                                          |                  \- lookup_id
                                          |                  \- sram
                                          |                  \- valid
                                          \- eth1 ...
                                          \- eth2 --- mac_filter
                                                   \- parser_entries
                                                   \- vid_filter
      
      There's one directory per PPv2 instance, named after pdev->name to make
      sure names are uniques. In each of these directories, there's :
      
       - one directory per interface on the controller, each containing :
      
         - "mac_filter", which lists all filtered addresses for this port
           (based on TCAM, not on the kernel's uc / mc lists)
      
         - "parser_entries", which lists the indices of all valid TCAM
            entries that have this port in their port map
      
         - "vid_filter", which lists the vids allowed on this port, based on
           TCAM
      
       - one "parser" directory (the parser is common to all ports), containing :
      
         - one directory per TCAM entry (256 of them, from 0 to 255), each
           containing :
      
           - "ai" : Contains the 1 byte Additional Info field from TCAM, and
      
           - "header_data" : Contains the 8 bytes Header Data extracted from
             the packet
      
           - "lookup_id" : Contains the 4 bits LU_ID
      
           - "sram" : contains the raw SRAM data, which is the result of the TCAM
      		lookup. This readonly at the moment.
      
           - "valid" : Indicates if the entry is valid of not.
      
      All entries are read-only, and everything is output in hex form.
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      21da57a2
    • A
      net: mvpp2: switch to SPDX identifiers · f1e37e31
      Antoine Tenart 提交于
      Use the appropriate SPDX license identifiers and drop the license text.
      This patch is only cosmetic.
      Signed-off-by: NAntoine Tenart <antoine.tenart@bootlin.com>
      Signed-off-by: NMaxime Chevallier <maxime.chevallier@bootlin.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f1e37e31
  17. 13 7月, 2018 7 次提交