Lines Matching full:switch
5 This document describes the **Distributed Switch Architecture (DSA)** subsystem
13 The Distributed Switch Architecture subsystem was primarily designed to
19 they configured/queried a switch port network device or a regular network
22 An Ethernet switch typically comprises multiple front-panel ports and one
25 receiving Ethernet frames from the switch. This is a very common setup for all
34 of multiple switches connected to each other is called a "switch tree".
41 The ideal case for using DSA is when an Ethernet switch supports a "switch tag"
42 which is a hardware feature making the switch insert a specific tag for each
57 - the "cpu" port is the Ethernet switch facing side of the management
69 Switch tagging protocols
86 1. The switch-specific frame header is located before the Ethernet header,
89 2. The switch-specific frame header is located before the EtherType, keeping
92 3. The switch-specific frame header is located at the tail of the packet,
96 A tagging protocol may tag all packets with switch tags of the same length, or
98 require an extended switch tag, or there might be one tag length on TX and a
101 with the length in octets of the longest switch frame header/trailer. The DSA
107 that the act of pushing the switch tag on transmission of a packet does not
115 characteristics of the interaction required between the switch hardware and the
121 switch tree use the same tagging protocol. In case of a packet transiting a
122 fabric with more than one switch, the switch-specific frame header is inserted
123 by the first switch in the fabric that the packet was received on. This header
128 other switches from the same fabric, and in this case, the outermost switch
132 by a leaf switch (not connected directly to the CPU) is not the same as what
133 the network stack sees. This can be seen with Marvell switch trees, where the
137 It still remains the case that, if the DSA switch tree is configured for the
140 because the Marvell switch connected directly to the CPU is configured to
146 no DSA links in this fabric, and each switch constitutes a disjoint DSA switch
148 port of the upstream DSA switch) and a CPU port (the in-facing port of the
149 downstream DSA switch).
151 The tagging protocol of the attached DSA switch tree can be viewed through the
156 If the hardware and driver are capable, the tagging protocol of the DSA switch
159 all attached switch ports must be down while doing this).
165 regardless of the driver used for the switch control path, and the driver used
173 The job of this method is to prepare the skb in a way that the switch will
187 switch port that the packet was received on.
211 already expect the switch tag in use, the checksum must be calculated before any
214 when the tag gets stripped by the switch during transmission, it will leave an
234 Ethernet switch.
241 switch specific tagging protocol. DSA accomplishes this by registering a
270 -> invoke switch tag specific protocol handler in 'net/dsa/tag_*.c'
274 - inspect and strip switch tag protocol to determine originating port
287 controlling and data-flowing end-point for each front-panel port of the switch.
290 - insert/remove the switch tag protocol (if it exists) when sending traffic
291 to/from specific switch ports
292 - query the switch for ethtool operations: statistics, link state,
298 stack/ethtool and the switch driver implementation.
301 switch tagging protocol is currently registered with these network devices and
303 switch tag in the Ethernet frames.
306 ``ndo_start_xmit()`` function. Since they contain the appropriate switch tag, the
307 Ethernet switch will be able to process these incoming frames from the
308 management interface and deliver them to the physical switch port.
322 towards the switch.
338 | DSA switch driver |
342 switch driver | | switch driver
351 switch hardware | | switch hardware
354 | Switch |
362 In order to be able to read to/from a switch PHY built into it, DSA creates an
363 user MDIO bus which allows a specific switch driver to divert and intercept
366 to return standard MII registers from the switch builtin PHYs, allowing the PHY
372 internal or external MDIO devices this switch might be connected to: internal
381 - ``dsa_chip_data``: platform data configuration for a given switch device,
382 this structure describes a switch device's parent device, its address, as
388 the conduit network device this switch tree is attached to needs to be
393 the tagging protocol supported by the switch tree, and which receive/transmit
395 switch is also provided: CPU port. Finally, a collection of dsa_switch are
398 - ``dsa_switch``: structure describing a switch device in the tree, referencing
414 - inability to fetch switch CPU port statistics counters using ethtool, which
415 can make it harder to debug MDIO switch connected using xMII interfaces
427 non-NULL), and the switch behind it expects a tagging protocol, this network
430 will not make us go through the switch tagging protocol transmit function, so
431 the Ethernet switch on the other end, expecting a tag will typically drop this
451 - internal PHY devices, built into the Ethernet switch hardware
469 - finally, if the PHY is built into the switch, as is very common with
470 standalone switch packages, the PHY is probed using the user MII bus created
485 DSA registers one devlink device per physical switch in the fabric.
524 DSA switch drivers need to implement a ``dsa_switch_ops`` structure which will
534 Switch registration from the perspective of a driver means passing a valid
536 switch driver's probing function. The following members must be valid in the
539 - ``ds->dev``: will be used to parse the switch's OF node or platform data.
541 - ``ds->num_ports``: will be used to create the port list for this switch, and
568 Internally, DSA keeps an array of switch trees (group of switches) global to
570 The tree ID to which the switch is attached is determined by the first u32
571 number of the ``dsa,member`` property of the switch's OF node (0 if missing).
572 The switch ID within the tree is determined by the second u32 number of the
574 switch ID and tree ID is illegal and will cause an error. Using platform data,
575 a single switch and a single switch tree is permitted.
580 associated switch (``dp->ds``). Then, these switches exit their
584 the last switch calls ``dsa_register_switch()``, and this triggers the effective
587 switch's probe function.
590 which removes a switch's ports from the port list of the tree. The entire tree
591 is torn down when the first switch unregisters.
593 It is mandatory for DSA switch drivers to implement the ``shutdown()`` callback
611 Switch configuration
618 upstream switch, in case there are hardware limitations in terms of supported
627 - ``setup``: setup function for the switch, this function is responsible for setting
630 configure the switch to separate all network interfaces from each other, that
631 is, they should be isolated by the switch hardware itself, typically by creating
634 platform should be disabled. Past this function, the switch is expected to be
636 to issue a software reset of the switch during this setup function in order to
647 PHY cannot be found. In this case, probing of the DSA switch continues
673 on its own (e.g.: coming from switch memory mapped registers), this function
674 should return a 32-bit bitmask of "flags" that is private between the switch
678 the switch port MDIO registers. If unavailable, return 0xffff for each read.
679 For builtin switch Ethernet PHYs, this function should allow reading the link
683 to the switch port MDIO registers. If unavailable return a negative error
688 configuring the switch port link parameters: speed, duplex, pause based on
692 the fixed PHY driver asking the switch driver for link parameters that could
706 RX/TX counters from the network device, with switch driver specific statistics
718 - ``set_eee``: ethtool function which is used to configure a switch port EEE (Green
720 PHY level if relevant. This function should enable EEE at the switch port MAC
723 - ``get_eee``: ethtool function which is used to query a switch port EEE settings,
724 this function should return the EEE state of the switch port MAC controller
728 - ``get_eeprom_len``: ethtool function returning for a given switch the EEPROM
731 - ``get_eeprom``: ethtool function returning for a given switch the EEPROM contents
733 - ``set_eeprom``: ethtool function writing specified data to a given switch EEPROM
736 switch
738 - ``get_regs``: ethtool function returning the Ethernet switch internal register
746 suspend, should quiesce all Ethernet switch activities, but keep ports
751 should resume all Ethernet switch activities and re-configure the switch to be
756 fully enable a given switch port. DSA takes care of marking the port with
762 fully disable a given switch port. DSA takes care of marking the port with
822 Switch drivers which satisfy certain criteria are able to optimize the naive
823 configuration by removing the CPU port from the flooding domain of the switch,
847 present in the same bridge as some DSA switch ports. These are also
851 bridge as some DSA switch ports, only if ``ds->assisted_learning_on_cpu_port``
882 Note that it is not mandatory for a switch driver to implement physically
915 ingress switch port. DSA, through ``dsa_port_devlink_setup()``, considers all
916 switch ports part of the same tree ID to be part of the same bridge forwarding
943 - ``port_bridge_join``: bridge layer function invoked when a given switch port is
944 added to a bridge, this function should do what's necessary at the switch
950 - ``port_bridge_leave``: bridge layer function invoked when a given switch port is
952 switch level to deny the leaving port from ingress/egress traffic from the
955 - ``port_stp_state_set``: bridge layer function invoked when a given switch port STP
956 state is computed by the bridge layer and should be propagated to switch
961 learning. The switch driver is responsible for initial setup of the
984 VLAN ID map/rules. If there is no PVID programmed into the switch port,
985 untagged frames must be rejected as well. When turned off the switch must
990 (tagged or untagged) for the given switch port. The CPU port becomes a member
999 given switch port
1002 Forwarding Database entry, the switch hardware should be programmed with the
1007 Forwarding Database entry, the switch hardware should be programmed to delete
1019 a multicast database entry. The switch hardware should be programmed with the
1024 multicast database entry, the switch hardware should be programmed to delete
1046 - ``port_lag_join``: function invoked when a given switch port is added to a
1050 - ``port_lag_leave``: function invoked when a given switch port leaves a LAG
1059 retrieved by a DSA switch driver using the ``dsa_lag_id`` function.
1109 interface with a physical switch port does not produce the expected result).
1116 - ``port_hsr_join``: function invoked when a given switch port is added to a
1120 - ``port_hsr_leave``: function invoked when a given switch port leaves a
1130 capable hardware, but does not enforce a strict switch device driver model. On
1132 of the switch specific. At some point we should envision a merger between these