OpenNSL API Guide and Reference Manual
Data Structures | Files | Macros | Typedefs | Functions
Trunking APIs

Data Structures

struct  opennsl_trunk_chip_info_s
 Initialize a trunk chip information structure. More...
 
struct  opennsl_trunk_info_s
 Trunk group attributes structure. More...
 
struct  opennsl_trunk_member_s
 Structure describing a trunk member. More...
 

Files

file  trunk.h
 
file  trunkX.h
 

Macros

#define OPENNSL_TRUNK_FLAG_FAILOVER   OPENNSL_TRUNK_FLAG_FAILOVER_NEXT_LOCAL
 Enable trunk failover support (deprecated).
 
#define OPENNSL_TRUNK_FLAG_FAILOVER_NEXT   0x0001
 Failover port defaults to the next port in the trunk port list.
 
#define OPENNSL_TRUNK_FLAG_FAILOVER_NEXT_LOCAL   0x0002
 Failover port defaults to the next local port in the trunk port list, if any.
 
#define OPENNSL_TRUNK_FLAG_IPMC_CLEAVE   0x0020
 Disable trunk resolution for IPMC packets in hardware.
 
#define OPENNSL_TRUNK_FLAG_WITH_ID   0x0010
 Use the trunk ID supplied by user.
 
#define OPENNSL_TRUNK_MAX_PORTCNT   256
 Maximum number of ports in a trunk group.
 
#define OPENNSL_TRUNK_MEMBER_EGRESS_DISABLE   0x0002
 Member will not be a part of the distributor members to be hashed.
 
#define OPENNSL_TRUNK_PSC_DSTIP   5
 Destination IP address.
 
#define OPENNSL_TRUNK_PSC_PORTFLOW   9
 Enhanced hashing.
 
#define OPENNSL_TRUNK_PSC_SRCDSTIP   6
 Source+dest IP address.
 
#define OPENNSL_TRUNK_PSC_SRCDSTMAC   3
 Source+dest MAC address.
 
#define OPENNSL_TRUNK_UNSPEC_INDEX   -1
 Let software set DLF/MC/IPMC.
 

Typedefs

typedef struct
opennsl_trunk_chip_info_s 
opennsl_trunk_chip_info_t
 Initialize a trunk chip information structure.
 
typedef struct opennsl_trunk_info_s opennsl_trunk_info_t
 Trunk group attributes structure.
 
typedef struct
opennsl_trunk_member_s 
opennsl_trunk_member_t
 Structure describing a trunk member.
 

Functions

int opennsl_trunk_chip_info_get (int unit, opennsl_trunk_chip_info_t *ta_info) LIB_DLL_EXPORTED
 Gets the underlying SoC device's trunk support limits.
 
int opennsl_trunk_create (int unit, uint32 flags, opennsl_trunk_t *tid) LIB_DLL_EXPORTED
 Create the software data structure for a new trunk, using caller-specified or next available trunk ID.
 
int opennsl_trunk_destroy (int unit, opennsl_trunk_t tid) LIB_DLL_EXPORTED
 Removes a trunk group.
 
int opennsl_trunk_detach (int unit) LIB_DLL_EXPORTED
 Shut down (uninitialize) the trunk module.
 
int opennsl_trunk_failover_get (int unit, opennsl_trunk_t tid, opennsl_gport_t failport, int *psc, uint32 *flags, int array_size, opennsl_gport_t *fail_to_array, int *array_count) LIB_DLL_EXPORTED
 Retrieve the failover port list for a specific trunk port.
 
int opennsl_trunk_failover_set (int unit, opennsl_trunk_t tid, opennsl_gport_t failport, int psc, uint32 flags, int count, opennsl_gport_t *fail_to_array) LIB_DLL_EXPORTED
 Assign the failover port list for a specific trunk port.
 
int opennsl_trunk_find (int unit, opennsl_module_t modid, opennsl_gport_t gport, opennsl_trunk_t *tid) LIB_DLL_EXPORTED
 Get the trunk group ID for a given system port, specified by Module ID and Port number.
 
int opennsl_trunk_get (int unit, opennsl_trunk_t tid, opennsl_trunk_info_t *t_data, int member_max, opennsl_trunk_member_t *member_array, int *member_count) LIB_DLL_EXPORTED
 Get the current attributes and member ports for the specified trunk group.
 
void opennsl_trunk_info_t_init (opennsl_trunk_info_t *trunk_info) LIB_DLL_EXPORTED
 Initializes the opennsl_trunk_info_t structure.
 
int opennsl_trunk_init (int unit) LIB_DLL_EXPORTED
 Initialize the trunk module and SoC trunk hardware.
 
int opennsl_trunk_member_add (int unit, opennsl_trunk_t tid, opennsl_trunk_member_t *member) LIB_DLL_EXPORTED
 Add a member to a trunk group.
 
int opennsl_trunk_member_delete (int unit, opennsl_trunk_t tid, opennsl_trunk_member_t *member) LIB_DLL_EXPORTED
 Delete a member from a trunk group.
 
void opennsl_trunk_member_t_init (opennsl_trunk_member_t *trunk_member) LIB_DLL_EXPORTED
 Initializes the opennsl_trunk_member_t structure.
 
int opennsl_trunk_psc_set (int unit, opennsl_trunk_t tid, int psc) LIB_DLL_EXPORTED
 Set a trunk's Port Selection Criteria (PSC).
 
int opennsl_trunk_set (int unit, opennsl_trunk_t tid, opennsl_trunk_info_t *trunk_info, int member_count, opennsl_trunk_member_t *member_array) LIB_DLL_EXPORTED
 Specify the ports in a trunk group.
 

Detailed Description

Macro Definition Documentation

#define OPENNSL_TRUNK_FLAG_FAILOVER   OPENNSL_TRUNK_FLAG_FAILOVER_NEXT_LOCAL

Enable trunk failover support (deprecated).

Definition at line 43 of file trunk.h.

#define OPENNSL_TRUNK_FLAG_FAILOVER_NEXT   0x0001

Failover port defaults to the next port in the trunk port list.

Definition at line 36 of file trunk.h.

#define OPENNSL_TRUNK_FLAG_FAILOVER_NEXT_LOCAL   0x0002

Failover port defaults to the next local port in the trunk port list, if any.

Definition at line 39 of file trunk.h.

#define OPENNSL_TRUNK_FLAG_IPMC_CLEAVE   0x0020

Disable trunk resolution for IPMC packets in hardware.

Definition at line 47 of file trunk.h.

#define OPENNSL_TRUNK_FLAG_WITH_ID   0x0010

Use the trunk ID supplied by user.

Definition at line 45 of file trunk.h.

#define OPENNSL_TRUNK_MAX_PORTCNT   256

Maximum number of ports in a trunk group.

Definition at line 29 of file trunk.h.

#define OPENNSL_TRUNK_MEMBER_EGRESS_DISABLE   0x0002

Member will not be a part of the distributor members to be hashed.

Definition at line 50 of file trunk.h.

#define OPENNSL_TRUNK_PSC_DSTIP   5

Destination IP address.

Definition at line 33 of file trunk.h.

#define OPENNSL_TRUNK_PSC_PORTFLOW   9

Enhanced hashing.

Definition at line 35 of file trunk.h.

#define OPENNSL_TRUNK_PSC_SRCDSTIP   6

Source+dest IP address.

Definition at line 34 of file trunk.h.

#define OPENNSL_TRUNK_PSC_SRCDSTMAC   3

Source+dest MAC address.

Definition at line 32 of file trunk.h.

#define OPENNSL_TRUNK_UNSPEC_INDEX   -1

Let software set DLF/MC/IPMC.

Definition at line 31 of file trunk.h.

Typedef Documentation

Initialize a trunk chip information structure.

Trunk group attributes structure.

Structure describing a trunk member.

Function Documentation

int opennsl_trunk_chip_info_get ( int  unit,
opennsl_trunk_chip_info_t ta_info 
)

Gets the underlying SoC device's trunk support limits.

Description
Gets the underlying SoC device's trunk support limits. These include such data as maximum number of trunks supported and maximum number of ports per trunk.
Parameters
unit[IN] Unit number.
ta_info[OUT] Pointer to returned chip info structure (see =opennsl_trunk_chip_info_t).
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_INITTrunk module has not been initialized
int opennsl_trunk_create ( int  unit,
uint32  flags,
opennsl_trunk_t tid 
)

Create the software data structure for a new trunk, using caller-specified or next available trunk ID.

Description
To create a front-panel trunk group, the OPENNSL_TRUNK_FLAG_WITH_ID flag may be set. If the OPENNSL_TRUNK_FLAG_WITH_ID flag is set, the caller-specified trunk ID must be within the range specified by the members trunk_id_min and trunk_id_max of the opennsl_trunk_chip_info_t structure, returned by.
Parameters
unit[IN] Unit number.
flags[IN] OPENNSL_TRUNK_FLAG_*
tid[IN,OUT] Pointer to caller-specified trunk ID if OPENNSL_TRUNK_FLAG_WITH_ID is set, else pointer to next available trunk ID.
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_INITTrunk module has not been initialized
OPENNSL_E_BADIDInvalid or unsupported trunk ID
OPENNSL_E_EXISTSSpecified trunk ID is already in use
OPENNSL_E_FULLNo available trunk IDs
OPENNSL_E_XXXOther possible errors; for details, see

Referenced by example_trunk_create().

int opennsl_trunk_destroy ( int  unit,
opennsl_trunk_t  tid 
)

Removes a trunk group.

Description
Removes all current trunk member ports from the trunk group and marks the trunk ID as invalid (available for reuse).
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID.
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_INITTrunk module has not been initialized
OPENNSL_E_BADIDInvalid or unsupported trunk ID
OPENNSL_E_NOT_FOUNDSpecified trunk ID is not currently defined
OPENNSL_E_XXXOther possible errors; for details, see

Referenced by main().

int opennsl_trunk_detach ( int  unit)

Shut down (uninitialize) the trunk module.

Description
Shut down (uninitializes) the trunk module. Frees up any memory previously allocated to the trunk module.
Parameters
unit[IN] Unit number.
Return values
OPENNSL_E_NONESuccess
int opennsl_trunk_failover_get ( int  unit,
opennsl_trunk_t  tid,
opennsl_gport_t  failport,
int *  psc,
uint32 flags,
int  array_size,
opennsl_gport_t fail_to_array,
int *  array_count 
)

Retrieve the failover port list for a specific trunk port.

Description
Retrieve the configured set of failover ports for a specific port in the indicated trunk group. If a flag was provided to configure the failover list, then only the flag and psc return values are valid. If the returned flags argument is zero, then fail_to_array is filled with the port list up to a maximum list length of array_size. array_count contains the actual length of the returned list. If array_count is zero in addition to flags, trunk failover is not enabled on failport.
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID.
failport[IN] Port in trunk for which to retrieve failover port list.
psc[OUT] Port selection criteria for failover port list.
flags[OUT] OPENNSL_TRUNK_FLAG_FAILOVER_xxx.
array_size[IN] Maximum number of ports in provided failover port list.
fail_to_array[OUT] Failover port list.
array_count[OUT] Number of ports in returned failover port list.
Return values
OPENNSL_E_XXX
int opennsl_trunk_failover_set ( int  unit,
opennsl_trunk_t  tid,
opennsl_gport_t  failport,
int  psc,
uint32  flags,
int  count,
opennsl_gport_t fail_to_array 
)

Assign the failover port list for a specific trunk port.

Description
Configure the set of failover ports for a specific port in the indicated trunk group. For fabric trunks, all of the ports in the list must be HiGig ports on the local device. For non-fabric trunks, the failover ports may be on remote devices. If a flag is provided, then the count and fail_to_array argument are ignored; the failover port list is constructed from the trunk port membership according to the selected failover description. (If a OPENNSL_TRUNK_FLAG_FAILOVER_XXX flag is provided to =opennsl_trunk_set in the trunk_info structure, all of the local ports in the trunk will be configured for failover in the selected method.) If the flags argument is zero, then the port list from count and fail_to_array is used. This arbitrary list may include ports outside of the trunk. A count of zero indicates that failover should be disabled on failport.
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID.
failport[IN] Port in trunk for which to specify failover port list.
psc[IN] Port selection criteria for failover port list.
flags[IN] OPENNSL_TRUNK_FLAG_FAILOVER_xxx.
count[IN] Number of ports in failover port list.
fail_to_array[IN] Failover port list.
Return values
OPENNSL_E_XXX
int opennsl_trunk_find ( int  unit,
opennsl_module_t  modid,
opennsl_gport_t  gport,
opennsl_trunk_t tid 
)

Get the trunk group ID for a given system port, specified by Module ID and Port number.

Description
Retrieve the trunk group ID for a given system port, specified by its Module ID and Port number.
Parameters
unit[IN] Unit number.
modid[IN] Module ID
gport[IN]
tid[OUT] Trunk ID
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_UNAVAILFeature not supported by the SoC hardware
OPENNSL_E_INITTrunk module has not been initialized
OPENNSL_E_BADIDInvalid or unsupported Module ID or Port number
OPENNSL_E_NOT_FOUNDTrunk ID not found
OPENNSL_E_XXXOther possible errors; for details, see
int opennsl_trunk_get ( int  unit,
opennsl_trunk_t  tid,
opennsl_trunk_info_t t_data,
int  member_max,
opennsl_trunk_member_t member_array,
int *  member_count 
)

Get the current attributes and member ports for the specified trunk group.

Description
Fills in the caller-allocated trunk_info structure with the current attributes of the specified trunk group. Fill in the caller-allocated member_array with the current member list. If member_max is zero and member_array is NULL, the number of members in the given trunk group is returned in member_count.
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID.
t_data[OUT]
member_max[IN] Maximum number of members in provided member_array.
member_array[OUT] Member list.
member_count[OUT] Number of members returned in member_array.
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_INITTrunk module has not been initialized
OPENNSL_E_BADIDInvalid or unsupported trunk ID
OPENNSL_E_NOT_FOUNDSpecified trunk ID is not currently defined
OPENNSL_E_XXXOther possible errors; for details, see

Referenced by main().

void opennsl_trunk_info_t_init ( opennsl_trunk_info_t trunk_info)

Initializes the opennsl_trunk_info_t structure.

Description
Initializes the opennsl_trunk_info_t structure.
Parameters
trunk_info[IN,OUT] Pointer to trunk info structure (see =opennsl_trunk_info_t).
Returns
Nothing

Referenced by main().

int opennsl_trunk_init ( int  unit)

Initialize the trunk module and SoC trunk hardware.

Description
Initialize the trunk module. The SoC hardware and the software data structure are both set to their initialized states (no trunks configured). .
Parameters
unit[IN] Unit number.
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_XXXOther possible errors; for details, see
int opennsl_trunk_member_add ( int  unit,
opennsl_trunk_t  tid,
opennsl_trunk_member_t member 
)

Add a member to a trunk group.

Description
This API is used to add a member to a trunk group. The specified trunk group must be one returned from =opennsl_trunk_create . If the trunk already has members, they will be retained. A membmer should not be added to different trunk groups, which must be guaranteed by the applications.
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID.
member[IN] Trunk member to add.
Return values
OPENNSL_E_XXX

Referenced by main().

int opennsl_trunk_member_delete ( int  unit,
opennsl_trunk_t  tid,
opennsl_trunk_member_t member 
)

Delete a member from a trunk group.

Description
Delete a member from a trunk group. The specified trunk group must be one returned from =opennsl_trunk_create .
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID.
member[IN] Trunk member to delete.
Return values
OPENNSL_E_XXX

Referenced by main().

void opennsl_trunk_member_t_init ( opennsl_trunk_member_t trunk_member)

Initializes the opennsl_trunk_member_t structure.

Description
Initializes the opennsl_trunk_member_t structure.
Parameters
trunk_member[IN,OUT] Pointer to trunk member structure (see =opennsl_trunk_member_t).
Returns
Nothing

Referenced by main().

int opennsl_trunk_psc_set ( int  unit,
opennsl_trunk_t  tid,
int  psc 
)

Set a trunk's Port Selection Criteria (PSC).

Description
Set a trunk's Port Selection Criteria (PSC). Assigns a particular load balancing algorithm to the specified trunk.
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID.
psc[IN] PSC to apply to specified trunk (see =PSC_macros).
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_INITTrunk module has not been initialized
OPENNSL_E_BADIDInvalid or unsupported trunk ID
OPENNSL_E_NOT_FOUNDSpecified trunk ID is not currently defined
OPENNSL_E_XXXOther possible errors; for details, see

Referenced by main().

int opennsl_trunk_set ( int  unit,
opennsl_trunk_t  tid,
opennsl_trunk_info_t trunk_info,
int  member_count,
opennsl_trunk_member_t member_array 
)

Specify the ports in a trunk group.

Description
Configure the set of ports in a trunk group. The specified trunk ID must be one returned from =opennsl_trunk_create . If the trunk already has member ports, they will be replaced by the new list of ports contained in the member_array.
Parameters
unit[IN] Unit number.
tid[IN] Trunk ID
trunk_info[IN] Pointer to trunk info structure (see =opennsl_trunk_info_t)
member_count[IN] Number of members in member_array.
member_array[IN] Member list.
Return values
OPENNSL_E_NONESuccess
OPENNSL_E_INITTrunk module has not been initialized
OPENNSL_E_BADIDInvalid or unsupported trunk ID, port or PSC
OPENNSL_E_NOT_FOUNDSpecified trunk ID is not currently defined
OPENNSL_E_PARAMInvalid number of member ports specified
OPENNSL_E_XXXOther possible errors; for details, see