p4lang / p4runtime

Specification documents for the P4Runtime control-plane API
Apache License 2.0
140 stars 86 forks source link

What is the expect behavior of wildcard reading CounterEntry with `counter_id = 0` and `index = x`? #478

Closed duskmoon314 closed 1 month ago

duskmoon314 commented 2 months ago

I'm reading the doc of reading and writing CounterEntry and getting confused about wildcard reading.

In the doc:

* If the `counter_id` field is set to 0 (default), the server returns the
  counter values for all indirect counter instances in the `ReadResponse`.

* If the `index` field is not set, the server returns the counter values for all
  indirect counters in the array identified by the unique id `counter_id`.

Is for all indirect counters actually for all indirect entries? It seems like a typo.

In the proto:

// - All counter cells for all counters if counter_id = 0 (default).
// - All counter cells for given counter_id if index is unset (default).

To my understanding, the results of different parameters are:

antoninbas commented 2 months ago

If the counter_id field is set to 0, then I would expect a P4Runtime implementation not to even bother looking at the index field, and the value you set should be irrelevant.

Maybe the second bullet point should just start with Otherwise,, to make it clear that these 2 checks are really ordered and mutually exclusive.

chrispsommers commented 1 month ago

@duskmoon314 Would you like to submit a PR to clarify the spec's language per @antoninbas 's feedback above? It'd be great to get your contribution. Thanks in advance!

duskmoon314 commented 1 month ago

Sure! I have submitted a PR based on the feedback above.

I'm sorry for responding late due to some personal issue.