Skip to content

Commit

Permalink
Fix doc comments, rebase to resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
mukeshmv committed Jul 16, 2024
1 parent ba1bb08 commit a3e2784
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 14 deletions.
56 changes: 56 additions & 0 deletions dash-pipeline/SAI/specs/sai_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,62 @@ enums:
name: NONE
description: ''
value: '0'
- !!python/object:utils.sai_spec.sai_enum.SaiEnum
name: sai_dash_ha_state_t
description: ''
members:
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: DEAD
description: ''
value: '0'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: CONNECTING
description: ''
value: '1'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: CONNECTED
description: ''
value: '2'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: INITIALIZING_TO_ACTIVE
description: ''
value: '3'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: INITIALIZING_TO_STANDBY
description: ''
value: '4'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: PENDING_STANDALONE_ACTIVATION
description: ''
value: '5'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: PENDING_ACTIVE_ACTIVATION
description: ''
value: '6'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: PENDING_STANDBY_ACTIVATION
description: ''
value: '7'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: STANDALONE
description: ''
value: '8'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: ACTIVE
description: ''
value: '9'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: STANDBY
description: ''
value: '10'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: DESTROYING
description: ''
value: '11'
- !!python/object:utils.sai_spec.sai_enum_member.SaiEnumMember
name: SWITCHING_TO_STANDALONE
description: ''
value: '12'
port_extenstion: !!python/object:utils.sai_spec.sai_api_extension.SaiApiExtension
attributes: []
stats:
Expand Down
35 changes: 32 additions & 3 deletions dash-pipeline/bmv2/dash_metadata.p4
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ enum bit<16> dash_flow_entry_bulk_get_session_filter_key_t
DST_IP_ADDR = 5,
SRC_L4_PORT = 6,
DST_L4_PORT = 7,
KEY_VERSION = 8
KEY_VERSION = 8
}

enum bit<8> dash_flow_entry_bulk_get_session_op_key_t
Expand All @@ -123,7 +123,7 @@ struct conntrack_data_t {
bool allow_in;
bool allow_out;
flow_table_data_t flow_table;
EthernetAddress eni_mac;
EthernetAddress eni_mac;
flow_data_t flow_data;
flow_key_t flow_key;
flow_key_t reverse_flow_key;
Expand Down Expand Up @@ -169,7 +169,7 @@ struct encap_data_t {
dash_encapsulation_t dash_encapsulation;
EthernetAddress underlay_smac;
EthernetAddress underlay_dmac;
}
}

struct overlay_rewrite_data_t {
bool is_ipv6;
Expand All @@ -189,6 +189,35 @@ enum bit<8> dash_ha_role_t {
SWITCHING_TO_ACTIVE = 4
};

// HA states
enum bit<8> dash_ha_state_t {
DEAD = 0,
// trying to connect to HA pair
CONNECTING = 1,
// bulk sync in progress
CONNECTED = 2,
// connection successful, bulk sync in progress
INITIALIZING_TO_ACTIVE = 3,
// connection successful, bulk sync in progress
INITIALIZING_TO_STANDBY = 4,
// ready to be in STANDALONE state, waiting for activation of admin role
PENDING_STANDALONE_ACTIVATION = 5,
// ready to be in ACTIVE state, waiting for activation of admin role
PENDING_ACTIVE_ACTIVATION = 6,
// ready to be in STANDBY state, waiting for activation of admin role
PENDING_STANDBY_ACTIVATION = 7,
// activation done, fowarding traffic
STANDALONE = 8,
// activation done, fowarding traffic and syncing flows with HA pair
ACTIVE = 9,
// activation done, ready to fowarding traffic if pair fails
STANDBY = 10,
// going down for planned shutdown
DESTROYING = 11,
// gracefully transitioning from paired state to stand-alone
SWITCHING_TO_STANDALONE = 12
};

// Flow sync state
enum bit<8> dash_ha_flow_sync_state_t {
FLOW_MISS = 0, // Flow not created yet
Expand Down
7 changes: 4 additions & 3 deletions dash-pipeline/bmv2/dash_pipeline.p4
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ control dash_ingress(
bit<1> disable_fast_path_icmp_flow_redirection,
bit<1> full_flow_resimulation_requested,
bit<64> max_resimulated_flow_per_second,
@SaiVal[type="sai_object_id_t"] bit<16> outbound_routing_group_id)
@SaiVal[type="sai_object_id_t"] bit<16> outbound_routing_group_id,
bit<1> is_ha_flow_owner)
{
meta.eni_data.cps = cps;
meta.eni_data.pps = pps;
Expand Down Expand Up @@ -338,7 +339,7 @@ control dash_ingress(
}

conntrack_lookup_stage.apply(hdr, meta);

UPDATE_ENI_COUNTER(eni_rx);
if (meta.is_fast_path_icmp_flow_redirection_packet) {
UPDATE_ENI_COUNTER(eni_lb_fast_path_icmp_in);
Expand Down Expand Up @@ -375,7 +376,7 @@ control dash_ingress(
#endif // TARGET_BMV2_V1MODEL
#ifdef TARGET_DPDK_PNA
, istd
#endif // TARGET_DPDK_PNA
#endif // TARGET_DPDK_PNA
);

if (meta.eni_data.dscp_mode == dash_tunnel_dscp_mode_t.PIPE_MODEL) {
Expand Down
19 changes: 11 additions & 8 deletions documentation/high-avail/ha-api-hld.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ HA set is defined as a SAI object and contains the following SAI attributes:
| SAI_HA_SET_ATTR_DP_CHANNEL_PROBE_INTERVAL_MS | `sai_uint32_t` | The interval of the data plane channel probe. |
| SAI_HA_SET_ATTR_DP_CHANNEL_PROBE_FAIL_THRESHOLD | `sai_uint32_t` | The threshold of the data plane channel probe fail. |
| SAI_HA_SET_ATTR_DP_CHANNEL_IS_ALIVE | `bool` | (Read-only) Is data plane channel alive. |
| SAI_HA_SET_ATTR_SWITCHOVER_NETWORK_CONVERGENCE_TIME_MS | sai_uint32_t | Time for which DPU driven HA state machine needs to wait for the network to switchover traffic during planned shutdown of the other DPU in the HA pair. |
| SAI_HA_SET_ATTR_DPU_DRIVEN_HA_SWITCHOVER_WAIT_TIME_MS | sai_uint32_t | Time to wait for the network to switchover traffic in DPU driven HA mode. |

### 4.2. HA Scope

Expand All @@ -121,10 +121,10 @@ HA scope is also defined as a SAI object and contains the following SAI attribut
| SAI_HA_SCOPE_ATTR_FLOW_VERSION | `sai_uint32_t` | The flow version for new flows. |
| SAI_HA_SCOPE_ATTR_FLOW_RECONCILE_REQUESTED | `bool` | When set to true, flow reconcile will be initiated. |
| SAI_HA_SCOPE_ATTR_FLOW_RECONCILE_NEEDED | `bool` | (Read-only) If true, flow reconcile is needed. |
| SAI_HA_SCOPE_ATTR_VIP_V4 | `sai_ip_address_t` | Dedicated IPv4 VIP for DPU HA scope. |
| SAI_HA_SCOPE_ATTR_VIP_V6 | `sai_ip_address_t` | Dedicated IPv6 VIP for DPU HA scope. |
| SAI_HA_SCOPE_ATTR_ADMIN_STATE | `bool` | Start or stop the DPU driven HA state machine. |
| SAI_HA_SCOPE_ATTR_HA_STATE | `sai_dash_ha_state_t` | Read-only state in case of DPU driven state machine. |
| SAI_HA_SCOPE_ATTR_VIP_V4 | `sai_ip_address_t` | IPv4 VIP of the HA scope (Used in DPU driven HA mode only). |
| SAI_HA_SCOPE_ATTR_VIP_V6 | `sai_ip_address_t` | IPv6 VIP of the HA scope (Used in DPU driven HA mode only). |
| SAI_HA_SCOPE_ATTR_ADMIN_STATE | `bool` | Administrative control of HA scope (In case of DPU driven HA mode, this is used to start or stop HA state machine). |
| SAI_HA_SCOPE_ATTR_HA_STATE | `sai_dash_ha_state_t` | (Read-only) Operational HA state. |
| SAI_HA_SCOPE_ATTR_ACTIVATE_ROLE | `bool` | Trigger DPU driven HA state machine to transition to steady state and prepare to start receiving traffic destined to VIP. |

The HA role is defined as below:
Expand Down Expand Up @@ -292,10 +292,13 @@ Similar to HA set, whenever any HA scope state is changed, it will be reported b
typedef enum _sai_ha_scope_event_t
{
/** HA scope state changed */
SAI_HA_SCOPE_STATE_CHANGED,
SAI_HA_SCOPE_EVENT_STATE_CHANGED,
/** Flow reconcile is needed */
SAI_HA_SCOPE_FLOW_RECONCILE_NEEDED,
SAI_HA_SCOPE_EVENT_FLOW_RECONCILE_NEEDED,
/** DPU driven HA split brain detected */
SAI_HA_SCOPE_EVENT_SPLIT_BRAIN_DETECTED,
} sai_ha_scope_event_t;
Expand All @@ -316,7 +319,7 @@ typedef struct _sai_ha_scope_event_data_t
/** Flow version */
sai_uint32_t flow_version;
/** HA role */
/** HA state */
sai_dash_ha_state_t ha_state;
} sai_ha_scope_event_data_t;
Expand Down

0 comments on commit a3e2784

Please sign in to comment.