Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSA counter start/stop functionality? #606

Open
jamescoole-cisco opened this issue Apr 6, 2018 · 2 comments
Open

PSA counter start/stop functionality? #606

jamescoole-cisco opened this issue Apr 6, 2018 · 2 comments

Comments

@jamescoole-cisco
Copy link
Contributor

The control plane API for counters includes start(index) and stop(index) methods, but I can't find a description of what they do. They look like they're meant to suspend/resume attempts by the data plane to count on a particular index, but the pseudocode in Appendix C doesn't implement this behavior.

@jafingerhut
Copy link
Collaborator

I believe those were originally typed in by Calin @cc10512 and I believe I verbally asked at one time and the answer was something about that being useful for some debug situations, perhaps?

It may make sense to de-emphasize and/or delete the control plane APIs in the PSA specification, referring instead to the P4Runtime API spec, which is not at v1.0 release yet, but with a goal of reaching that milestone by June 2018.

I don't think start/stop functionality is included explicitly in the P4Runtime API spec. I also recall a conversation in some PSA working group meeting that because counter update actions must be written explicitly in PSA programs (i.e. there are no automatic counter or meter updates implied that are not explicitly in the P4 source program, not even for DirectCounter or DirectMeter externs), that you can achieve the same effect as start/top by having one action that includes update actions for a DirectCounter, and another action that is identical except with no update action for the DirectCounter, and having the control plane API choose between the counter-updating action and the non-counter-updating action to implement start/stop behavior.

@jamescoole-cisco
Copy link
Contributor Author

It's probably fine to move most of the API discussion, but if counter implementations do need to be able to be suspended it seems like that should be mentioned here in any case.

Using multiple actions works for direct counters, but currently start/stop are also defined for freestanding counters. Registers could also work.

There are tradeoffs for direct counters too. One issue with the current design is that all counters have to include start/stop bits, even if the user doesn't want that functionality. Multiple actions solves that, but requires the user to manually specialize actions and duplicate code. Another possibility is opting-in to a counter being suspendible via a constructor parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants