From 97b905dfd49513fbedd4dc72f0c93218dbe56702 Mon Sep 17 00:00:00 2001 From: Sanjay Thyamagundalu Date: Tue, 1 Nov 2022 00:00:51 -0700 Subject: [PATCH 1/3] Address coments from review of HA proposal - Add Flow sync metadata details and other changes --- .../high-avail/AMD-Pensando_HA_Proposal.md | 317 +++++++++++++++++- 1 file changed, 308 insertions(+), 9 deletions(-) diff --git a/documentation/high-avail/AMD-Pensando_HA_Proposal.md b/documentation/high-avail/AMD-Pensando_HA_Proposal.md index 7ae58d85b..ecd5a250c 100644 --- a/documentation/high-avail/AMD-Pensando_HA_Proposal.md +++ b/documentation/high-avail/AMD-Pensando_HA_Proposal.md @@ -270,9 +270,10 @@ typedef enum _sai_dash_ha_dpu_message_types_t { */ SAI_DASH_HA_DPU_MESSAGE_TYPE_END, -} sai_dash_ha_dpu_message_types_t +} sai_dash_ha_dpu_message_types_t; + /** - * @brief Notification data format for received for the DPU Control message + * @brief Notification data format for the DPU Control message * callback. */ typedef struct _sai_dash_ha_dpu_control_message_notification_data_t { @@ -288,7 +289,189 @@ typedef struct _sai_dash_ha_dpu_control_message_notification_data_t { } sai_dash_ha_dpu_control_message_notification_data_t; /** - * @brief Notification Data format for received flow sync messages from the DPU + * @brief DPU Message notification + * + * Notification for DPU message to be relayed + * + * @param[in] sai_object_id_t vipID + * @param[in] attr_count Number of attributes + * @param[in] attr_list Array of attributes + * + */ +typedef void (*sai_dash_ha_dpu_message_notification_fn) ( + _In_ sai_object_id_t *dash_ha_vip_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + +/** + * @brief Policy Result Enumeration + */ +typedef enum _sai_dash_ha_policy_result_t { + /** + * @brief Default result - undefined + */ + SAI_DASH_HA_POLICY_RESULT_NONE, + + /** + * @brief Permit flow + */ + SAI_DASH_HA_POLICY_RESULT_ALLOW, + + /** + * @brief Deny flow + */ + SAI_DASH_HA_POLICY_RESULT_DENY, + +} _sai_dash_ha_policy_result_t; + +/** + * @brief Bitmap values for HA Rewrite flags + */ +typedef enum _sai_dash_ha_rewrite_flags_t { + + /** + * @brief Rewrite Initiator Flow DMAC + */ + SAI_DASH_HA_REWRITE_IFLOW_DMAC = 1 << 0; + + /** + * @brief Rewrite Initiator Flow Source IP Address + */ + SAI_DASH_HA_REWRITE_IFLOW_SIP = 1 << 1; + + /** + * @brief Rewrite Initiator Flow Source Port + */ + SAI_DASH_HA_REWRITE_IFLOW_SPORT = 1 << 2; + + /** + * @brief Rewrite Initiator Flow VNI + */ + SAI_DASH_HA_REWRITE_IFLOW_VNI = 1 << 3; + + /** + * @brief Rewrite Reverse Flow Source IP addresss + */ + SAI_DASH_HA_REWRITE_RFLOW_SIP = 1 << 4; + + /** + * @brief Rewrite Reverse Flow Destination IP Address + */ + SAI_DASH_HA_REWRITE_RFLOW_DIP = 1 << 5; + + /** + * @brief Rewrite Reverse Flow L4 Destination Port + */ + SAI_DASH_HA_REWRITE_RFLOW_DPORT = 1 << 6; + + /** + * @brief Rewrite Reverse Flow L4 Source Port + */ + SAI_DASH_HA_REWRITE_RFLOW_SPORT = 1 << 7; + + /** + * @brief Rewrite Reverse Flow VNI + */ + SAI_DASH_HA_REWRITE_RFLOW_VNI = 1 << 8; + +} sai_dash_ha_rewrite_flags_t; + +/** + * @brief Rewrite info for Flow sync messages + * + */ +typedef struct _sai_dash_ha_rewrite_info_t { + /** + * @brief Initiator Flow DMAC + */ + sai_mac_t iflow_dmac; + + /** + * @brief Initiator Flow Source IP address + */ + sai_ip_address_t iflow_sip; + + /** + * @brief Initiator Flow L4 Source Port + */ + sai_uint16_t iflow_sport; + + /** + * @brief Initiator Flow VNID + */ + sai_uint32_t iflow_vni; + + /** + * @brief Initiator Flow Rewrite Flags expressed as a bit map of sai_dash_ha_rewrite_flags_t + */ + sai_uint16_t iflow_flags; + + /** + * @brief Reverse Flow Source IP address + */ + sai_ip_address_t rflow_sip; + + /** + * @brief Reverse Flow Destination IP address + */ + sai_ip_address_t rflow_dip; + + /** + * @brief Reverse Flow Destination Port + */ + sai_uint16_t rflow_dport; + + /** + * @brief Reverse Flow Source Port + */ + sai_uint16_t rflow_sport; + + /** + * @brief Reverse Flow VNID + */ + sai_uint32_t iflow_vni; + + /** + * @brief Reverse Flow Rewrite Flags expressed as a bit map of sai_dash_ha_rewrite_flags_t + */ + sai_uint16_t iflow_flags; +} sai_dash_ha_rewrite_info_t; + +/** + * @brief data format for the Flow Sync Message + * + */ +typedef struct _sai_dash_ha_flow_sync_message_metadata_t { + + /** + * @brief Policy results for this flow + */ + sai_dash_ha_policy_result_t policy_result; + + /** + * @brief Dest PA from mapping lookup if available. + */ + sai_ip_address_t dest_pa; + + /** + * @brief ID of metering class to be used + */ + sai_object_id_t meetering_class; + + /** + * @brief Rewrite information for the flow + */ + sai_dash_ha_rewrite_info_t rewrite_info; + + /** + * @brief Vendor specific metadata + */ + sai_u8_list_t vendor_metadata; + +} sai_dash_ha_flow_sync_message_metadata_t; + +/** + * @brief Data format for received flow sync messages from the DPU */ typedef struct _sai_dash_ha_flow_sync_message_notification_data_t { /** @@ -323,7 +506,7 @@ typedef struct _sai_dash_ha_flow_sync_message_notification_data_t { } sai_dash_ha_flow_sync_message_notification_data_t; /** - * @brief Notification Data format for received oper state updates from the DPU + * @brief Notification Data format for received operational state updates from the DPU */ typedef struct _sai_dash_ha_oper_role_status_notification_data_t { /** @@ -342,6 +525,21 @@ typedef struct _sai_dash_ha_oper_role_status_notification_data_t { sai_u8_list_t data; } +/** + * @brief HA Operational Role notification + * + * Notification of change of HA Operational role + * + * @param[in] sai_object_id_t vipID + * @param[in] attr_count Number of attributes + * @param[in] attr_list Array of attributes + * + */ +typedef void (*sai_dash_ha_oper_role_notification_fn) ( + _In_ sai_object_id_t *dash_ha_vip_id, + _In_ uint32_t attr_count, + _In_ const sai_attribute_t *attr_list); + /** * @brief L4 information for TCP and UDP flows. */ @@ -379,7 +577,7 @@ typedef union _sai_dash_ha_flow_l4_info_t { } sai_dash_ha_flow_l4_info_t; /** - * @brief Attribute data for #SAI_DASH_HA_SESSION_ATTR_ROLE + * @brief HA Session Roles enumeration */ typedef enum _sai_dash_ha_session_role_t { @@ -395,6 +593,17 @@ typedef enum _sai_dash_ha_session_role_t } sai_dash_ha_session_role_t; +/** + * @brief HA Session Encapsulations enumeration + */ +typedef enum _sai_dash_ha_session_dp_encap_t +{ + /** + * @brief UDP encapsulation. + */ + SAI_DASH_HA_SESSION_ENCAP_UDP, +} sai_dash_ha_session_dp_encap_t; + /** * @brief Attribute ID for DASH HA session */ @@ -413,6 +622,30 @@ typedef enum _sai_dash_ha_session_attr_t */ SAI_DASH_HA_SESSION_ATTR_PEER_IP, + /** + * @brief Source IP address + * + * @type sai_ip_address_t + * @flags MANDATORY_ON_CREATE | CREATE_ONLY + */ + SAI_DASH_HA_SESSION_ATTR_SOURCE_IP, + + /** + * @brief IP DSCP value for control messages + * + * @type sai_uint8_t + * @flags MANDATORY_ON_CREATE | CREATE_ONLY + */ + SAI_DASH_HA_SESSION_ATTR_IP_DSCP, + + /** + * @brief Encapsulation used for DP control messages + * + * @type sai_dash_ha_session_dp_encap_t + * @flags MANDATORY_ON_CREATE | CREATE_ONLY + */ + SAI_DASH_HA_SESSION_ATTR_DP_ENCAP, + /** * @brief Sessions Admin role * @@ -423,7 +656,7 @@ typedef enum _sai_dash_ha_session_attr_t SAI_DASH_HA_SESSION_ATTR_ADMIN_ROLE, /** - * @brief HB Interval + * @brief HB Interval in milliseconds * @type sai_uint16_t */ SAI_DASH_HA_SESSION_ATTR_HB_INTERVAL, @@ -436,6 +669,7 @@ typedef enum _sai_dash_ha_session_attr_t /** * @brief Named pipe for bi-directional control stream + * Used for FLow sync message and DPU control messages * @type sai_uint8_list_t */ SAI_DASH_HA_REGISTER_CP_CHANNEL_ATTR_NAMED_PIPE, @@ -498,7 +732,7 @@ typedef sai_status_t (*sai_get_dash_ha_session_attribute_fn)( _Inout_ sai_attribute_t *attr_list); /** - * @brief Attributes ID for get_peer_capabilities + * @brief Attributes ID for get_capabilities */ typedef enum _sai_dash_ha_get_capabilities_attr_t { @@ -519,6 +753,12 @@ typedef enum _sai_dash_ha_get_capabilities_attr_t { */ SAI_DASH_HA_GET_CAPABILITIES_ATTR_HB_MISS_COUNT, + /** + * @brief Encap for DP messages + * @type sai_dash_ha_session_dp_encap_t + */ + SAI_DASH_HA_GET_CAPABILITIES_ATTR_DP_ENCAP, + /** * @brief Capabilities * @type sai_uint8_list_t @@ -568,6 +808,12 @@ typedef enum _sai_dash_ha_process_peer_capabilities_attr_t { */ SAI_DASH_HA_PROCESS_PEER_CAPABILITIES_ATTR_HB_MISS_COUNT, + /** + * @brief Encap for DP messages + * @type sai_dash_ha_session_dp_encap_t + */ + SAI_DASH_HA_GET_CAPABILITIES_ATTR_DP_ENCAP, + /** * @brief Capabilities * @type sai_uint8_list_t @@ -1012,6 +1258,11 @@ enum OperRole { OperStandalone = 3; } +// Encap used by DP +enum MsgEncap { + // default UDP encap + UDP = 0; +} // IP Address object message IPAddress { @@ -1058,6 +1309,52 @@ message IPFlowKey { FlowL4Info L4Info = 5; } +// policy result enumeration +enum PolicyResult { + NONE = 0; + ALLOW = 1; + DENY = 2; +} + +enum RewriteFlags { + IFLOW_DMAC = 0; + IFLOW_SIP = 1; + IFLOW_SPORT = 2; + IFLOW_VNI = 3; + RFLOW_SIP = 4; + RFLOW_DIP = 5; + RFLOW_DPORT = 6; + RFLOW_SPORT = 7; + RFLOW_VNI = 8; +} +// Packet rewrite information for a flow +message RewriteInfo { + uint64 IFlowMAC = 1; + IPAddress IFlowSIp = 2; + uint32 IFlowSPort = 3; + uint32 IFlowVNI = 4; + IPAddress RFlowSIp = 5; + IPAddress RFlowDIp = 6; + uint32 RFlowDPort = 7; + uint32 RFlowSPort = 8; + uint32 RFlowVNI = 9; + repeated RewriteFlags RewriteFlags = 10; +} + +// Metadata for the flow +message FlowMetadata { + // Policy results for the flow + PolicyResult PolicyResult = 1; + // Destination PA from mapping lookup if available + IPAddress DestPA = 2; + // Metering class for the flow if available + bytes MeteringClass = 3; + // Rewrite Information for the flow + RewriteInfo RewriteInfo = 4; + // Vendor specific metadata results + bytes VendorData = 5; +} + // Flow Sync Msg message FlowSyncMsg { message FlowInfo { @@ -1066,7 +1363,7 @@ message FlowSyncMsg { // IP Flow tuple IPFlowKey Key = 2; // Metadata containing policy results - bytes Metadata = 3; + FlowMetadata Metadata = 3; } repeated FlowInfo Info = 1; } @@ -1116,8 +1413,10 @@ message CompatCheck { uint32 HBinterval = 1; // Number of HB misses that will trigger switchover uint32 MissCount = 2; + // Encap used for Messages + MsgEncap Encap = 3; // Opaque - bytes Capabilities = 3; + bytes Capabilities = 4; } // Compatibility/Capability information for each VIP on the node. Typically two entries. repeated DpVIPInfo VipInfo = 1; From 0fe12f93147346efd8f2abded77bb3c720464090 Mon Sep 17 00:00:00 2001 From: Sanjay Thyamagundalu Date: Tue, 8 Nov 2022 09:13:41 -0800 Subject: [PATCH 2/3] address review comments --- .../high-avail/AMD-Pensando_HA_Proposal.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/documentation/high-avail/AMD-Pensando_HA_Proposal.md b/documentation/high-avail/AMD-Pensando_HA_Proposal.md index ecd5a250c..61f364410 100644 --- a/documentation/high-avail/AMD-Pensando_HA_Proposal.md +++ b/documentation/high-avail/AMD-Pensando_HA_Proposal.md @@ -381,6 +381,11 @@ typedef enum _sai_dash_ha_rewrite_flags_t { * */ typedef struct _sai_dash_ha_rewrite_info_t { + /** + * @brief Flow Rewrite Flags expressed as a bit map of sai_dash_ha_rewrite_flags_t + */ + sai_uint64_t rewrite_flags; + /** * @brief Initiator Flow DMAC */ @@ -401,11 +406,6 @@ typedef struct _sai_dash_ha_rewrite_info_t { */ sai_uint32_t iflow_vni; - /** - * @brief Initiator Flow Rewrite Flags expressed as a bit map of sai_dash_ha_rewrite_flags_t - */ - sai_uint16_t iflow_flags; - /** * @brief Reverse Flow Source IP address */ @@ -429,12 +429,7 @@ typedef struct _sai_dash_ha_rewrite_info_t { /** * @brief Reverse Flow VNID */ - sai_uint32_t iflow_vni; - - /** - * @brief Reverse Flow Rewrite Flags expressed as a bit map of sai_dash_ha_rewrite_flags_t - */ - sai_uint16_t iflow_flags; + sai_uint32_t rflow_vni; } sai_dash_ha_rewrite_info_t; /** @@ -456,7 +451,7 @@ typedef struct _sai_dash_ha_flow_sync_message_metadata_t { /** * @brief ID of metering class to be used */ - sai_object_id_t meetering_class; + sai_uint64_t meetering_class; /** * @brief Rewrite information for the flow From ee52972c0eba2e93fd517a8ad10a929e92aeb467 Mon Sep 17 00:00:00 2001 From: Sanjay Thyamagundalu Date: Mon, 14 Nov 2022 23:44:03 -0800 Subject: [PATCH 3/3] fix typo --- documentation/high-avail/AMD-Pensando_HA_Proposal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/high-avail/AMD-Pensando_HA_Proposal.md b/documentation/high-avail/AMD-Pensando_HA_Proposal.md index 61f364410..74d3189ea 100644 --- a/documentation/high-avail/AMD-Pensando_HA_Proposal.md +++ b/documentation/high-avail/AMD-Pensando_HA_Proposal.md @@ -451,7 +451,7 @@ typedef struct _sai_dash_ha_flow_sync_message_metadata_t { /** * @brief ID of metering class to be used */ - sai_uint64_t meetering_class; + sai_uint64_t metering_class; /** * @brief Rewrite information for the flow