Lines Matching +full:builtin +full:- +full:dsa +full:- +full:port

5 This document describes the **Distributed Switch Architecture (DSA)** subsystem
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
23 or more CPU or management ports. The DSA subsystem currently relies on the
24 presence of a management port connected to an Ethernet controller capable of
27 gateways, or even top-of-rack switches. This host Ethernet controller will
28 be later referred to as "conduit" and "cpu" in DSA terminology and code.
30 The D in DSA stands for Distributed, because the subsystem has been designed
33 ports are referred to as "dsa" ports in DSA terminology and code. A collection
36 For each front-panel port, DSA creates specialized network devices which are
37 used as controlling and data-flowing endpoints for use by the Linux networking
39 interfaces in DSA terminology and code.
41 The ideal case for using DSA is when an Ethernet switch supports a "switch tag"
46 - what port is this frame coming from
47 - what was the reason why this frame got forwarded
48 - how to send CPU originated traffic to specific ports
52 on Port-based VLAN IDs).
54 Note that DSA does not currently create network interfaces for the "cpu" and
55 "dsa" ports because:
57 - the "cpu" port is the Ethernet switch facing side of the management
61 - the "dsa" port(s) are just conduits between two or more switches, and as such
63 downstream, or the top-most upstream interface makes sense with that model
65 NB: for the past 15 years, the DSA subsystem had been making use of the terms
67 have been removed from the DSA codebase and phased out of the uAPI.
70 ------------------------
72 DSA supports many vendor-specific tagging protocols, one software-defined
73 tagging protocol, and a tag-less mode as well (``DSA_TAG_PROTO_NONE``).
78 - identifies which port the Ethernet frame came from/should be sent to
79 - provides a reason why this frame was forwarded to the management interface
81 All tagging protocols are in ``net/dsa/tag_*.c`` files and implement the
86 1. The switch-specific frame header is located before the Ethernet header,
87 shifting to the right (from the perspective of the DSA conduit's frame
89 2. The switch-specific frame header is located before the EtherType, keeping
90 the MAC DA and MAC SA in place from the DSA conduit's perspective, but
92 3. The switch-specific frame header is located at the tail of the packet,
94 that the DSA conduit's frame parser has.
101 with the length in octets of the longest switch frame header/trailer. The DSA
103 accommodate for this extra size in order for DSA user ports to support the
106 on a best-effort basis, the allocation of packets with enough extra space such
110 Even though applications are not expected to parse DSA-specific frame headers,
120 From the perspective of the network stack, all switches within the same DSA
122 fabric with more than one switch, the switch-specific frame header is inserted
134 CPU port can be configured to use either the DSA or the Ethertype DSA (EDSA)
135 format, but the DSA links are configured to use the shorter (without Ethertype)
136 DSA frame header, in order to reduce the autonomous packet forwarding overhead.
137 It still remains the case that, if the DSA switch tree is configured for the
138 EDSA tagging protocol, the operating system sees EDSA-tagged packets from the
139 leaf switches that tagged them with the shorter DSA header. This can be done
141 perform tag translation between DSA and EDSA (which is simply the operation of
144 It is possible to construct cascaded setups of DSA switches even if their
146 no DSA links in this fabric, and each switch constitutes a disjoint DSA switch
147 tree. The DSA links are viewed as simply a pair of a DSA conduit (the out-facing
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
152 ``dsa/tagging`` sysfs attribute of the DSA conduit::
154 cat /sys/class/net/eth0/dsa/tagging
156 If the hardware and driver are capable, the tagging protocol of the DSA switch
158 protocol name to the same sysfs device attribute as above (the DSA conduit and
166 for the DSA conduit.
169 The passed ``struct sk_buff *skb`` has ``skb->data`` pointing at
171 ``struct net_device *dev`` represents the virtual DSA user network interface
174 understand what egress port the packet is for (and not deliver it towards other
178 properly, because DSA ensures there is enough space before calling this method.
181 passed ``struct sk_buff *skb`` has ``skb->data`` pointing at
184 method is to consume the frame header, adjust ``skb->data`` to really point at
185 the first octet after the EtherType, and to change ``skb->dev`` to point to the
186 virtual DSA user network interface corresponding to the physical front-facing
187 switch port that the packet was received on.
190 hardware) packet dissection on the DSA conduit, features such as RPS (Receive
191 Packet Steering) on the DSA conduit would be broken. The DSA framework deals
193 the IP header is to be found in the tagged frame as seen by the DSA conduit.
200 Checksum offload should work with category 1 and 2 taggers when the DSA conduit
202 csum_offset. For those cases, DSA will shift the checksum start and offset by
203 the tag size. If the DSA conduit driver still uses the legacy NETIF_F_IP_CSUM
206 vendors). DSA user ports inherit those flags from the conduit, and it is up to
212 tag is inserted (i.e. inside the tagger). Otherwise, the DSA conduit would
218 with DSA-unaware conduits, mangling what the conduit perceives as MAC DA), the
219 tagging protocol may require the DSA conduit to operate in promiscuous mode, to
222 Note that this assumes a DSA-unaware conduit driver, which is the norm.
225 -----------------------
229 know whether DSA is enabled (e.g.: to enable/disable specific offload features),
230 but the DSA subsystem has been proven to work with industry standard drivers:
237 ----------------------
239 When a conduit netdev is used with DSA, a small hook is placed in the
240 networking stack is in order to have the DSA subsystem process the Ethernet
241 switch specific tagging protocol. DSA accomplishes this by registering a
242 specific (and fake) Ethernet type (later becoming ``skb->protocol``) with the
250 - receive function is invoked
251 - basic packet processing is done: getting length, status etc.
252 - packet is prepared to be processed by the Ethernet layer by calling
258 if (dev->dsa_ptr != NULL)
259 -> skb->protocol = ETH_P_XDSA
264 -> iterate over registered packet_type
265 -> invoke handler for ETH_P_XDSA, calls dsa_switch_rcv()
267 4. net/dsa/dsa.c::
269 -> dsa_switch_rcv()
270 -> invoke switch tag specific protocol handler in 'net/dsa/tag_*.c'
272 5. net/dsa/tag_*.c:
274 - inspect and strip switch tag protocol to determine originating port
275 - locate per-port network device
276 - invoke ``eth_type_trans()`` with the DSA user network device
277 - invoked ``netif_receive_skb()``
279 Past this point, the DSA user network devices get delivered regular Ethernet
283 --------------------
285 User network devices created by DSA are stacked on top of their conduit network
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
292 - query the switch for ethtool operations: statistics, link state,
293 Wake-on-LAN, register dumps...
294 - manage external/internal PHY: link, auto-negotiation, etc.
297 pointers which allow DSA to introduce a level of layering between the networking
300 Upon frame transmission from these user network devices, DSA will look up which
308 management interface and deliver them to the physical switch port.
311 device between the DSA user devices and the physical DSA conduits. The LAG
312 device is thus also a DSA conduit, but the LAG slave devices continue to be DSA
313 conduits as well (just with no user port assigned to them; this is needed for
314 recovery in case the LAG DSA conduit disappears). Thus, the data path of the LAG
315 DSA conduit is used asymmetrically. On RX, the ``ETH_P_XDSA`` handler, which
316 calls ``dsa_switch_rcv()``, is invoked early (on the physical DSA conduit;
317 LAG slave). Therefore, the RX data path of the LAG DSA conduit is not used.
319 ``dsa_enqueue_skb``, which calls ``dev_queue_xmit`` towards the LAG DSA conduit.
320 The latter calls ``dev_queue_xmit`` towards one physical DSA conduit or the
325 ------------------------
327 Summarized, this is basically how DSA looks like from a network device
334 +-----------v--|--------------------+
335 |+------+ +------+ +------+ +------+|
337 |+------+-+------+-+------+-+------+|
338 | DSA switch driver |
339 +-----------------------------------+
344 +-----------------------------------+
346 --------+-----------------------------------+------------
348 +-----------------------------------+
353 +-----------------------------------+
355 |+------+ +------+ +------+ +------+|
357 ++------+-+------+-+------+-+------++
360 -------------
362 In order to be able to read to/from a switch PHY built into it, DSA creates an
364 MDIO reads/writes towards specific PHY addresses. In most MDIO-connected
366 to return standard MII registers from the switch builtin PHYs, allowing the PHY
367 library and/or to return link status, link partner pages, auto-negotiation
376 ---------------
378 DSA data structures are defined in ``include/net/dsa.h`` as well as
379 ``net/dsa/dsa_priv.h``:
381 - ``dsa_chip_data``: platform data configuration for a given switch device,
386 - ``dsa_platform_data``: platform device configuration data which can reference
391 - ``dsa_switch_tree``: structure assigned to the conduit network device under
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
402 - ``dsa_switch_ops``: structure referencing function pointers, see below for a
408 Lack of CPU/DSA network devices
409 -------------------------------
411 DSA does not currently create user network devices for the CPU or DSA ports, as
414 - inability to fetch switch CPU port statistics counters using ethtool, which
417 - inability to configure the CPU port link parameters based on the Ethernet
420 - inability to configure specific VLAN IDs / trunking VLANs between switches
423 Common pitfalls using DSA setups
424 --------------------------------
426 Once a conduit network device is configured to use DSA (dev->dsa_ptr becomes
427 non-NULL), and the switch behind it expects a tagging protocol, this network
437 DSA currently leverages the following subsystems:
439 - MDIO/PHY library: ``drivers/net/phy/phy.c``, ``mdio_bus.c``
440 - Switchdev:``net/switchdev/*``
441 - Device Tree for various of_* functions
442 - Devlink: ``net/core/devlink.c``
445 ----------------
447 User network devices exposed by DSA may or may not be interfacing with PHY
448 devices (``struct phy_device`` as defined in ``include/linux/phy.h)``, but the DSA
451 - internal PHY devices, built into the Ethernet switch hardware
452 - external PHY devices, connected via an internal or external MDIO bus
453 - internal PHY devices, connected via an internal MDIO bus
454 - special, non-autonegotiated or non MDIO-managed PHY devices: SFPs, MoCA; a.k.a
460 - if Device Tree is used, the PHY device is looked up using the standard
461 "phy-handle" property, if found, this PHY device is created and registered
464 - if Device Tree is used and the PHY device is "fixed", that is, conforms to
465 the definition of a non-MDIO managed PHY as defined in
466 ``Documentation/devicetree/bindings/net/fixed-link.txt``, the PHY is registered
469 - finally, if the PHY is built into the switch, as is very common with
471 by DSA
475 ---------
477 DSA directly utilizes SWITCHDEV when interfacing with the bridge layer, and
479 of per-port user network devices. As of today, the only SWITCHDEV objects
480 supported by DSA are the FDB and VLAN objects.
483 -------
485 DSA registers one devlink device per physical switch in the fabric.
486 For each devlink device, every physical port (i.e. user ports, CPU ports, DSA
487 links or unused ports) is exposed as a devlink port.
489 DSA drivers can make use of the following devlink features:
491 - Regions: debugging feature which allows user space to dump driver-defined
492 areas of hardware information in a low-level, binary format. Both global
493 regions as well as per-port regions are supported. It is possible to export
495 to the standard iproute2 user space programs (ip-link, bridge), like address
497 contain additional hardware-specific details which are not visible through
499 the non-user ports too, which are invisible to iproute2 because no network
501 - Params: a feature which enables user to configure certain low-level tunable
503 devlink params, or may add new device-specific devlink params.
504 - Resources: a monitoring feature which enables users to see the degree of
506 - Shared buffers: a QoS feature for adjusting and partitioning memory and frame
507 reservations per port and per traffic class, in the ingress and egress
508 directions, such that low-priority bulk traffic does not impede the
509 processing of high-priority critical traffic.
514 -----------
516 DSA features a standardized binding which is documented in
517 ``Documentation/devicetree/bindings/net/dsa/dsa.txt``. PHY/MDIO library helper
519 per-port PHY specific details: interface connection, MDIO bus location, etc.
524 DSA switch drivers need to implement a ``dsa_switch_ops`` structure which will
528 -----------------------------------------
530 DSA switches are regular ``device`` structures on buses (be they platform, SPI,
531 I2C, MDIO or otherwise). The DSA framework is not involved in their probing
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
542 to validate the port indices provided in the OF node.
544 - ``ds->ops``: a pointer to the ``dsa_switch_ops`` structure holding the DSA
547 - ``ds->priv``: backpointer to a driver-private data structure which can be
548 retrieved in all further DSA method callbacks.
551 be configured to obtain driver-specific behavior from the DSA core. Their
552 behavior when set is documented through comments in ``include/net/dsa.h``.
554 - ``ds->vlan_filtering_is_global``
556 - ``ds->needs_standalone_vlan_filtering``
558 - ``ds->configure_vlan_while_not_filtering``
560 - ``ds->untag_bridge_pvid``
562 - ``ds->assisted_learning_on_cpu_port``
564 - ``ds->mtu_enforcement_ingress``
566 - ``ds->fdb_isolation``
568 Internally, DSA keeps an array of switch trees (group of switches) global to
571 number of the ``dsa,member`` property of the switch's OF node (0 if missing).
578 The first N-1 callers of ``dsa_register_switch()`` only add their ports to the
579 port list of the tree (``dst->ports``), each port having a backpointer to its
580 associated switch (``dp->ds``). Then, these switches exit their
583 DSA links are present in the tree's port list). The tree becomes complete when
585 continuation of initialization (including the call to ``ds->ops->setup()``) for
590 which removes a switch's ports from the port list of the tree. The entire tree
593 It is mandatory for DSA switch drivers to implement the ``shutdown()`` callback
596 The reason is that DSA keeps a reference on the conduit net device, and if the
597 driver for the conduit device decides to unbind on shutdown, DSA's reference
612 --------------------
614 - ``get_tag_protocol``: this is to indicate what kind of tagging protocol is
617 CPU port number, as well as the tagging protocol of a possibly stacked
621 - ``change_tag_protocol``: when the default tagging protocol has compatibility
627 - ``setup``: setup function for the switch, this function is responsible for setting
632 a Port-based VLAN ID for each port and allowing only the CPU port and the
633 specific port to be in the forwarding vector. Ports that are unused by the
641 - ``port_setup`` and ``port_teardown``: methods for initialization and
642 destruction of per-port data structures. It is mandatory for some operations
643 such as registering and unregistering devlink port regions to be done from
644 these methods, otherwise they are optional. A port will be torn down only if
645 it has been previously set up. It is possible for a port to be set up during
647 PHY cannot be found. In this case, probing of the DSA switch continues
648 without that particular port.
650 - ``port_change_conduit``: method through which the affinity (association used
651 for traffic termination purposes) between a user port and a CPU port can be
653 available CPU port that makes sense for them (most of the times this means
654 the user ports of a tree are all assigned to the same CPU port, except for H
655 topologies as described in commit 2c0b03258b8b). The ``port`` argument
656 represents the index of the user port, and the ``conduit`` argument represents
657 the new DSA conduit ``net_device``. The CPU port associated with the new
659 conduit->dsa_ptr``. Additionally, the conduit can also be a LAG device where
660 all the slave devices are physical DSA conduits. LAG DSA also have a
661 valid ``conduit->dsa_ptr`` pointer, however this is not unique, but rather a
662 duplicate of the first physical DSA conduit's (LAG slave) ``dsa_ptr``. In case
663 of a LAG DSA conduit, a further call to ``port_lag_join`` will be emitted
664 separately for the physical CPU ports associated with the physical DSA
669 -------------------------------
671 - ``get_phy_flags``: Some switches are interfaced to various kinds of Ethernet PHYs,
674 should return a 32-bit bitmask of "flags" that is private between the switch
677 - ``phy_read``: Function invoked by the DSA user MDIO bus when attempting to read
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
680 status, auto-negotiation results, link partner pages, etc.
682 - ``phy_write``: Function invoked by the DSA user MDIO bus when attempting to write
683 to the switch port MDIO registers. If unavailable return a negative error
686 - ``adjust_link``: Function invoked by the PHY library when a user network device
688 configuring the switch port link parameters: speed, duplex, pause based on
691 - ``fixed_link_update``: Function invoked by the PHY library, and specifically by
693 not be auto-negotiated, or obtained by reading the PHY registers through MDIO.
695 MoCA or other kinds of non-MDIO managed PHYs where out of band link
699 ------------------
701 - ``get_strings``: ethtool function used to query the driver's strings, will
704 - ``get_ethtool_stats``: ethtool function used to query per-port statistics and
705 return their values. DSA overlays user network devices general statistics:
707 per port
709 - ``get_sset_count``: ethtool function used to query the number of statistics items
711 - ``get_wol``: ethtool function used to obtain Wake-on-LAN settings per-port, this
713 Wake-on-LAN settings if this interface needs to participate in Wake-on-LAN
715 - ``set_wol``: ethtool function used to configure Wake-on-LAN settings per-port,
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
721 controller and data-processing logic
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
725 and data-processing logic as well as query the PHY for its currently configured
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
735 - ``get_regs_len``: ethtool function returning the register length for a given
738 - ``get_regs``: ethtool function returning the Ethernet switch internal register
739 contents. This function might require user-land code in ethtool to
740 pretty-print register values and registers
743 ----------------
745 - ``suspend``: function invoked by the DSA platform device when the system goes to
747 participating in Wake-on-LAN active as well as additional wake-up logic if
750 - ``resume``: function invoked by the DSA platform device when the system resumes,
751 should resume all Ethernet switch activities and re-configure the switch to be
754 - ``port_enable``: function invoked by the DSA user network device ndo_open
755 function when a port is administratively brought up, this function should
756 fully enable a given switch port. DSA takes care of marking the port with
757 ``BR_STATE_BLOCKING`` if the port is a bridge member, or ``BR_STATE_FORWARDING`` if it
760 - ``port_disable``: function invoked by the DSA user network device ndo_close
761 function when a port is administratively brought down, this function should
762 fully disable a given switch port. DSA takes care of marking the port with
763 ``BR_STATE_DISABLED`` and propagating changes to the hardware if this port is
767 -----------------
772 lookup on TX) depending on the state of the port. An address database may
776 For example, all ports that belong to a VLAN-unaware bridge (which is
777 *currently* VLAN-unaware) are expected to learn source addresses in the
779 VLAN-unaware bridges). During forwarding and FDB lookup, a packet received on a
780 VLAN-unaware bridge port should be able to find a VLAN-unaware FDB entry having
781 the same MAC DA as the packet, which is present on another port member of the
784 a port which is a member of a different VLAN-unaware bridge (and is therefore
787 Similarly, each VLAN of each offloaded VLAN-aware bridge should have an
792 In this context, a VLAN-unaware database means that all packets are expected to
794 VLAN-aware database means that packets are supposed to match based on the VLAN
797 At the bridge layer, VLAN-unaware FDB entries have the special VID value of 0,
798 whereas VLAN-aware FDB entries have non-zero VID values. Note that a
799 VLAN-unaware bridge may have VLAN-aware (non-zero VID) FDB entries, and a
800 VLAN-aware bridge may have VLAN-unaware FDB entries. As in hardware, the
805 When a user port operates in standalone mode, its driver should configure it to
806 use a separate database called a port private database. This is different from
807 the databases described above, and should impede operation as standalone port
808 (packet in, packet out to the CPU port) as little as possible. For example,
810 learning is a bridging layer service and this is a standalone port, therefore
811 it would consume useless space. With no address learning, the port private
813 received packets should be trivially flooded to the CPU port.
815 DSA (cascade) and CPU ports are also called "shared" ports because they service
817 to is usually embedded in the DSA tag. This means that the CPU port may
818 simultaneously transport packets coming from a standalone port (which were
819 classified by hardware in one address database), and from a bridge port (which
823 configuration by removing the CPU port from the flooding domain of the switch,
824 and just program the hardware with FDB entries pointing towards the CPU port
829 DSA is able to perform host address filtering for the following kinds of
832 - Primary unicast MAC addresses of ports (``dev->dev_addr``). These are
833 associated with the port private database of the respective user port,
835 the CPU port.
837 - Secondary unicast and multicast MAC addresses of ports (addresses added
839 with the port private database of the respective user port.
841 - Local/permanent bridge FDB entries (``BR_FDB_LOCAL``). These are the MAC
846 - Static bridge FDB entries installed towards foreign (non-DSA) interfaces
847 present in the same bridge as some DSA switch ports. These are also
850 - Dynamically learned FDB entries on foreign interfaces present in the same
851 bridge as some DSA switch ports, only if ``ds->assisted_learning_on_cpu_port``
855 For various operations detailed below, DSA provides a ``dsa_db`` structure
858 - ``DSA_DB_PORT``: the FDB (or MDB) entry to be installed or deleted belongs to
859 the port private database of user port ``db->dp``.
860 - ``DSA_DB_BRIDGE``: the entry belongs to one of the address databases of bridge
861 ``db->bridge``. Separation between the VLAN-unaware database and the per-VID
863 - ``DSA_DB_LAG``: the entry belongs to the address database of LAG ``db->lag``.
867 ``port_mdb_add`` etc should declare ``ds->fdb_isolation`` as true.
869 DSA associates each offloaded bridge and each offloaded LAG with a one-based ID
871 refcounting addresses on shared ports. Drivers may piggyback on DSA's numbering
872 scheme (the ID is readable through ``db->bridge.num`` and ``db->lag.id`` or may
876 entries on the CPU port belonging to ``DSA_DB_PORT`` databases.
878 drivers even if they do not support FDB isolation. However, ``db->bridge.num``
879 and ``db->lag.id`` are always set to 0 in that case (to denote the lack of
883 separate address databases for each standalone user port. Since FDB entries in
884 the port private databases will always point to the CPU port, there is no risk
886 share the same database, but the reference counting of host-filtered addresses
887 (not deleting the FDB entry for a port's MAC address if it's still in use by
888 another port) becomes the responsibility of the driver, because DSA is unaware
889 that the port databases are in fact shared. This can be achieved by calling
891 The down side is that the RX filtering lists of each user port are in fact
892 shared, which means that user port A may accept a packet with a MAC DA it
894 user port B. These packets will still be dropped in software, however.
897 ------------
900 below. They may be absent, return -EOPNOTSUPP, or ``ds->max_num_bridges`` may
901 be non-zero and exceeded, and in this case, joining a bridge port is still
905 learning etc) disabled, and send all received packets to the CPU port only.
907 Concretely, a port starts offloading the forwarding plane of a bridge once it
910 learning FDB entries in accordance with the software bridge port's state, and
912 This is optional even when offloading a bridge port. Tagging protocol drivers
915 ingress switch port. DSA, through ``dsa_port_devlink_setup()``, considers all
926 packets and have ``skb->offload_fwd_mark`` set to true in the tag protocol
928 hardware learning on the CPU port, and do not override the port STP state.
935 correct bridging domain (FID) that the port is a part of. The port may be
936 VLAN-unaware, and in this case the FID must be equal to the FID used by the
937 driver for its VLAN-unaware address database associated with that bridge.
938 Alternatively, the bridge may be VLAN-aware, and in that case, it is guaranteed
939 that the packet is also VLAN-tagged with the VLAN ID that the bridge processed
941 the egress-untagged ports, or keep the tag on the egress-tagged ones.
943 - ``port_bridge_join``: bridge layer function invoked when a given switch port is
945 level to permit the joining port to be added to the relevant logical
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
959 - ``port_bridge_flags``: bridge layer function invoked when a port must
963 types of traffic, then the DSA core notifies of any change to the bridge port
964 flags when the port joins and leaves a bridge. DSA does not currently manage
965 the bridge port flags for the CPU port. The assumption is that address
967 CPU port, and flooding towards the CPU port should also be enabled, due to a
968 lack of an explicit address filtering mechanism in the DSA core.
970 - ``port_fast_age``: bridge layer function invoked when flushing the
971 dynamically learned FDB entries on the port is necessary. This is called when
977 ---------------------
979 - ``port_vlan_filtering``: bridge layer function invoked when the bridge gets
984 VLAN ID map/rules. If there is no PVID programmed into the switch port,
989 - ``port_vlan_add``: bridge layer function invoked when a VLAN is configured
990 (tagged or untagged) for the given switch port. The CPU port becomes a member
991 of a VLAN only if a foreign bridge port is also a member of it (and
996 to manually install a VLAN on the CPU port.
998 - ``port_vlan_del``: bridge layer function invoked when a VLAN is removed from the
999 given switch port
1001 - ``port_fdb_add``: bridge layer function invoked when the bridge wants to install a
1006 - ``port_fdb_del``: bridge layer function invoked when the bridge wants to remove a
1009 this port forwarding database
1011 - ``port_fdb_dump``: bridge bypass function invoked by ``ndo_fdb_dump`` on the
1012 physical DSA port interfaces. Since DSA does not attempt to keep in sync its
1018 - ``port_mdb_add``: bridge layer function invoked when the bridge wants to install
1023 - ``port_mdb_del``: bridge layer function invoked when the bridge wants to remove a
1026 this port forwarding database.
1029 ----------------
1033 DSA is capable of offloading a link aggregation group (LAG) to hardware that
1036 ports constitutes a logical port, although DSA has no explicit concept of a
1037 logical port at the moment. Due to this, events where a LAG joins/leaves a
1039 LAG join/leave the bridge. Switchdev port attributes (VLAN filtering, STP
1040 state, etc) and objects (VLANs, MDB entries) offloaded to a LAG as bridge port
1041 are treated similarly: DSA offloads the same switchdev object / port attribute
1043 supported, since the DSA driver API does not have the concept of a logical port
1046 - ``port_lag_join``: function invoked when a given switch port is added to a
1047 LAG. The driver may return ``-EOPNOTSUPP``, and in this case, DSA will fall
1048 back to a software implementation where all traffic from this port is sent to
1050 - ``port_lag_leave``: function invoked when a given switch port leaves a LAG
1051 and returns to operation as a standalone port.
1052 - ``port_lag_change``: function invoked when the link state of any member of
1057 can optionally populate ``ds->num_lag_ids`` from the ``dsa_switch_ops::setup``
1059 retrieved by a DSA switch driver using the ``dsa_lag_id`` function.
1061 IEC 62439-2 (MRP)
1062 -----------------
1076 however in the case of a device with an offloaded data path such as DSA, it is
1077 necessary for the hardware, even if it is not MRP-aware, to be able to extract
1079 implementation. DSA today has no driver which is MRP-aware, therefore it only
1083 - ``port_mrp_add`` and ``port_mrp_del``: notifies driver when an MRP instance
1084 with a certain ring ID, priority, primary port and secondary port is
1086 - ``port_mrp_add_ring_role`` and ``port_mrp_del_ring_role``: function invoked
1091 IEC 62439-3 (HSR/PRP)
1092 ---------------------
1097 eliminating the duplicates at the receiver. The High-availability Seamless
1099 the redundant traffic are aware of the fact that it is HSR-tagged (because HSR
1109 interface with a physical switch port does not produce the expected result).
1113 ``Documentation/networking/netdev-features.rst``. Additionally, the following
1116 - ``port_hsr_join``: function invoked when a given switch port is added to a
1117 DANP/DANH. The driver may return ``-EOPNOTSUPP`` and in this case, DSA will
1118 fall back to a software implementation where all traffic from this port is
1120 - ``port_hsr_leave``: function invoked when a given switch port leaves a
1121 DANP/DANH and returns to normal operation as a standalone port.
1126 Making SWITCHDEV and DSA converge towards an unified codebase
1127 -------------------------------------------------------------
1131 the other DSA enforces a fairly strict device driver model, and deals with most