Skip to content
Closed
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
635 changes: 635 additions & 0 deletions doc/fw/SAI-FW-API.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions inc/sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "saibuffer.h"
#include "saicounter.h"
#include "saifdb.h"
#include "saifw.h"
#include "saihash.h"
#include "saihostif.h"
#include "saiipmcgroup.h"
Expand Down Expand Up @@ -157,6 +158,7 @@ typedef enum _sai_api_t
SAI_API_SYNCE = 54, /**< sai_synce_api_t */
SAI_API_VIRTUAL_CHANNEL = 55, /**< sai_virtual_channel_api_t */
SAI_API_PERFMON = 56, /**< sai_perfmon_api_t */
SAI_API_FW = 57, /**< sai_fw_api_t */
SAI_API_MAX, /**< total number of APIs */

/**
Expand Down
217 changes: 217 additions & 0 deletions inc/saifw.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
/**
* Copyright (c) 2014 Microsoft Open Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
* LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
* FOR A PARTICULAR PURPOSE, MERCHANTABILITY OR NON-INFRINGEMENT.
*
* See the Apache Version 2.0 License for specific language governing
* permissions and limitations under the License.
*
* Microsoft would like to thank the following companies for their review and
* assistance with these files: Intel Corporation, Mellanox Technologies Ltd,
* Dell Products, L.P., Facebook, Inc., Marvell International Ltd.
*
* @file saifw.h
*
* @brief This module defines SAI Firmware spec
*/

#if !defined (__SAIFW_H_)
#define __SAIFW_H_

#include <saitypes.h>

/**
* @defgroup SAIFW SAI - Firmware specific API definitions
*
* @{
*/

/**
* @brief SAI firmware operational state
*/
typedef enum _sai_fw_op_state_t
{
/** Firmware operational state is firmware is loaded but not started */
SAI_FW_OP_STATE_LOADED,

/** Firmware operational state is firmware is not loaded */
SAI_FW_OP_STATE_NOT_LOADED,

/** Firmware operational state is running */
SAI_FW_OP_STATE_RUNNING,

/** Firmware operational state is stop */
SAI_FW_OP_STATE_STOPPED,

/** Firmware operational state is in error */
SAI_FW_OP_STATE_ERROR,
} sai_fw_op_state_t;

/**
* @brief Defines maximum length of firmware and log file name
*/
#define SAI_FW_NAME_SIZE 64
Comment thread
JaiOCP marked this conversation as resolved.

/**
* @brief Firmware Attributes
*/
typedef enum _sai_fw_attr_t
{
/**
* @brief Start of Attributes
*/
SAI_FW_ATTR_START,

/**
* @brief Firmware Log File and Path Name [char[SAI_FW_NAME_SIZE]]
*
* The maximum number of characters for the name is SAI_FW_NAME_SIZE - 1 since
* it needs the terminating null byte ('\0') at the end.
*
* @type char
* @flags CREATE_AND_SET
* @default ""
*/
SAI_FW_ATTR_LOG_FILE_AND_PATH_NAME = SAI_FW_ATTR_START,

/**
* @brief Firmware File and Path Name [char[SAI_FW_NAME_SIZE]]
*
* The maximum number of characters for the name is SAI_FW_NAME_SIZE - 1 since
* it needs the terminating null byte ('\0') at the end.
*
* @type char
Comment thread
JaiOCP marked this conversation as resolved.
* @flags CREATE_AND_SET
* @default ""
*/
SAI_FW_ATTR_FW_FILE_AND_PATH_NAME,

/**
* @brief Firmware to be loaded on the core
*
* @type sai_uint8_t
* @flags CREATE_AND_SET
* @default 0
*/
SAI_FW_ATTR_CORE_ID,

/**
* @brief Firmware admin state
*
* @type sai_fw_admin_state_t
* @flags CREATE_AND_SET
* @default SAI_FW_ADMIN_STATE_AUTO
*/
SAI_FW_ATTR_FW_ADMIN_STATE,

/**
* @brief Firmware operational state
*
* @type sai_fw_op_state_t
* @flags READ_ONLY
*/
SAI_FW_ATTR_FW_OP_STATE,

/**
* @brief Firmware major version
*
* @type sai_uint32_t
* @flags READ_ONLY
*/
SAI_FW_ATTR_FW_MAJOR_VERSION,

/**
* @brief Firmware minor version
*
* @type sai_uint32_t
* @flags READ_ONLY
*/
SAI_FW_ATTR_FW_MINOR_VERSION,

/**
* @brief End of Performance Monitoring attributes
*/
SAI_FW_ATTR_END,

/** Custom range base value */
SAI_FW_ATTR_CUSTOM_RANGE_START = 0x10000000,

/** End of custom range base */
SAI_FW_ATTR_CUSTOM_RANGE_END

} sai_fw_attr_t;

/**
* @brief Create firmware object
*
* @param[out] fw_id Firmware id
* @param[in] switch_id Switch id
* @param[in] attr_count Number of attributes
* @param[in] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_create_fw_fn)(
_Out_ sai_object_id_t *fw_id,
_In_ sai_object_id_t switch_id,
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list);

/**
* @brief Remove firmware object
*
* @param[in] fw_id Firmware id
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_remove_fw_fn)(
_In_ sai_object_id_t fw_id);

/**
* @brief Set firmware attribute
*
* @param[in] fw_id Firmware id
* @param[in] attr Attribute
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_set_fw_attribute_fn)(
_In_ sai_object_id_t fw_id,
_In_ const sai_attribute_t *attr);

/**
* @brief Get Firmware attribute
*
* @param[in] fw_id Firmware ID
* @param[in] attr_count Number of attributes
* @param[inout] attr_list Array of attributes
*
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
*/
typedef sai_status_t (*sai_get_fw_attribute_fn)(
_In_ sai_object_id_t fw_id,
_In_ uint32_t attr_count,
_Inout_ sai_attribute_t *attr_list);

/**
* @brief Firmware related API methods table retrieved with sai_api_query()
*/
typedef struct _sai_fw_api_t
{
sai_create_fw_fn create_fw;
sai_remove_fw_fn remove_fw;
sai_set_fw_attribute_fn set_fw_attribute;
sai_get_fw_attribute_fn get_fw_attribute;
} sai_fw_api_t;

/**
* @}
*/
#endif /** __SAIFW_H_ */
26 changes: 26 additions & 0 deletions inc/saiswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -3652,6 +3652,32 @@ typedef enum _sai_switch_attr_t
*/
SAI_SWITCH_ATTR_TAM_EVENT_LEARN_NOTIFY,

/**
* @brief Firmware list
*
* @type sai_fw_list_t
* @flags CREATE_ONLY
* @default internal
*/
SAI_SWITCH_ATTR_FW_LIST,

/**
* @brief Firmware enabled on the switch
*
* @type sai_object_list_t
* @flags READ_ONLY
* @objects SAI_OBJECT_TYPE_FW
*/
SAI_SWITCH_ATTR_FW,

/**
* @brief Maximum number of cores supported
*
* @type sai_uint8_t
* @flags READ_ONLY
*/
SAI_SWITCH_ATTR_MAX_FW_CORES,

/**
* @brief End of attributes
*/
Expand Down
58 changes: 58 additions & 0 deletions inc/saitypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ typedef enum _sai_object_type_t
SAI_OBJECT_TYPE_CBFC_CREDIT_PROFILE = 118,
SAI_OBJECT_TYPE_PERFMON = 119,
SAI_OBJECT_TYPE_TAM_EVENT_LEARN_ENTRY = 120,
SAI_OBJECT_TYPE_FW = 121,

/** Must remain in last position */
SAI_OBJECT_TYPE_MAX,
Expand Down Expand Up @@ -422,6 +423,57 @@ typedef struct _sai_taps_list_t
sai_s32_list_t *list;
} sai_taps_list_t;

/**
* @brief SAI firmware administrative state
*/
typedef enum _sai_fw_admin_state_t
{
/** Firmware admin state is automatic loading and running */
SAI_FW_ADMIN_STATE_AUTO,

/** Firmware admin state to start the firmware */
SAI_FW_ADMIN_STATE_START_FW,

/** Firmware admin state is stop the firmware */
SAI_FW_ADMIN_STATE_STOP_FW,

/** Firmware admin state is load the firmware */
SAI_FW_ADMIN_STATE_LOAD_FW,

/** Firmware admin state is unload the firmware */
SAI_FW_ADMIN_STATE_UNLOAD_FW,
} sai_fw_admin_state_t;

/**
* @brief Defines a firmware instance
*/
typedef struct _sai_fw_inst_t
{
/** Firmware path */
sai_s8_list_t fw_path_name;

/** Firmware log file path */
sai_s8_list_t log_path_name;

/** Firmware core id */
uint8_t core_id;

/** Firmware admin state */
sai_fw_admin_state_t admin_state;
} sai_fw_inst_t;

/**
* @brief Defines a list of firmware instances
*/
typedef struct _sai_fw_list_t
{
/** Number of firmware instances */
uint32_t count;

/** List of firmware instances */
sai_fw_inst_t *list;
} sai_fw_list_t;

typedef enum _sai_ip_addr_family_t
{
SAI_IP_ADDR_FAMILY_IPV4,
Expand Down Expand Up @@ -1844,6 +1896,12 @@ typedef union _sai_attribute_value_t
/** @validonly meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_UINT64_RANGE_LIST */
sai_u64_range_list_t u64rangelist;

/** @validonly meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_FW_INST */
sai_fw_inst_t fwinst;

/** @validonly meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_FW_LIST */
sai_fw_list_t fwlist;

/** @validonly meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_PORT_ILT_LANE_TRAINING_STATUS_LIST */
sai_port_ilt_lane_training_status_list_t port_ilt_lane_training_status_list;

Expand Down
4 changes: 4 additions & 0 deletions meta/parse.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1751,6 +1751,10 @@ sub ProcessDefaultValue
{
WriteSource "$val = { .chardata = { 0 } };";
}
elsif ($default =~ /^0$/ and $type =~ /^(sai_fw_inst_t)/)
Comment thread
JaiOCP marked this conversation as resolved.
{
WriteSource "$val = { 0 };";
}
elsif ($default =~ /^0\.0\.0\.0$/ and $type =~ /^(sai_ip4_t)/)
{
WriteSource "$val = { 0 };";
Expand Down
12 changes: 11 additions & 1 deletion meta/saimetadatatypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,17 @@ typedef enum _sai_attr_value_type_t
/**
* @brief Attribute value is 64 bit unsigned integer range list.
*/
SAI_ATTR_VALUE_TYPE_UINT64_RANGE_LIST
SAI_ATTR_VALUE_TYPE_UINT64_RANGE_LIST,

/**
* @brief Attribute value is firmware instance.
*/
SAI_ATTR_VALUE_TYPE_FW_INST,

/**
* @brief Attribute value is firmware list.
*/
SAI_ATTR_VALUE_TYPE_FW_LIST,
} sai_attr_value_type_t;

/**
Expand Down
Loading
Loading