1. 12 7月, 2015 2 次提交
  2. 01 6月, 2015 1 次提交
    • F
      net: dsa: Properly propagate errors from dsa_switch_setup_one · 24595346
      Florian Fainelli 提交于
      While shuffling some code around, dsa_switch_setup_one() was introduced,
      and it was modified to return either an error code using ERR_PTR() or a
      NULL pointer when running out of memory or failing to setup a switch.
      
      This is a problem for its caler: dsa_switch_setup() which uses IS_ERR()
      and expects to find an error code, not a NULL pointer, so we still try
      to proceed with dsa_switch_setup() and operate on invalid memory
      addresses. This can be easily reproduced by having e.g: the bcm_sf2
      driver built-in, but having no such switch, such that drv->setup will
      fail.
      
      Fix this by using PTR_ERR() consistently which is both more informative
      and avoids for the caller to use IS_ERR_OR_NULL().
      
      Fixes: df197195 ("net: dsa: split dsa_switch_setup into two functions")
      Reported-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      24595346
  3. 30 4月, 2015 1 次提交
  4. 18 4月, 2015 1 次提交
  5. 07 4月, 2015 1 次提交
    • P
      net: dsa: fix filling routing table from OF description · 30303813
      Pavel Nakonechny 提交于
      According to description in 'include/net/dsa.h', in cascade switches
      configurations where there are more than one interconnected devices,
      'rtable' array in 'dsa_chip_data' structure is used to indicate which
      port on this switch should be used to send packets to that are destined
      for corresponding switch.
      
      However, dsa_of_setup_routing_table() fills 'rtable' with port numbers
      of the _target_ switch, but not current one.
      
      This commit removes redundant devicetree parsing and adds needed port
      number as a function argument. So dsa_of_setup_routing_table() now just
      looks for target switch number by parsing parent of 'link' device node.
      
      To remove possible misunderstandings with the way of determining target
      switch number, a corresponding comment was added to the source code and
      to the DSA device tree bindings documentation file.
      
      This was tested on a custom board with two Marvell 88E6095 switches with
      following corresponding routing tables: { -1, 10 } and { 8, -1 }.
      Signed-off-by: NPavel Nakonechny <pavel.nakonechny@skitlab.ru>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      30303813
  6. 10 3月, 2015 1 次提交
    • F
      net: dsa: utilize of_find_net_device_by_node · 769a0202
      Florian Fainelli 提交于
      Using of_find_device_by_node() restricts the search to platform_device that
      match the specified device_node pointer. This is not even remotely true for
      network devices backed by a pci_device for instance.
      
      of_find_net_device_by_node() allows us to do a more thorough lookup to find the
      struct net_device corresponding to a particular device_node pointer.
      
      For symetry with the non-OF code path, we hold the net_device pointer in
      dsa_probe() just like what dev_to_net_dev() does when we call this
      function.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      769a0202
  7. 06 3月, 2015 5 次提交
  8. 26 2月, 2015 3 次提交
    • G
      net: dsa: Introduce dsa_is_port_initialized · d79d2107
      Guenter Roeck 提交于
      To avoid race conditions when using the ds->ports[] array,
      we need to check if the accessed port has been initialized.
      Introduce and use helper function dsa_is_port_initialized
      for that purpose and use it where needed.
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d79d2107
    • F
      net: dsa: integrate with SWITCHDEV for HW bridging · b73adef6
      Florian Fainelli 提交于
      In order to support bridging offloads in DSA switch drivers, select
      NET_SWITCHDEV to get access to the port_stp_update and parent_get_id
      NDOs that we are required to implement.
      
      To facilitate the integratation at the DSA driver level, we implement 3
      types of operations:
      
      - port_join_bridge
      - port_leave_bridge
      - port_stp_update
      
      DSA will resolve which switch ports that are currently bridge port
      members as some Switch hardware/drivers need to know about that to limit
      the register programming to just the relevant registers (especially for
      slow MDIO buses).
      
      We also take care of setting the correct STP state when slave network
      devices are brought up/down while being bridge members.
      
      Finally, when a port is leaving the bridge, we make sure we set in
      BR_STATE_FORWARDING state, otherwise the bridge layer would leave it
      disabled as a result of having left the bridge.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b73adef6
    • G
      net: dsa: Ensure that port array elements are initialized before being used · d87d6f44
      Guenter Roeck 提交于
      A network device notifier can be called for one or more of the created
      slave devices before all slave devices have been registered. This can
      result in a mismatch between ds->phys_port_mask and the registered devices
      by the time the call is made, and it can result in a slave device being
      added to a bridge before its entry in ds->ports[] has been initialized.
      
      Rework the initialization code to initialize entries in ds->ports[] in
      dsa_slave_create. With this change, dsa_slave_create no longer needs
      to return slave_dev but can return an error code instead.
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d87d6f44
  9. 08 2月, 2015 1 次提交
  10. 17 11月, 2014 2 次提交
  11. 12 11月, 2014 1 次提交
  12. 31 10月, 2014 2 次提交
  13. 29 10月, 2014 1 次提交
  14. 20 10月, 2014 1 次提交
  15. 02 10月, 2014 1 次提交
  16. 23 9月, 2014 1 次提交
  17. 16 9月, 2014 3 次提交
  18. 02 9月, 2014 1 次提交
  19. 28 8月, 2014 5 次提交
    • F
      net: dsa: add Broadcom SF2 switch driver · 246d7f77
      Florian Fainelli 提交于
      Add support for the Broadcom Starfigther 2 switch chip using a DSA
      driver. This switch driver supports the following features:
      
      - configuration of the external switch port interface: MII, RevMII,
        RGMII and RGMII_NO_ID are supported
      - support for the per-port MIB counters
      - support for link interrupts for special ports (e.g: MoCA)
      - powering up/down of switch memories to conserve power when ports are
        unused
      
      Finally, update the compatible property for the DSA core code to match
      our switch top-level compatible node.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      246d7f77
    • F
      net: dsa: allow for more complex PHY setups · 0d8bcdd3
      Florian Fainelli 提交于
      Modify the DSA slave interface to be bound to an arbitray PHY, not just
      the ones that are available as child PHY devices of the switch MDIO bus.
      
      This allows us for instance to have external PHYs connected to a
      separate MDIO bus, but yet also connected to a given switch port.
      
      Under certain configurations, the physical port mask might not be a 1:1
      mapping to the MII PHYs mask. This is the case, if e.g: Port 1 of the
      switch is used and connects to a PHY at a MDIO address different than 1.
      
      Introduce a phys_mii_mask variable which allows driver to implement and
      divert their own MDIO read/writes operations for a subset of the MDIO
      PHY addresses.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0d8bcdd3
    • F
      net: dsa: retain a per-port device_node pointer · bd47497a
      Florian Fainelli 提交于
      We will later use the per-port device_node pointer to fetch a bunch of
      port-specific properties.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bd47497a
    • F
      net: dsa: provide a switch device device tree node pointer · fa981d9a
      Florian Fainelli 提交于
      We might need to fetch additional resources from the device tree node
      pointer, such as register ranges or other properties. Keep a device_node
      pointer around for this.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa981d9a
    • F
      net: dsa: reduce number of protocol hooks · 3e8a72d1
      Florian Fainelli 提交于
      DSA is currently registering one packet_type function per EtherType it
      needs to intercept in the receive path of a DSA-enabled Ethernet device.
      Right now we have three of them: trailer, DSA and eDSA, and there might
      be more in the future, this will not scale to the addition of new
      protocols.
      
      This patch proceeds with adding a new layer of abstraction and two new
      functions:
      
      dsa_switch_rcv() which will dispatch into the tag-protocol specific
      receive function implemented by net/dsa/tag_*.c
      
      dsa_slave_xmit() which will dispatch into the tag-protocol specific
      transmit function implemented by net/dsa/tag_*.c
      
      When we do create the per-port slave network devices, we iterate over
      the switch protocol to assign the DSA-specific receive and transmit
      operations.
      
      A new fake ethertype value is used: ETH_P_XDSA to illustrate the fact
      that this is no longer going to look like ETH_P_DSA or ETH_P_TRAILER
      like it used to be.
      
      This allows us to greatly simplify the check in eth_type_trans() and
      always override the skb->protocol with ETH_P_XDSA for Ethernet switches
      tagged protocol, while also reducing the number repetitive slave
      netdevice_ops assignments.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3e8a72d1
  20. 26 6月, 2014 1 次提交
  21. 17 5月, 2014 1 次提交
  22. 26 3月, 2013 2 次提交
  23. 25 3月, 2013 1 次提交
  24. 22 1月, 2013 1 次提交