p4lang/behavioral-model

Queue metadata with multiqueue

Closed this issue · 2 comments

Hi! I am working with 3 priority queues on simple_switch, and I am trying to collect InBand Network Telemetry data, about the occupation of these queues. But when I am generating traffic in only one queue (for example queue 0), the enq_qdepth and deq_qdepth values of all three queues are getting high, while the other queues (1 and 2) are supposed to be empty.

I am also checking deq_timedelta, and in this case only in queue 0 I am getting high values (it is the correct behavior I think).

Other thing that I noticed is that when I am generating traffic in 2 queues, the queue depth values are getting higher than 64 (I set the size with set_queue_depth command)

So I have a question: the enq_qdepth and deq_qdepth metadata are about the number of packets adding all the queues in total? Or something is wrong here?

Yes, in the simple_switch implementation it seems that the qdepth is measured across all priority queues for a given port:

phv->get_field("queueing_metadata.enq_qdepth")
.set(egress_buffers.size(egress_port));

//! The occupancies of all the priority queues for this logical queue are
//! added.
size_t size(size_t queue_id) const {
LockType lock(mutex);
auto it = queues_info.find(queue_id);
if (it == queues_info.end()) return 0;
auto &q_info = it->second;
return q_info.size;
}
//! Get the occupancy of priority queue \p priority for logical queue with id
//! \p queue_id.
size_t size(size_t queue_id, size_t priority) const {
LockType lock(mutex);
auto it = queues_info.find(queue_id);
if (it == queues_info.end()) return 0;
auto &q_info = it->second;
auto &q_info_pri = q_info.at(priority);
return q_info_pri.size;
}

Notice how the first variant is called by simple_switch

Thank you @antoninbas. I changed the simple_switch.cpp code to use the second size method variant and recompiled bmv2. It seems that now I can get the depth of only specific priority queues using the enq_qdepth metadata.

But it is strange to me that the standard behavior implemented is to return the depth of all priority queues of the egress port together, instead of the specific queue that the packet is crossing.