Skip to content

Commit

Permalink
Merge branch 'opencomputeproject:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
prafull-brcm committed Oct 20, 2023
2 parents 2f0f3b2 + bd1b722 commit 8e99127
Show file tree
Hide file tree
Showing 13 changed files with 1,243 additions and 912 deletions.
2 changes: 1 addition & 1 deletion bm/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ** WARNING ** THIS DIRECTORY IS DEPRECATED AND WILL BE REMOVED END OF 2023
# ** WARNING ** USE tests/saithriftv2 and sonic-net/DASH repo for bvm2/p4 model
# ** WARNING ** USE tests/saithriftv2 and sonic-net/DASH repo for bmv2/p4 model

# SAI BEHAVIORAL MODEL
This repository clearly defines widely accepted network switch behaviour.
Expand Down
2 changes: 1 addition & 1 deletion bm/build_p4_target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo
echo "** WARNING ** THIS DIRECTORY IS DEPRECATED AND WILL BE REMOVED END OF 2023"
echo "** WARNING ** USE tests/saithriftv2 and sonic-net/DASH repo for bvm2/p4 model"
echo "** WARNING ** USE tests/saithriftv2 and sonic-net/DASH repo for bmv2/p4 model"
echo

sleep 10
Expand Down
234 changes: 234 additions & 0 deletions doc/SAI_Cable_Diagnostics_Port_Attribute_v0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
![](media/image1.png){width="4.231944444444444in" height="5.34375in"}

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

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

Switch Abstraction Interface

Change Proposal

-----------------------------------------------------------------------------
**Title** **Cable Diagnostics Proposal**
----------------- -----------------------------------------------------------
**Authors** **Broadcom Inc**

**Status** **In Review**

**Type** **Standards Track**

**Created** **10/06/2023**

**SAI-Version** **V0.0**
-----------------------------------------------------------------------------

1 Overview [3](#overview)

2 Cable diagnostics Use Case [3](#cable-diagnostics-use-case)

3 Attribute Specification [4](#attribute-specification)

3.1 Changes in file saiport.h [4](#changes-in-file-saiport.h)

4 Examples [5](#examples)

4.1 Cable Diagnostics Usage [5](#cable-diagnostics-usage)

# Overview

When a link is up and operating normally with adequate bit error
performance, there is no need for any diagnostic either on the
digital/analog portion of the link or on the cable connecting the link.
However, the characteristics of the problems associated with a cable
become of paramount concern when a link cannot be established or is
performing poorly.

Enhanced Cable Diagnostics (ECD) provides with intelligent
pre-processing and post-processing algorithm inside HW that can be
initiated at any time by setting specific register bits and then reading
the results.

# Cable diagnostics Use Case

# Attribute Specification

## Changes in file saiport.h

/\* Data Types \*/

/\*\*

\* \@brief Attribute data for #SAI_PORT_ATTR_CABLE_PAIR_STATE

\* Copper cable pair states

\*/

typedef enum \_sai_port_cable_pair_state_t

{

/\*\* Cable pair state is good \*/

SAI_PORT_CABLE_PAIR_STATE_OK,

/\*\* The MDI Cable pair state open \*/

SAI_PORT_CABLE_PAIR_STATE_OPEN,

/\*\* The MDI Cable pair state short (intra-short) \*/

SAI_PORT_CABLE_PAIR_STATE_SHORT,

/\*\* The MDI Cable pair state is shorted with another pair
(inter-short) cross talk \*/

SAI_PORT_CABLE_PAIR_STATE_CROSSTALK,

/\*\* Cable state unknown \*/

SAI_PORT_CABLE_PAIR_STATE_UNKNOWN

} sai_port_cable_pair_state_t;

/\*\*

\* \@brief Attribute data for #SAI_PORT_ATTR_CABLE_TYPE

\* Copper cable types

\*/

typedef enum \_sai_port_cable_type_t

{

/\*\* Cable type Unknown \*/

SAI_PORT_CABLE_TYPE_UNKNOWN,

/\*\* Cable type CAT5 \*/

SAI_PORT_CABLE_TYPE_CAT5,

/\*\* Cable type CAT5E \*/

SAI_PORT_CABLE_TYPE_CAT5E,

/\*\* Cable type CAT6 \*/

SAI_PORT_CABLE_TYPE_CAT6,

/\*\* Cable type CAT6A \*/

SAI_PORT_CABLE_TYPE_CAT6A,

/\*\* Cable type CAT7 \*/

SAI_PORT_CABLE_TYPE_CAT7

} sai_port_cable_type_t;

/\* Port Attribute \*/

/\*\*

\* \@brief Read ethernet copper cable pair status.

\*

\* Returns pair states sequentially from list index 0 to n (n = number
of pairs - 1)

\* value of n depends on number of pairs in twisted ethernet copper
cable

\* Cable diagnostics triggers ECD once cable pair states is requested,
it is synchronous call.

\*

\* \@type sai_s32_list_t sai_port_cable_pair_state_t

\* \@flags READ_ONLY

\*/

SAI_PORT_ATTR_CABLE_PAIR_STATE,

/\*\*

\* \@brief Get ethernet copper cable pair length (unit meter)

\*

\* Returns ethernet cable pair length sequentially from list index 0 to
n (n = number of pairs - 1)

\* value of n depends on number of pairs in twisted ethernet copper
cable

\* Cable diagnostics runs once cable pair length is requested, it is
synchronous call.

\*

\* \@type sai_s32_list_t

\* \@flags READ_ONLY

\*/

SAI_PORT_ATTR_CABLE_PAIR_LENGTH,

/\*\*

\* \@brief Configure ethernet copper cable type to check the cable
status

\*

\* \@type sai_port_cable_type_t

\* \@flags CREATE_AND_SET

\* \@default SAI_PORT_CABLE_TYPE_UNKNOWN

\* \@validonly SAI_PORT_ATTR_MEDIA_TYPE == SAI_PORT_MEDIA_TYPE_COPPER

\*/

SAI_PORT_ATTR_CABLE_TYPE,

# Examples

## Cable Diagnostics Usage

sai_attr_set\[0\].id = SAI_PORT_ATTR_CABLE_TYPE;

sai_attr_set\[0\].value.s32 = SAI_PORT_CABLE_TYPE_CAT6;

.

.

ret = create_port(&phy_2_system_port_id_0, phy_2_switch_id, 2,

This comment has been minimized.

Copy link
@jiahua-wang

jiahua-wang Oct 20, 2023

Contributor

@prafull-brcm It is better to say something like "assume the sai port has been created with port_oid_0. The current description may lead to a wrong impression that user has to create port every time before does TDR test. In real use case, port is always created long before TDR test.

sai_attr_set);

**or**

Cable type can be set latter using set port attribute function.

**set_port_attribute(**phy_2_system_port_id_0**, &sai_attr_set);**

**Cable pair status and cable length is read only attribute, can be
called anytime.**

sai_attr_get.id = SAI_PORT_ATTR_CABLE_PAIR_STATE;

ret = get_port_attribute(phy_2_system_port_id_0,1, &sai_attr_get);

**Note:** Please note that cable diagnostics is debug feature it puts
chip in debug mode user needs to re-configure the mode and
auto-negotiation after cable pair status and cable length attribute is
requested to work in normal mode.
8 changes: 4 additions & 4 deletions inc/saiport.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,16 @@ typedef enum _sai_port_media_type_t
*/
typedef enum _sai_port_cable_pair_state_t
{
/** Cable state no faults */
/** Cable pair state is good */
SAI_PORT_CABLE_PAIR_STATE_OK,

/** Cable state open */
/** The Cable pair state open */
SAI_PORT_CABLE_PAIR_STATE_OPEN,

/** Cable state short */
/** The Cable pair state short (within pair) */
SAI_PORT_CABLE_PAIR_STATE_SHORT,

/** Cable state cross talk */
/** The Cable pair state is shorted with another pair (inter-short) cross talk */
SAI_PORT_CABLE_PAIR_STATE_CROSSTALK,

/** Cable state unknown */
Expand Down
2 changes: 1 addition & 1 deletion inc/saitunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ typedef enum _sai_tunnel_term_table_entry_attr_t
* @brief Tunnel virtual router id
*
* @type sai_object_id_t
* @flags MANDATORY_ON_CREATE | CREATE_ONLY
* @flags MANDATORY_ON_CREATE | CREATE_AND_SET
* @objects SAI_OBJECT_TYPE_VIRTUAL_ROUTER
*/
SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_VR_ID = SAI_TUNNEL_TERM_TABLE_ENTRY_ATTR_START,
Expand Down
Loading

0 comments on commit 8e99127

Please sign in to comment.