-
Notifications
You must be signed in to change notification settings - Fork 2
Topology Discovery control block
Steffen Lindner edited this page Apr 15, 2019
·
1 revision
The topology discover control block, defined in src/components/controls/Topology-Discovery.p4
, takes care of topology packets. The control block floods topology packets to all ports (based on mc group) and sends topology packets to the controller when they are received.
The entry point is the apply block of the topology control block:
apply {
if(standard_metadata.ingress_port == CONTROLLER_PORT) {
standard_metadata.mcast_grp = 1; // do flooding based on configured mc group
}
else {
standard_metadata.egress_spec = CONTROLLER_PORT; // send to controller
hdr.topology.port = (bit<16>) standard_metadata.ingress_port;
}
}
If the ingress port is CONTROLLER_PORT
, then it's a topology packet from the controller and should be flooded using the multicast group 1, which simply sends the packets on all outgoing ports. Otherwise, the topology packet is forwarded to the local controller.