Skip to content

Commit de7b5dc

Browse files
objectives:
This request adds a new port API get_port_interrupts_status() to retrieve the status of interrupts. This API is the clear-on-read, the interruption status should be reset after the read. API takes the list of interruptions IDs and returns their status. True means interruption is triggered, false - is not triggered. The list of results should be allocated before the API call, and should have the same size as the list of IDs. Also these changes contain the enum of the interruption IDs sai_port_interrupt_t. Signed-off-by: Oleksandr Rusanov <[email protected]>
1 parent fe69c82 commit de7b5dc

File tree

4 files changed

+89
-3
lines changed

4 files changed

+89
-3
lines changed

inc/saiport.h

+83
Original file line numberDiff line numberDiff line change
@@ -2764,6 +2764,70 @@ typedef enum _sai_port_stat_t
27642764

27652765
} sai_port_stat_t;
27662766

2767+
/**
2768+
* @brief Port interruption IDs in get_port_interrupts_status() call
2769+
*/
2770+
typedef enum _sai_port_interrupt_t
2771+
{
2772+
/** PCS Rx FIFO Empty Interrupt */
2773+
SAI_PORT_INTERRUPT_PCS_RX_FIFO_EMPTY,
2774+
2775+
/** PCS Rx FIFO Full Interrupt */
2776+
SAI_PORT_INTERRUPT_PCS_RX_FIFO_FULL,
2777+
2778+
/** PCS Tx PPM FIFO Overflow Interrupt */
2779+
SAI_PORT_INTERRUPT_PCS_RX_FIFO_OVERFLOW,
2780+
2781+
/** PCS Tx PPM FIFO Underflow Interrupt */
2782+
SAI_PORT_INTERRUPT_PCS_RX_FIFO_UNDERFLOW,
2783+
2784+
/** PCS Tx PPM FIFO Overrun Interrupt */
2785+
SAI_PORT_INTERRUPT_PCS_TX_FIFO_OVERRUN,
2786+
2787+
/** Edge of the Local Fault Condition on Tx Path Interrupt */
2788+
SAI_PORT_INTERRUPT_PCS_RX_LOCAL_FAULT,
2789+
2790+
/** Edge of the Local Fault Condition on Rx Path Interrupt */
2791+
SAI_PORT_INTERRUPT_PCS_TX_LOCAL_FAULT,
2792+
2793+
/** Edge of the Remote Fault Condition on Tx Path Interrupt */
2794+
SAI_PORT_INTERRUPT_PCS_RX_REMOTE_FAULT,
2795+
2796+
/** Edge of the Remote Fault Condition on Rx Path Interrupt */
2797+
SAI_PORT_INTERRUPT_PCS_TX_REMOTE_FAULT,
2798+
2799+
/** Edge of the 4 Local Fault Condition on Tx Path Interrupt */
2800+
SAI_PORT_INTERRUPT_PCS_TX_4LOCAL_FAULT,
2801+
2802+
/** Edge of the 4 Remote Fault Condition on Tx Path Interrupt */
2803+
SAI_PORT_INTERRUPT_PCS_TX_4REMOTE_FAULT,
2804+
2805+
/** PCS Tx PPM FIFO Push back Interrupt */
2806+
SAI_PORT_INTERRUPT_PCS_TX_FIFO_PUSHBACK,
2807+
2808+
/** PCS Tx PPM FIFO Stop Write Interrupt */
2809+
SAI_PORT_INTERRUPT_PCS_TX_FIFO_STOPWRITE,
2810+
2811+
/** PCS Tx LPI Received Interrupt */
2812+
SAI_PORT_INTERRUPT_PCS_LPI_TX,
2813+
2814+
/** PCS Tx LPI Received Interrupt */
2815+
SAI_PORT_INTERRUPT_PCS_LPI_RX,
2816+
2817+
/** PCS Tx PPM FIFO Very High Water Interrupt */
2818+
SAI_PORT_INTERRUPT_PCS_VERY_HIGH,
2819+
2820+
/** High BER Change Interrupt */
2821+
SAI_PORT_INTERRUPT_HIGH_BER_CHANGE,
2822+
2823+
/** Packet CRC Check Error Interrupt */
2824+
SAI_PORT_INTERRUPT_PKT_CRC_ERROR,
2825+
2826+
/** Link Change Interrupt */
2827+
SAI_PORT_INTERRUPT_LINK_CHANGE,
2828+
2829+
} sai_port_interrupt_t;
2830+
27672831
/**
27682832
* @brief Create port
27692833
*
@@ -2874,6 +2938,24 @@ typedef sai_status_t (*sai_clear_port_stats_fn)(
28742938
typedef sai_status_t (*sai_clear_port_all_stats_fn)(
28752939
_In_ sai_object_id_t port_id);
28762940

2941+
/**
2942+
* @brief Get port interruptions status.
2943+
*
2944+
* This API is clear-on-read, the interruption status should be reset after the read.
2945+
*
2946+
* @param[in] port_id Port id
2947+
* @param[in] count Number of interruptions ids in the array
2948+
* @param[in] interrupt_ids Specifies the array of interrupts ids
2949+
* @param[out] stats Array of resulting interruptions status.
2950+
*
2951+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
2952+
*/
2953+
typedef sai_status_t (*sai_get_port_interrupts_status_fn)(
2954+
_In_ sai_object_id_t port_id,
2955+
_In_ uint32_t count,
2956+
_In_ const sai_interrupt_id_t *interrupt_ids,
2957+
_Out_ bool *stats);
2958+
28772959
/**
28782960
* @brief Port state change notification
28792961
*
@@ -3485,6 +3567,7 @@ typedef struct _sai_port_api_t
34853567
sai_get_port_stats_ext_fn get_port_stats_ext;
34863568
sai_clear_port_stats_fn clear_port_stats;
34873569
sai_clear_port_all_stats_fn clear_port_all_stats;
3570+
sai_get_port_interrupts_status_fn get_port_interrupts_status;
34883571
sai_create_port_pool_fn create_port_pool;
34893572
sai_remove_port_pool_fn remove_port_pool;
34903573
sai_set_port_pool_attribute_fn set_port_pool_attribute;

inc/saitypes.h

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ typedef uint8_t sai_auth_key_t[16];
106106
typedef uint8_t sai_macsec_sak_t[32];
107107
typedef uint8_t sai_macsec_auth_key_t[16];
108108
typedef uint8_t sai_macsec_salt_t[12];
109+
typedef uint32_t sai_interrupt_id_t;
109110

110111
#define _In_
111112
#define _Out_

meta/acronyms.txt

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ AN - Auto Negotiation
66
API - Application Program Interface
77
ARP - Address Resolution Protocol
88
ASIC - Application Specific Integrated Circuit
9+
BER - Bit Error Rate
910
BFD - Bidirectional Forwarding Detection
1011
BFDV6 - Bidirectional Forwarding Detection for IPv6
1112
BGP - Border Gateway Protocol
@@ -73,6 +74,7 @@ L2MC - Layer 2 Multi Cast
7374
L3 - Layer 3
7475
LAG - Link Aggregation Group
7576
LDP - Label Distribution Protocol
77+
LPI - Locality-specific Peripheral Interrupts
7678
LPM - Longest Prefix Match
7779
LSP - Label Switched Path
7880
MAC - Medium Access Control

meta/style.pm

+3-3
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ sub CheckFunctionsParams
288288
next if not $fname =~ /_fn$/; # below don't apply for global functions
289289

290290
if (not $fnparams =~ /^(\w+)(| attr| attr_count attr_list| switch_id attr_count attr_list)$/ and
291-
not $fname =~ /_(stats|stats_ext|notification)_fn$|^sai_(send|allocate|free|recv|bulk)_|^sai_meta/)
291+
not $fname =~ /_(stats|stats_ext|notification|interrupts_status)_fn$|^sai_(send|allocate|free|recv|bulk)_|^sai_meta/)
292292
{
293293
LogWarning "wrong param names: $fnparams: $fname";
294294
LogWarning " expected: $params[0](| attr| attr_count attr_list| switch_id attr_count attr_list)";
295295
}
296296

297-
if ($fname =~ /^sai_(get|set|create|remove)_(\w+?)(_attribute)?(_stats|_stats_ext)?_fn/)
297+
if ($fname =~ /^sai_(get|set|create|remove)_(\w+?)(_attribute)?(_stats|_stats_ext|_interrupts_status)?_fn/)
298298
{
299299
my $pattern = $2;
300300
my $first = $params[0];
@@ -457,7 +457,7 @@ sub CheckFunctionNaming
457457
{
458458
# ok
459459
}
460-
elsif ($name =~ /^(get|clear)_(\w+?)_(all_)?stats(_ext)?$/)
460+
elsif ($name =~ /^(get|clear)_(\w+?)_(all_)?(stats|stats_ext|interrupts_status)?$/)
461461
{
462462
LogWarning "not object name $2 in $name" if not IsObjectName($2);
463463
}

0 commit comments

Comments
 (0)