Skip to content

Commit

Permalink
Fix Twamp Light Compile Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanYoush committed Apr 10, 2023
1 parent 135c203 commit 90dd0b3
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 21 deletions.
6 changes: 3 additions & 3 deletions doc/TWAMP-LIGHT/SAI-Proposal-TWAMP-LIGHT.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ SAI TWAMP Light API Proposal
-------------|-----------------------------------------------------------------
Authors | CENTEC
Status | In review
Type | Experimental track
Type | Standards track
Created | 03/01/2023
Updated | 03/01/2023
SAI-Version | 1.11
SAI-Version | 1.12

-------------------------------------------------------------------------------

Expand Down Expand Up @@ -637,4 +637,4 @@ twamp_session_attr[11].value.u32 = 20000;
twamp_session_attr[12].id = SAI_TWAMP_SESSION_ATTR_UDP_DST_PORT;
twamp_session_attr[12].value.u32 = 20001;
status = sai_twamp_api->create_twamp_session(&twamp_session_id, gSwitchId, (uint32_t)twamp_session_attr.size(), twamp_session_attr.data());
~~~
~~~
8 changes: 0 additions & 8 deletions experimental/saiswitchextensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ typedef enum _sai_switch_attr_extensions_t
{
SAI_SWITCH_ATTR_EXTENSIONS_RANGE_START = SAI_SWITCH_ATTR_END,

/**
* @brief Max number of Two-Way Active Measurement Protocol session supports
*
* @type sai_uint32_t
* @flags READ_ONLY
*/
SAI_SWITCH_ATTR_MAX_TWAMP_SESSION,

SAI_SWITCH_ATTR_EXTENSIONS_RANGE_END

} sai_switch_attr_extensions_t;
Expand Down
2 changes: 2 additions & 0 deletions inc/sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#include "saidebugcounter.h"
#include "saimymac.h"
#include "saigenericprogrammable.h"
#include "saitwamp.h"
#include "saiversion.h"

/**
Expand Down Expand Up @@ -144,6 +145,7 @@ typedef enum _sai_api_t
SAI_API_GENERIC_PROGRAMMABLE = 47, /**<sai_generic_programmable_t */
SAI_API_ARS = 48, /**<sai_ars_api_t */
SAI_API_ARS_PROFILE = 49, /**<sai_ars_api_profile_t */
SAI_API_TWAMP = 50, /**< sai_twamp_api_t */
SAI_API_MAX, /**< total number of APIs */
} sai_api_t;

Expand Down
8 changes: 8 additions & 0 deletions inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -2873,6 +2873,14 @@ typedef enum _sai_switch_attr_t
*/
SAI_SWITCH_ATTR_HOSTIF_OPER_STATUS_UPDATE_MODE,

/**
* @brief Max number of Two-Way Active Measurement Protocol session supports
*
* @type sai_uint32_t
* @flags READ_ONLY
*/
SAI_SWITCH_ATTR_MAX_TWAMP_SESSION,

/**
* @brief End of attributes
*/
Expand Down
20 changes: 11 additions & 9 deletions inc/saitwamp.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,8 @@ typedef enum _sai_twamp_session_attr_t
* @brief Two-Way Active Measurement Protocol test packet outer vlan id
*
* @type sai_uint16_t
* @flags CREATE_ONLY
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @isvlan true
* @default 0
* @condition SAI_TWAMP_SESSION_ATTR_TWAMP_ENCAPSULATION_TYPE == SAI_TWAMP_ENCAPSULATION_TYPE_L2VPN_UNI or SAI_TWAMP_SESSION_ATTR_TWAMP_ENCAPSULATION_TYPE == SAI_TWAMP_ENCAPSULATION_TYPE_L2VPN_NNI
*/
SAI_TWAMP_SESSION_ATTR_OUTER_VLANID,
Expand All @@ -206,9 +205,8 @@ typedef enum _sai_twamp_session_attr_t
* @brief Two-Way Active Measurement Protocol test packet inner vlan id
*
* @type sai_uint16_t
* @flags CREATE_ONLY
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @isvlan true
* @default 0
* @condition SAI_TWAMP_SESSION_ATTR_TWAMP_ENCAPSULATION_TYPE == SAI_TWAMP_ENCAPSULATION_TYPE_L2VPN_UNI or SAI_TWAMP_SESSION_ATTR_TWAMP_ENCAPSULATION_TYPE == SAI_TWAMP_ENCAPSULATION_TYPE_L2VPN_NNI
*/
SAI_TWAMP_SESSION_ATTR_INNER_VLANID,
Expand Down Expand Up @@ -344,16 +342,18 @@ typedef enum _sai_twamp_session_attr_t
* @brief Two-Way Active Measurement Protocol packet tx mode: CONTINUOUS, PACKET_NUM, PERIOD
*
* @type sai_twamp_pkt_tx_mode_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @condition SAI_TWAMP_SESSION_ATTR_SESSION_ROLE == SAI_TWAMP_SESSION_ROLE_SENDER
* @flags CREATE_ONLY
* @default SAI_TWAMP_PKT_TX_MODE_PACKET_NUM
* @validonly SAI_TWAMP_SESSION_ATTR_SESSION_ROLE == SAI_TWAMP_SESSION_ROLE_SENDER
*/
SAI_TWAMP_SESSION_ATTR_TWAMP_PKT_TX_MODE,

/**
* @brief Two-Way Active Measurement Protocol test packet tx duration per micro second, timeout of the tx packet generation
*
* @type sai_uint32_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @flags CREATE_ONLY
* @default 0
* @validonly SAI_TWAMP_SESSION_ATTR_SESSION_ROLE == SAI_TWAMP_SESSION_ROLE_SENDER and SAI_TWAMP_SESSION_ATTR_TWAMP_PKT_TX_MODE == SAI_TWAMP_PKT_TX_MODE_CONTINUOUS
*/
SAI_TWAMP_SESSION_ATTR_TX_PKT_DURATION,
Expand All @@ -362,7 +362,8 @@ typedef enum _sai_twamp_session_attr_t
* @brief Two-Way Active Measurement Protocol test packet tx count, configuring by Two-Way Active Measurement Protocol send packet count of Tx
*
* @type sai_uint32_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @flags CREATE_ONLY
* @default 0
* @validonly SAI_TWAMP_SESSION_ATTR_SESSION_ROLE == SAI_TWAMP_SESSION_ROLE_SENDER and SAI_TWAMP_SESSION_ATTR_TWAMP_PKT_TX_MODE == SAI_TWAMP_PKT_TX_MODE_PACKET_NUM
*/
SAI_TWAMP_SESSION_ATTR_TX_PKT_CNT,
Expand All @@ -372,7 +373,8 @@ typedef enum _sai_twamp_session_attr_t
* if tx period equal 0, sender will continue to gen packet, duration configured by SAI_TWAMP_SESSION_ATTR_PKT_TX_PKT_DURATION.
*
* @type sai_uint32_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @flags CREATE_ONLY
* @default 0
* @validonly SAI_TWAMP_SESSION_ATTR_SESSION_ROLE == SAI_TWAMP_SESSION_ROLE_SENDER and SAI_TWAMP_SESSION_ATTR_TWAMP_PKT_TX_MODE == SAI_TWAMP_PKT_TX_MODE_PERIOD
*/
SAI_TWAMP_SESSION_ATTR_TX_PKT_PERIOD,
Expand Down
1 change: 1 addition & 0 deletions inc/saitypes.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ typedef enum _sai_object_type_t
SAI_OBJECT_TYPE_GENERIC_PROGRAMMABLE = 102,
SAI_OBJECT_TYPE_ARS_PROFILE = 103,
SAI_OBJECT_TYPE_ARS = 104,
SAI_OBJECT_TYPE_TWAMP_SESSION = 105,
SAI_OBJECT_TYPE_MAX, /* Must remain in last position */
} sai_object_type_t;

Expand Down
1 change: 1 addition & 0 deletions meta/acronyms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ TLS - Transport Layer Security
TOS - Type Of Service
TPID - Tag Protocol Identifier
TTL - Time to Leave
TWAMP - Two-Way Active Measurement Protocol
UDF - User-Defined Field
UDP - User Datagram Protocol
USD - Ultimate Segment Decapsulation
Expand Down
11 changes: 10 additions & 1 deletion meta/saisanitycheck.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1627,6 +1627,14 @@ void check_attr_validonly(
* MPLS out segment attributes are required for ingress node and valid only for MPLS next hop.
*/
}
else if (md->objecttype == SAI_OBJECT_TYPE_TWAMP_SESSION &&
(md->attrid == SAI_TWAMP_SESSION_ATTR_TX_PKT_DURATION || md->attrid == SAI_TWAMP_SESSION_ATTR_TX_PKT_CNT ||
md->attrid == SAI_TWAMP_SESSION_ATTR_TX_PKT_PERIOD))
{
/*
* TWAMP packet tx mode attributes are depending on TWAMP_PKT_TX_MODE.
*/
}
else
{
META_MD_ASSERT_FAIL(md, "validonly attribute is also validonly attribute, not allowed");
Expand Down Expand Up @@ -4731,7 +4739,8 @@ void check_object_ro_list(
oi->objecttype == SAI_OBJECT_TYPE_DTEL ||
oi->objecttype == SAI_OBJECT_TYPE_DTEL_QUEUE_REPORT ||
oi->objecttype == SAI_OBJECT_TYPE_DTEL_EVENT ||
oi->objecttype == SAI_OBJECT_TYPE_GENERIC_PROGRAMMABLE)
oi->objecttype == SAI_OBJECT_TYPE_GENERIC_PROGRAMMABLE ||
oi->objecttype == SAI_OBJECT_TYPE_TWAMP_SESSION)
{
/*
* We skip hostif table entry since there is no 1 object which can
Expand Down

0 comments on commit 90dd0b3

Please sign in to comment.