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, the user can use this API to check whether a link is up or to perform other health checks. The Fastpath Manager is included as part of the command-line interface (cli) library. The user 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 a logical domain 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, the user must be aware that there is no pre-emption, so the actual granularity depends 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.

Syntax

void fastpath_mgr_init()

Parameters

None

Return Values

None

fastpath_mgr_process

Description

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

Syntax

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.

Syntax

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

Unregisters 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.


Syntax

int fastpath_mgr_unregister_event_handler(fastpath_mgr_handle_t hdl)

Parameters

hdl - Handle obtained from fastpath_mgr_register_event_handler().

Return Values

0 - Success

-1 - Failure

fastpath_mgr_check

Description

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 ensure that this function is run with a sufficient frequency.

Syntax

void fastpath_mgr_check(boolean_t poll_ipc)

Parameters

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

Return Values

None