What is the queue management approach in P4?

Q1: There is no direct way designed into the v1model architecture to read queue depths from ingress.

You could implement a way with some P4 code written by you, and probably a bit of control plane code as well, that would periodically send packets through ingress, then egress, where packet X would read queue depth X in egress, then recirculate, then write queue depth X in a P4 register in ingress. You would need different packets to update the P4 register for each different queue number X you wanted to be kept relatively up to date in ingress. Then your “normal” data packets could read that P4 register in ingress to get a relatively recent value of the queue depth. The more often the updater packets are sent through, the more up-to-date the queue depth values readable in ingress will be.

Q2: There is no direct way to dequeue a packet from one queue and then enqueue it into another queue. There is likely a way that you could, in egress, perform an egress-to-egress mirror/clone operation on the packet, to a clone session that will send the cloned copy to the desired output queue you want.

1 Like