C H A P T E R  7

Fastpath Manager API

This chapter describes the Fastpath Manager API. Topics include:


Fastpath Manager API Introduction

The fastpath manager API provides a means to register tasks that must be run periodically. For example, you can use this API to check whether a link is up or perform other health checks. The fastpath manager is included as part of the command-line interface (cli)library. You can find the header file declaring the API (lwrte_fastpath_mgr.h) in the include directory for that library.

The fastpath manager is run on a dedicated thread, and in an LDoms environment usually polls the IPC channels, in particular the global control channel. The granularity of the interval length for checking tasks that can be registered with the framework is one millisecond. However, you must be aware that there is no pre-emption, so the actual granularity is dependent on the length and number of tasks that are registered.


Fastpath Manager API Function Descriptions

fastpath_mgr_init

Description

Initialization for the fastpath manager framework. This function must be called in the init routine of applications to use the framework.

Function

void fastpath_mgr_init()

Parameters

None

Return Values

None

fastpath_mgr_process

Description

This function implements the periodic execution of scheduled tasks. This function must run on its own strand.

Function

void fastpath_mgr_process(boolean_t poll_ipc)

Parameters

poll_ipc - Indication whether the IPC channels are polled in this thread.

Return Values

None

fastpath_mgr_register_event_handler

Description

This interface is used to register functions that periodically check for a condition.

Function

fastpath_mgr_handle_t

fastpath_mgr_register_event_handler(status_check_ft check_fun,
event_cb_ft event_cb, void *args,
int interval);

Parameters

check_fun - Function that performs check. Must return 0 if the check passed.

event_cb - Optional handler for events. If present, this function is called when the check_fun returns a value other than 0. That value is passed to the event_cb to identify the event.

args - Argument passed to checking and callback functions.

interval - Frequency of call to check_fun (in milliseconds).

Return Values

NULL in case of error.

Handle in case of success. This handle is needed to unregister the task.

fastpath_mgr_unregister_event_handler

Description

Unregister functions from the fastpath manager.



Note - This function may be called by the event callback registered through fastpath_mgr_register_event_handler(), but must not be called by the checking function registered in that call.


Function

int fastpath_mgr_unregister_event_handler(fastpath_mgr_handle_t hdl)

Parameters

hdl - The handle obtained from fastpath_mgr_register_event_handler().

Return Values

0 - Success

-1 - Failure

fastpath_mgr_check

Description

This function runs all check functions whose interval have expired. This function is an alternative entry point into the fastpath manager that checks whether there are any registered functions that should be run at the time of the call. If this entry point is used, the user must make sure that it is run with a sufficient frequency.

Function

void fastpath_mgr_check(boolean_t poll_ipc)

Parameters

poll_ipc - Indication whether ipc_poll() is called in the function.

Return Values

None