p4lang / p4runtime

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

Clarify if ReadResponse can/should contain duplicates or not #479

Closed smolkaj closed 1 month ago

smolkaj commented 1 month ago

Forking off from https://github.com/p4lang/p4runtime/issues/476.

The following is a valid read request:

device_id: <ID>
entities {
  table_entry { }  # read all table entries for all tables
}
entities {
  table_entry { }  # read all table entries for all tables
}

Should this read all table entries twice or just a single time? The spec doesn't seem to specify which one we want at the moment.

jonathan-dilorenzo commented 1 month ago

It seems to be allowed, but not required to contain duplicates if there are overlapping requests. This is the relevant paragraph from section 13.3.1:

The P4Runtime server is not required to perform any optimization (e.g. merge two requests in the batch if one is a subset of other). As a result of this, it is possible for the ReadResponse to contain the same entity more than once. If performance is a concern, the P4Runtime client should handle this merging.

smolkaj commented 1 month ago

Thanks for the clarification, closing the issue.