1 typedef struct { 2 init_cmd_t cmd; /* Command */ 3 vtss_isid_t isid; /* CONF_DEF/SWITCH_ADD/SWITCH_DEL */ 4 u32 flags; /* CONF_DEF */ 5 u8 resume; /* SUSPEND_RESUME */ 6 u8 warmstart; /* WARMSTART_QUERY - Module must set warmstart to FALSE if it is not ready for warmstart yet */ 7 8 // The following structure is valid as follows: 9 // In SWITCH_ADD events: Only index given by #isid is guaranteed to contain valid info. 10 // In MASTER_UP event: Entries with switch_info[]::configurable == TRUE contain valid info 11 // in the remaining members. 12 // In INIT_CONF_DEF events: Only valid for legal isids [VTSS_ISID_START; VTSS_ISID_END[, and only the #.configurable 13 // member is valid. #.configurable has the following semantics: 14 // If FALSE, the switch has been deleted through SPROUT. This means: Forget everything about it. 15 // If TRUE, it doesn‘t necessarily mean that the switch has been seen before. 16 init_switch_info_t switch_info[VTSS_ISID_END]; // isid-indexed. VTSS_ISID_LOCAL is unused. 17 18 // The following is only valid in SWITCH_ADD events, and contains the logical to 19 // physical port mapping for ports on the ISID that is currently being added. 20 // The reason for not having this as part of the init_switch_info_t is that it 21 // takes up too much space and causes thread-stack problems if replicating it VTSS_ISID_END times. 22 init_port_map_t port_map[VTSS_PORT_ARRAY_SIZE]; 23 } vtss_init_data_t;
1 /* Init command */ 2 typedef enum { 3 INIT_CMD_INIT, /* Initialize module. Called before scheduler is started. */ 4 INIT_CMD_START, /* Start module. Called after scheduler is started. */ 5 INIT_CMD_CONF_DEF, /* Create and activate factory defaults. 6 The ‘flags‘ field is used for special exceptions. 7 When creating factory defaults, each module may 8 be called multiple times with different parameters. 9 The ‘isid‘ field may take one of the following values: 10 VTSS_ISID_LOCAL : Create defaults in local section. 11 VTSS_ISID_GLOBAL: Create global defaults in global section. 12 Specific isid : Create switch defaults in global section. */ 13 INIT_CMD_MASTER_UP, /* Change from SLAVE to MASTER state */ 14 INIT_CMD_MASTER_DOWN, /* Change from MASTER to SLAVE state */ 15 INIT_CMD_SWITCH_ADD, /* MASTER state: Add managed switch to stack (isid valid) */ 16 INIT_CMD_SWITCH_DEL, /* MASTER state: Delete switch from stack (isid valid) */ 17 INIT_CMD_SUSPEND_RESUME, /* Suspend/resume port module (resume valid) */ 18 INIT_CMD_WARMSTART_QUERY, /* Query if a module is ready for warm start (warmstart is output parameter) */ 19 } init_cmd_t;
1 typedef uint vtss_isid_t;
1 typedef struct { 2 BOOL configurable; // TRUE if switch has been seen before 3 u32 port_cnt; // Port count of switch 4 vtss_port_no_t stack_ports[2]; // The stack port numbers of the switch 5 vtss_board_type_t board_type; // Board type enumeration, which uniquely identifies the slave board (SFP, Cu. 24-ported, 48-ported, etc.). 6 unsigned int api_inst_id; // The ID used to instantiate the API of the switch. 7 } init_switch_info_t;
1 /** \brief Port Number */ 2 typedef u32 vtss_port_no_t; 3 4 /** \brief Physical port number */ 5 typedef u32 vtss_phys_port_no_t;
1 typedef enum { 2 VTSS_BOARD_UNKNOWN = 0, 3 VTSS_BOARD_ESTAX_34_REF, 4 VTSS_BOARD_ESTAX_34_ENZO, 5 VTSS_BOARD_ESTAX_34_ENZO_SFP, 6 VTSS_BOARD_LUTON10_REF, 7 VTSS_BOARD_LUTON26_REF = 5, 8 VTSS_BOARD_JAG_CU24_REF, 9 VTSS_BOARD_JAG_SFP24_REF, 10 VTSS_BOARD_JAG_PCB107_REF, 11 VTSS_BOARD_UNUSED, /* Vacant entry, used to be JAG_CU24_DUAL_REF (obsolete) */ 12 VTSS_BOARD_JAG_CU48_REF, 13 VTSS_BOARD_SERVAL_REF, 14 VTSS_BOARD_SERVAL_PCB106_REF, 15 VTSS_BOARD_SEVILLE_T1040QDS, 16 VTSS_BOARD_SERVAL2_NID_REF, 17 VTSS_BOARD_JAGUAR2_CU48_REF, 18 VTSS_BOARD_JAGUAR2_REF, 19 } vtss_board_type_t;
1 typedef struct { 2 i32 chip_port; // Set to -1 if not used 3 vtss_chip_no_t chip_no; // Chip number for multi-chip targets. 4 } init_port_map_t;
原文地址:http://blog.51cto.com/laoxiong/2112158