Skip to content

Add packet trimming counter #2177

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

Merged
merged 1 commit into from
Jul 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions inc/saiport.h
Original file line number Diff line number Diff line change
Expand Up @@ -3368,6 +3368,12 @@ typedef enum _sai_port_stat_t
/** Packets trimmed due to failed shared buffer admission [uint64_t] */
SAI_PORT_STAT_TRIM_PACKETS,

/** Packets trimmed but dropped due to failed shared buffer admission on a trim queue */
SAI_PORT_STAT_DROPPED_TRIM_PACKETS,

/** Packets trimmed and successfully transmitted on port */
SAI_PORT_STAT_TX_TRIM_PACKETS,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Please change it to
SAI_PORT_STAT_TX_TRIM_PACKETS

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JaiOCP - done

/** Port stat in drop reasons range start */
SAI_PORT_STAT_IN_DROP_REASON_RANGE_BASE = 0x00001000,

Expand Down
6 changes: 6 additions & 0 deletions inc/saiqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,12 @@ typedef enum _sai_queue_stat_t
/** Get watermark queue shared occupancy in cells [uint64_t] */
SAI_QUEUE_STAT_SHARED_WATERMARK_CELLS = 0x0000002c,

/** Packets trimmed but failed to be admitted on a trim queue due to congestion. Counted on the original trimming-eligible queue [uint64_t] */
SAI_QUEUE_STAT_DROPPED_TRIM_PACKETS = 0x0000002d,

/** Packets trimmed and successfully transmitted on a trim queue. Counted on the original trimming-eligible queue [uint64_t] */
SAI_QUEUE_STAT_TX_TRIM_PACKETS = 0x0000002e,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functional relationship between DROPPED_TRIM_PACKETS and TX_TRIM_PACKETS isn't clear. If TX_TRIM_PACKETS represents successfully transmitted trimmed packets, consider clarifying whether these are mutually exclusive counts or if there's overlap.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no overlap.
DROPPED_TRIM_PACKETS == trimmed & not sent
TX_TRIM_PACKETS == trimmed & sent


/** Custom range base value */
SAI_QUEUE_STAT_CUSTOM_RANGE_BASE = 0x10000000

Expand Down
12 changes: 12 additions & 0 deletions inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -3518,6 +3518,15 @@ typedef enum _sai_switch_asic_sdk_health_category_t
*/
typedef enum _sai_switch_stat_t
{
/** Switch stat range start */
SAI_SWITCH_STAT_START,

/** Global (switch-wise) counter of packets trimmed but dropped due to failed shared buffer admission on a trim queue */
SAI_SWITCH_STAT_DROPPED_TRIM_PACKETS = SAI_SWITCH_STAT_START,

/** Global (switch-wise) counter of packets trimmed and successfully sent on a trim queue */
SAI_SWITCH_STAT_TX_TRIM_PACKETS,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this for all ports and therefore queues cumulatively? if so, please make this explicit in the comments

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is mentioned as "Global (switch-wise)"


/** Switch stat in drop reasons range start */
SAI_SWITCH_STAT_IN_DROP_REASON_RANGE_BASE = 0x00001000,

Expand Down Expand Up @@ -3599,6 +3608,9 @@ typedef enum _sai_switch_stat_t
/** Switch stat fabric drop reasons range end */
SAI_SWITCH_STAT_FABRIC_DROP_REASON_RANGE_END = 0x00003fff,

/** Switch stat range end */
SAI_SWITCH_STAT_END,
Copy link
Contributor

@bandaru-viswanath bandaru-viswanath Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along side PORT and QUEUE, why not introduce TRIM_SENT_PACKETS for SWITCH also ? Will be consistent across.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added. Thanks for suggestion


} sai_switch_stat_t;

/**
Expand Down