-
Notifications
You must be signed in to change notification settings - Fork 334
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
Add units for meter rate to documentation of simple_switch #753
Changes from 3 commits
37a407d
84aa5eb
3bf1a4e
a906886
69c20d3
cc3f725
96076bc
a7dbf6e
7b4f242
252cbd1
56f8dca
0367e3d
048b2ef
06967ec
8a114ea
e870599
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -685,3 +685,8 @@ you have two actions for table `t` where one has the action | |
`m.read(result_field2)`, or if both of those calls are in the same | ||
action. All calls to the `read()` method for `m` must have the same | ||
result parameter where the result is written. | ||
|
||
### BMv2 `meter rate units` implementation notes | ||
|
||
The user enters the meter rate and burtsize in | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It sounds reasonable that the meter rate is in units of bytes per microsec, but the units of "burst size" should be some kind of unit like bytes. It has nothing to do with time. I do not know if simple_switch uses bytes or some other unit like kilobytes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the names of variables and some of the math done to convert units, it appears like perhaps the burst sizes are specified in multiples of 1000 bits (Kbits would be confusing to many people, I think, as it would often be interpreted as multiples of 1024 bits). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, these are likely the units used when a meter has meter type equal to MeterType.bytes in v1model. Does BMv2 support different behavior for meters that have a type equal to MeterType.packets ? If so, what are the units of the meter rates and burst sizes for such meters? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, I missed the burst_size in bytes. I will change the doc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Makes sense to use number of kilo octets. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
pps and packets. |
||
units of bytes/microsec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this documentation for? The runtime CLI? The Thrift service? The PD API?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simple_switch_CLI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's not accurate then
IIRC, the burst size is in "units" (packets or bytes) and the rate is in "units per microsecond" (https://github.com/p4lang/behavioral-model/blob/master/thrift_src/standard.thrift#L88)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, even I quoted the same line of code in the Slack channel today. But, seeing the code in pd_helpers.cpp, I saw the conversion from kbps and kbits. This cpp code also happens to be the only code in the behavioral-model repo converting rate and burst_size and thus I assumed the code is used with simpe_switch_CLI as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some confusion. Based on your reply for meter type as packet, its "units in microsecond" and this is the relevant code in pd_helpers.cpp. I see the division by 10^6 for microseconds.
info_rate = static_cast<double>(meter_spec->cir_pps) / 1000000.;
Isn't the user input captured by simple_switch_CLI in meter_spec->cir_pps and thus the user inputs in pps units? Or is the code in pd_helpers.cpp not used at all by simple_switch_CLI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PD layer is not used at all by the CLI. If you look at the CLI code, you will see that it calls the Thrift service directly.
It is fine to have this information in simple_switch.md BTW, but it would be far more useful to improve the runtime_CLI help message for the
meter_set_rates
CLI command, so that users can get this information directly from the CLI a they are using it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will edit the simple_switch.md doc for CLI rates and burst_size. Even, I was thinking of adding the help message for the meter_set_rates. I will add that. Thanks!