OpenNSL API Guide and Reference Manual
Files | Typedefs | Enumerations | Functions
Link monitoring and notification

Files

 
file  linkX.h
 

Typedefs

typedef void(* opennsl_linkscan_handler_t )(int unit, opennsl_port_t port, opennsl_port_info_t *info)
 
typedef enum
opennsl_linkscan_mode_e 
opennsl_linkscan_mode_t
 opennsl_linkscan_mode_e
 

Enumerations

enum  opennsl_linkscan_mode_e {
  OPENNSL_LINKSCAN_MODE_NONE = 0,
  OPENNSL_LINKSCAN_MODE_SW = 1,
  OPENNSL_LINKSCAN_MODE_HW = 2,
  OPENNSL_LINKSCAN_MODE_COUNT = 3
}
 opennsl_linkscan_mode_e More...
 

Functions

int opennsl_linkscan_detach (int unit) LIB_DLL_EXPORTED
 Terminate linkscan on the specified unit.
 
int opennsl_linkscan_enable_get (int unit, int *us) LIB_DLL_EXPORTED
 Enable and disable link scanning or set the polling interval.
 
int opennsl_linkscan_enable_set (int unit, int us) LIB_DLL_EXPORTED
 Enable and disable link scanning or set the polling interval.
 
int opennsl_linkscan_mode_get (int unit, opennsl_port_t port, int *mode) LIB_DLL_EXPORTED
 Get or set the link scanning mode for a port.
 
int opennsl_linkscan_mode_set (int unit, opennsl_port_t port, int mode) LIB_DLL_EXPORTED
 Get or set the link scanning mode for a port.
 
int opennsl_linkscan_mode_set_pbm (int unit, opennsl_pbmp_t pbm, int mode) LIB_DLL_EXPORTED
 Get or set the link scanning mode for a port.
 
int opennsl_linkscan_register (int unit, opennsl_linkscan_handler_t f) LIB_DLL_EXPORTED
 Register and unregister link notification callouts.
 
int opennsl_linkscan_unregister (int unit, opennsl_linkscan_handler_t f) LIB_DLL_EXPORTED
 Register and unregister link notification callouts.
 

Detailed Description

Typedef Documentation

typedef void(* opennsl_linkscan_handler_t)(int unit, opennsl_port_t port, opennsl_port_info_t *info)

Definition at line 30 of file link.h.

opennsl_linkscan_mode_e

Enumeration Type Documentation

opennsl_linkscan_mode_e

Enumerator:
OPENNSL_LINKSCAN_MODE_NONE 
OPENNSL_LINKSCAN_MODE_SW 
OPENNSL_LINKSCAN_MODE_HW 
OPENNSL_LINKSCAN_MODE_COUNT 

Definition at line 109 of file link.h.

Function Documentation

int opennsl_linkscan_detach ( int  unit)

Terminate linkscan on the specified unit.

Description
Disables link scanning on the specified unit, terminates the linkscan thread, and frees all memory associated with linkscan on the device. All registered handlers are unregistered requiring them to re-register if =opennsl_linkscan_init is called to reinitialize linkscan.
Parameters
unit[IN] Unit number.
Return values
OPENNSL_E_NONE
OPENNSL_E_XXXOperation failed, linkscan state is undefined.
int opennsl_linkscan_enable_get ( int  unit,
int *  us 
)

Enable and disable link scanning or set the polling interval.

Description
Calling opennsl_linkscan_enable_set with a non-zero scanning interval sets the scan interval starts the linkscan task if required. If the specified interval is zero, the linkscan task is stopped. For this reason, it is required to have link scan enabled and running with a non-zero interval even if all ports are operating in hardware linkscan mode. opennsl_linkscan_enable_get returns the current scan interval. A returned scan interval of 0 indicates linkscan is disabled.
Parameters
unit[IN] Unit number.
us[OUT] (for _set) Minimum time between software link scan cycles in micro-seconds. 0 indicates linkscan is disabled.
Return values
OPENNSL_E_NONE
OPENNSL_E_MEMORY
OPENNSL_E_XXX
int opennsl_linkscan_enable_set ( int  unit,
int  us 
)

Enable and disable link scanning or set the polling interval.

Description
Calling opennsl_linkscan_enable_set with a non-zero scanning interval sets the scan interval starts the linkscan task if required. If the specified interval is zero, the linkscan task is stopped. For this reason, it is required to have link scan enabled and running with a non-zero interval even if all ports are operating in hardware linkscan mode. opennsl_linkscan_enable_get returns the current scan interval. A returned scan interval of 0 indicates linkscan is disabled.
Parameters
unit[IN] Unit number.
us[IN] (for _set) Minimum time between software link scan cycles in micro-seconds. 0 indicates linkscan is disabled.
Return values
OPENNSL_E_NONE
OPENNSL_E_MEMORY
OPENNSL_E_XXX
int opennsl_linkscan_mode_get ( int  unit,
opennsl_port_t  port,
int *  mode 
)

Get or set the link scanning mode for a port.

Description
Get or set the current link scanning mode for a port. The possible modes for a port are described in table =OPENNSL_LINKSCAN_MODE_e . When a port is set to OPENNSL_LINKSCAN_MODE_NONE, linkscan does not process any link change on a port. This mode is only recommended if the application do not want to use the port (i.e. port is disabled). opennsl_linkscan_mode_set operates on one port while opennsl_linkscan_mode_set_pbm operates on all ports specified in the port bit map. When operating on a port bit map, a failure on any one port aborts the processing of the request and the link scan mode of all the ports specified is undefined. Ports not in the port bit map are unaffected. The use of opennsl_linkscan_mode_set_pbm is not recommended.
Parameters
unit[IN] Unit number.
port[IN] Device port number to set or get the mode of
mode[OUT] (for _set and _set_pbm) Link scan mode, see table =OPENNSL_LINKSCAN_MODE_e .
Return values
OPENNSL_E_NONE
OPENNSL_E_PORTInvalid port
OPENNSL_E_PARAMInvalid mode
OPENNSL_E_UNAVAILMode requested is not support
OPENNSL_E_XXXOperation failed
int opennsl_linkscan_mode_set ( int  unit,
opennsl_port_t  port,
int  mode 
)

Get or set the link scanning mode for a port.

Description
Get or set the current link scanning mode for a port. The possible modes for a port are described in table =OPENNSL_LINKSCAN_MODE_e . When a port is set to OPENNSL_LINKSCAN_MODE_NONE, linkscan does not process any link change on a port. This mode is only recommended if the application do not want to use the port (i.e. port is disabled). opennsl_linkscan_mode_set operates on one port while opennsl_linkscan_mode_set_pbm operates on all ports specified in the port bit map. When operating on a port bit map, a failure on any one port aborts the processing of the request and the link scan mode of all the ports specified is undefined. Ports not in the port bit map are unaffected. The use of opennsl_linkscan_mode_set_pbm is not recommended.
Parameters
unit[IN] Unit number.
port[IN] Device port number to set or get the mode of
mode[IN] (for _set and _set_pbm) Link scan mode, see table =OPENNSL_LINKSCAN_MODE_e .
Return values
OPENNSL_E_NONE
OPENNSL_E_PORTInvalid port
OPENNSL_E_PARAMInvalid mode
OPENNSL_E_UNAVAILMode requested is not support
OPENNSL_E_XXXOperation failed
int opennsl_linkscan_mode_set_pbm ( int  unit,
opennsl_pbmp_t  pbm,
int  mode 
)

Get or set the link scanning mode for a port.

Description
Get or set the current link scanning mode for a port. The possible modes for a port are described in table =OPENNSL_LINKSCAN_MODE_e . When a port is set to OPENNSL_LINKSCAN_MODE_NONE, linkscan does not process any link change on a port. This mode is only recommended if the application do not want to use the port (i.e. port is disabled). opennsl_linkscan_mode_set operates on one port while opennsl_linkscan_mode_set_pbm operates on all ports specified in the port bit map. When operating on a port bit map, a failure on any one port aborts the processing of the request and the link scan mode of all the ports specified is undefined. Ports not in the port bit map are unaffected. The use of opennsl_linkscan_mode_set_pbm is not recommended.
Parameters
unit[IN] Unit number.
pbm[IN] Port bit map of ports to set the mode on
mode[IN] (for _set and _set_pbm) Link scan mode, see table =OPENNSL_LINKSCAN_MODE_e .
Return values
OPENNSL_E_NONE
OPENNSL_E_PORTInvalid port
OPENNSL_E_PARAMInvalid mode
OPENNSL_E_UNAVAILMode requested is not support
OPENNSL_E_XXXOperation failed
int opennsl_linkscan_register ( int  unit,
opennsl_linkscan_handler_t  f 
)

Register and unregister link notification callouts.

Description
Register a handler invoked on a link up or link down transition. If multiple handlers are registered, they are invoked on a link transition in the same order as they were registered. The behavior of registering the same callout more than once is undefined. If an application chooses to perform custom port configurations which bypass API functions, such custom operations may need to be repeated whenever a port's link comes up. Consult a Field Application Engineer for guidance.
Parameters
unit[IN] Unit number.
f[IN] OPENNSL callback function pointer (see =opennsl_linkscan_handler_t)
Return values
OPENNSL_E_NONE
OPENNSL_E_MEMORY
int opennsl_linkscan_unregister ( int  unit,
opennsl_linkscan_handler_t  f 
)

Register and unregister link notification callouts.

Description
Register a handler invoked on a link up or link down transition. If multiple handlers are registered, they are invoked on a link transition in the same order as they were registered. The behavior of registering the same callout more than once is undefined. If an application chooses to perform custom port configurations which bypass API functions, such custom operations may need to be repeated whenever a port's link comes up. Consult a Field Application Engineer for guidance.
Parameters
unit[IN] Unit number.
f[IN] OPENNSL callback function pointer (see =opennsl_linkscan_handler_t)
Return values
OPENNSL_E_NONE
OPENNSL_E_MEMORY