-
Notifications
You must be signed in to change notification settings - Fork 895
[TENT] SelectionPolicy: per-policy SL/TC/qp_pool schema (RFC #2568 step 1) #2640
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -206,6 +206,34 @@ void TransportSelector::loadPolicies() { | |
| } | ||
| } | ||
|
|
||
| // Parse link-layer QoS attributes (RFC #2519 / #2568, step 1: stored | ||
| // only, not yet applied to QPs). Out-of-range values are ignored so a | ||
| // bad config never breaks selection. | ||
| if (policy_json.contains("service_level")) { | ||
| int sl = policy_json.value("service_level", -1); | ||
| if (sl >= 0 && sl <= 15) { | ||
| policy.service_level = sl; | ||
| } else { | ||
| LOG(WARNING) << "Ignore service_level in policy " << policy.name | ||
| << ", value " << sl << " out of range (0-15)"; | ||
| } | ||
| } | ||
| if (policy_json.contains("traffic_class")) { | ||
| int tc = policy_json.value("traffic_class", -1); | ||
| if (tc >= 0 && tc <= 255) { | ||
| policy.traffic_class = tc; | ||
| } else { | ||
| LOG(WARNING) << "Ignore traffic_class in policy " << policy.name | ||
| << ", value " << tc << " out of range (0-255)"; | ||
| } | ||
| } | ||
| // Reserved for step 2 (per-class QP pools); parsed for forward schema | ||
| // compatibility, no effect yet. | ||
| if (policy_json.contains("qp_pool")) { | ||
| auto& qp = policy_json["qp_pool"]; | ||
| if (qp.is_string()) policy.qp_pool = qp.get<std::string>(); | ||
| } | ||
|
Comment on lines
+212
to
+235
Contributor
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. Using if (policy_json.contains("service_level")) {
auto& sl_val = policy_json["service_level"];
if (sl_val.is_number_integer()) {
int sl = sl_val.get<int>();
if (sl >= 0 && sl <= 15) {
policy.service_level = sl;
} else {
LOG(WARNING) << "Ignore service_level in policy " << policy.name
<< ", value " << sl << " out of range (0-15)";
}
} else {
LOG(WARNING) << "Ignore service_level in policy " << policy.name
<< ", value is not an integer";
}
}
if (policy_json.contains("traffic_class")) {
auto& tc_val = policy_json["traffic_class"];
if (tc_val.is_number_integer()) {
int tc = tc_val.get<int>();
if (tc >= 0 && tc <= 255) {
policy.traffic_class = tc;
} else {
LOG(WARNING) << "Ignore traffic_class in policy " << policy.name
<< ", value " << tc << " out of range (0-255)";
}
} else {
LOG(WARNING) << "Ignore traffic_class in policy " << policy.name
<< ", value is not an integer";
}
}
// Reserved for step 2 (per-class QP pools); parsed for forward schema
// compatibility, no effect yet.
if (policy_json.contains("qp_pool")) {
auto& qp = policy_json["qp_pool"];
if (qp.is_string()) {
policy.qp_pool = qp.get<std::string>();
} else {
LOG(WARNING) << "Ignore qp_pool in policy " << policy.name
<< ", value is not a string";
}
}
Comment on lines
+232
to
+235
Collaborator
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. Empty-string qp_pool is treated as set, which is semantically different from nullopt (= use default pool).
Comment on lines
+232
to
+235
Collaborator
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. SL/TC out-of-range gets a LOG(WARNING), but "qp_pool": 42 (non-string) is silently no-op'd. For schema consistency, log a warning here too, you don't want a typo'd config to look like it took effect when it didn't. |
||
|
|
||
| policies_.push_back(std::move(policy)); | ||
| LOG(INFO) << "Loaded transport policy: " << policy.name | ||
| << " (segment_type=" << segment_type_str | ||
|
|
@@ -384,6 +412,13 @@ SelectionResult TransportSelector::select( | |
| return result; // UNSPEC, all devices | ||
| } | ||
|
|
||
| // Carry the matched policy's link-layer QoS out to the caller (RFC #2519 / | ||
| // #2568, step 1). These are plumbed but not yet applied at QP setup; that | ||
| // is the per-class QP pool follow-up (step 2). | ||
| result.service_level = matching_policy->service_level; | ||
| result.traffic_class = matching_policy->traffic_class; | ||
| result.qp_pool = matching_policy->qp_pool; | ||
|
|
||
| // Convert device names to mask | ||
| result.device_mask = ~0ULL; // Default: all devices | ||
| if (!matching_policy->devices.empty() && topology_) { | ||
|
|
||
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.
I think add the comments about the RFC reference and splited step is not necessary