-
Notifications
You must be signed in to change notification settings - Fork 93
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 DASH HA session API design. #532
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
da5980b
DASH HA session API design.
r12f d0fed0c
fix spellcheck
r12f 65c58f9
fix issues found during presentation.
r12f f9e15da
Fix build.
r12f e1d95f8
Update tests.
r12f c549942
Update HA doc.
r12f 781ff24
Add comments.
r12f 592d2c0
minor update on the doc.
r12f ee2e49f
minor update.
r12f 3cf763c
add pending resimulatin state.
r12f 07de19f
Add HA set notification for data plane channel alive state change.
r12f e37901b
fix spelling.
r12f 2aa0f43
Adding capabilities.
r12f 84ee3c3
spellcheck.
r12f 8ac0287
Update event notification.
r12f 4930e3a
Reuse the SAI object APIs for stats capabilities.
r12f 5a03dbe
Added capabilities for HA owner, simplified capabilities for HA topol…
r12f ef90c47
minor update.
r12f cb5e8ca
minor update.
r12f 9b71763
spellcheck.
r12f 571c8ae
minor rename.
r12f abe48f1
Addressing comments.
r12f File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
#ifndef _DASH_STAGE_HA_P4_ | ||
#define _DASH_STAGE_HA_P4_ | ||
|
||
control ha_stage(inout headers_t hdr, | ||
inout metadata_t meta) | ||
{ | ||
// | ||
// ENI-level flow operation counters: | ||
// | ||
DEFINE_HIT_COUNTER(flow_created_counter, MAX_ENI, name="flow_created", attr_type="stats", action_names="set_eni_attrs", order=1) | ||
DEFINE_HIT_COUNTER(flow_create_failed_counter, MAX_ENI, name="flow_create_failed", attr_type="stats", action_names="set_eni_attrs", order=1) | ||
DEFINE_HIT_COUNTER(flow_updated_counter, MAX_ENI, name="flow_updated", attr_type="stats", action_names="set_eni_attrs", order=1) | ||
DEFINE_HIT_COUNTER(flow_update_failed_counter, MAX_ENI, name="flow_update_failed", attr_type="stats", action_names="set_eni_attrs", order=1) | ||
DEFINE_HIT_COUNTER(flow_deleted_counter, MAX_ENI, name="flow_deleted", attr_type="stats", action_names="set_eni_attrs", order=1) | ||
DEFINE_HIT_COUNTER(flow_delete_failed_counter, MAX_ENI, name="flow_delete_failed", attr_type="stats", action_names="set_eni_attrs", order=1) | ||
DEFINE_HIT_COUNTER(flow_aged_counter, MAX_ENI, name="flow_aged", attr_type="stats", action_names="set_eni_attrs", order=1) | ||
|
||
// | ||
// ENI-level flow sync packet counters: | ||
// | ||
DEFINE_COUNTER(inline_sync_packet_rx_counter, MAX_ENI, name="inline_sync_packet_rx", attr_type="stats", action_names="set_eni_attrs", order=2) | ||
DEFINE_COUNTER(inline_sync_packet_tx_counter, MAX_ENI, name="inline_sync_packet_tx", attr_type="stats", action_names="set_eni_attrs", order=2) | ||
DEFINE_COUNTER(timed_sync_packet_rx_counter, MAX_ENI, name="timed_sync_packet_rx", attr_type="stats", action_names="set_eni_attrs", order=2) | ||
DEFINE_COUNTER(timed_sync_packet_tx_counter, MAX_ENI, name="timed_sync_packet_tx", attr_type="stats", action_names="set_eni_attrs", order=2) | ||
|
||
// | ||
// ENI-level flow sync request counters: | ||
// - Depends on implementations, the flow sync request could be batched, hence they need to tracked separately. | ||
// - The counters are defined as combination of following things: | ||
// - 3 flow sync operations: create, update, delete. | ||
// - 2 ways of sync: Inline sync and timed sync. | ||
// - Request result: succeeded, failed (unexpected) and ignored (expected and ok to ignore, e.g., more packets arrives before flow sync is acked). | ||
// | ||
#define DEFINE_ENI_FLOW_SYNC_COUNTERS(counter_name) \ | ||
DEFINE_HIT_COUNTER(inline_ ## counter_name ## _req_sent_counter, MAX_ENI, name=PP_STR(inline_ ## counter_name ## _req_sent), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(inline_ ## counter_name ## _req_recv_counter, MAX_ENI, name=PP_STR(inline_ ## counter_name ## _req_recv), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(inline_ ## counter_name ## _req_failed_counter, MAX_ENI, name=PP_STR(inline_ ## counter_name ## _req_failed), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(inline_ ## counter_name ## _req_ignored_counter, MAX_ENI, name=PP_STR(inline_ ## counter_name ## _req_failed), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(inline_ ## counter_name ## _ack_recv_counter, MAX_ENI, name=PP_STR(inline_ ## counter_name ## _ack_recv), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(inline_ ## counter_name ## _ack_failed_counter, MAX_ENI, name=PP_STR(inline_ ## counter_name ## _ack_failed_recv), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(inline_ ## counter_name ## _ack_ignored_counter, MAX_ENI, name=PP_STR(inline_ ## counter_name ## _ack_ignored_recv), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
\ | ||
DEFINE_HIT_COUNTER(timed_ ## counter_name ## _req_sent_counter, MAX_ENI, name=PP_STR(timed_ ## counter_name ## _req_sent), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(timed_ ## counter_name ## _req_recv_counter, MAX_ENI, name=PP_STR(timed_ ## counter_name ## _req_recv), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(timed_ ## counter_name ## _req_failed_counter, MAX_ENI, name=PP_STR(timed_ ## counter_name ## _req_failed), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(timed_ ## counter_name ## _req_ignored_counter, MAX_ENI, name=PP_STR(timed_ ## counter_name ## _req_failed), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(timed_ ## counter_name ## _ack_recv_counter, MAX_ENI, name=PP_STR(timed_ ## counter_name ## _ack_recv), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(timed_ ## counter_name ## _ack_failed_counter, MAX_ENI, name=PP_STR(timed_ ## counter_name ## _ack_failed_recv), attr_type="stats", action_names="set_eni_attrs", order=2) \ | ||
DEFINE_HIT_COUNTER(timed_ ## counter_name ## _ack_ignored_counter, MAX_ENI, name=PP_STR(timed_ ## counter_name ## _ack_ignored_recv), attr_type="stats", action_names="set_eni_attrs", order=2) | ||
|
||
DEFINE_ENI_FLOW_SYNC_COUNTERS(flow_create) | ||
DEFINE_ENI_FLOW_SYNC_COUNTERS(flow_update) | ||
DEFINE_ENI_FLOW_SYNC_COUNTERS(flow_delete) | ||
|
||
// | ||
// HA scope: | ||
// | ||
action set_ha_scope_attr( | ||
@SalVal[type="sai_object_id_t"] bit<16> ha_set_id, | ||
@SaiVal[type="sai_dash_ha_role_t"] dash_ha_role_t dash_ha_role, | ||
@SaiVal[isreadonly="true"] bit<32> flow_version | ||
) { | ||
meta.ha.ha_set_id = ha_set_id; | ||
meta.ha.ha_role = dash_ha_role; | ||
} | ||
|
||
@SaiTable[api = "dash_ha", order=1, isobject="true"] | ||
table ha_scope { | ||
key = { | ||
meta.ha.ha_scope_id : exact; | ||
} | ||
actions = { | ||
set_ha_scope_attr; | ||
} | ||
} | ||
|
||
// | ||
// HA set: | ||
// | ||
DEFINE_COUNTER(dp_probe_req_rx, MAX_HA_SET, name="dp_probe_req_rx", attr_type="stats", action_names="set_ha_set_attr") | ||
DEFINE_COUNTER(dp_probe_req_tx, MAX_HA_SET, name="dp_probe_req_tx", attr_type="stats", action_names="set_ha_set_attr") | ||
DEFINE_COUNTER(dp_probe_ack_rx, MAX_HA_SET, name="dp_probe_ack_rx", attr_type="stats", action_names="set_ha_set_attr") | ||
DEFINE_COUNTER(dp_probe_ack_tx, MAX_HA_SET, name="dp_probe_ack_tx", attr_type="stats", action_names="set_ha_set_attr") | ||
DEFINE_HIT_COUNTER(dp_probe_failed, MAX_HA_SET, name="dp_probe_failed", attr_type="stats", action_names="set_ha_set_attr") | ||
|
||
action set_ha_set_attr( | ||
bit<1> local_ip_is_v6, | ||
@SaiVal[type="sai_ip_address_t"] IPv4ORv6Address local_ip, | ||
bit<1> peer_ip_is_v6, | ||
@SaiVal[type="sai_ip_address_t"] IPv4ORv6Address peer_ip, | ||
bit<16> dp_channel_dst_port, | ||
bit<16> dp_channel_min_src_port, | ||
bit<16> dp_channel_max_src_port, | ||
bit<32> dp_channel_probe_interval_ms, | ||
bit<32> dp_channel_probe_fail_threshold, | ||
@SaiVal[isreadonly="true"] bit<1> dp_channel_is_alive | ||
) { | ||
meta.ha.peer_ip_is_v6 = peer_ip_is_v6; | ||
meta.ha.peer_ip = peer_ip; | ||
|
||
meta.ha.dp_channel_dst_port = dp_channel_dst_port; | ||
meta.ha.dp_channel_src_port_min = dp_channel_min_src_port; | ||
meta.ha.dp_channel_src_port_max = dp_channel_max_src_port; | ||
} | ||
|
||
@SaiTable[api = "dash_ha", order=0, isobject="true"] | ||
table ha_set { | ||
key = { | ||
meta.ha.ha_set_id : exact @SaiVal[type="sai_object_id_t"]; | ||
} | ||
actions = { | ||
set_ha_set_attr; | ||
} | ||
} | ||
|
||
apply { | ||
// If HA scope id is not set, then HA is not enabled. | ||
if (meta.ha.ha_scope_id == 0) { | ||
return; | ||
} | ||
ha_scope.apply(); | ||
|
||
// If HA set id is not set, then HA is not enabled. | ||
if (meta.ha.ha_set_id == 0) { | ||
return; | ||
} | ||
ha_set.apply(); | ||
|
||
// TODO: HA state machine handling. | ||
} | ||
} | ||
|
||
#endif /* _DASH_STAGE_HA_P4_ */ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@r12f, as discussed can we add a capability attribute for DPU scope versus ENI scope HA.
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.
Hi Mukesh, sure thing! And as we chatted, it will be better to add it in another PR.
The DPU HA capability will make more sense to be added along with the DPU API or a dedicated one, if needed. Putting the DPU HA capability into ENI HA API will be really weird...
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.
Actually, let me get some capacities in there, we can probably model this in a generic way.
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.
Hi @mukeshmv , I have added the capabilities in the PR :D. Feel free to help take a look!