mpsdk.h File Reference

Defines the functions and external data structures for the MultiServices PIC SDK. More...


Data Structures

struct  msp_fifo_create_s
 Data structure passed as an argument to msp_fifo_create. More...
struct  msp_dataloop_args
 Data structure passed to the application's data loop. More...
struct  msp_dataloop_params_s
 Data structure passed by the data loop creator to be in turn passed on to the data loop. More...
struct  msp_dataloop_result_s
 Results of data loop creation passed back the data loop creator. More...

Status return codes from the MP-SDK library APIs.

#define MSP_OK   0
 Indicates that an operation was successful.
#define MSP_ERROR   -100
 Indicates an unknown generic error has occurred.
#define MSP_MEM_ALLOC_FAIL   -101
 Indicates a memory allocation has failed.
#define MSP_ENV_INIT_FAIL   -102
 Indicates that the MultiServices PIC operating environment could not be found.
#define MSP_JBUF_INIT_FAIL   -103
 Indicates that the jbuf sub-system failed to initialize.
#define MSP_INVALID_ARG   -104
 Indicates that an invalid argument was passed to the function.
#define MSP_EAGAIN   -105
#define MSP_HASH_INIT_FAIL   -106
 Could not initialize hashing and flow affinity functions.
#define MSP_DATA_FLOWAFF_ERR   -107
 Data Flow Affinity not configured on the PIC.
#define MSP_DATA_FLOWAFF_NOFIFO_ERR   -108
 Fifo does not exists for data core.
#define MSP_FIFO_INIT_FAIL   -200
 FIFO initialization failed.
#define MSP_FIFO_CREATE_FAIL   -201
 FIFO creation failed.
#define MSP_FIFO_SETUP_FAIL   -202
 FIFO setup failed.
#define MSP_FIFO_SEND_FAIL   -203
 Could transmit a message through a FIFO.
#define MSP_FIFO_SEND_RETRY   -204
 Retry the send since the current send failed because FIFO is full.
#define MSP_FIFO_ALREADY_CREATED   -205
 A FIFO for this CPU is already created.
#define MSP_FIFO_JBUF_TOO_LONG   -206
 Indicates that a FIFO transmission has failed because the jbuf's length exceeds the limit.
#define MSP_FIFO_INVALID_CPU   -207
 Indicates that an invalid cpu number was passed.
#define MSP_DATA_SEND_FAIL   -300
 Indicates that a data loop transmission has failed.
#define MSP_DATA_SEND_RETRY   -301
 Indicates that the send action should be retried, as the current send failed due to a full message queue.
#define MSP_DATA_LOOP_EXISTS   -302
 Indicates that a data loop already exists.
#define MSP_DATALOOP_CREATE_FAIL   -303
 Indicates that the data loop creation failed.
#define MSP_DATALOOP_NULL_ARG   -304
 Indicates that a NULL argument was passed.
#define MSP_DATA_JBUF_TOO_LONG   -305
 Indicates that a data loop transmission has failed because the jbuf's length exceeds the limit.
#define MSP_DATALOOP_INVALID_CPU   -306
 Indicates that an invalid CPU number was passed.
#define MSP_SHM_INIT_FAIL   -401
 Indicates a shared memory initialization failed.
#define MSP_SHM_ATTACH_FAIL   -402
 Indicates a shared memory attach failed.
#define MSP_SHM_UNKNOWN   -403
 Indicates a shared memory name isn't known.
#define MSP_SHM_INIT_NOT_DONE   -404
 Attach failed, init pending.
#define MSP_SHM_ENOMEM   -405
#define MSP_SHM_STATS_FAIL   -406
#define MSP_OC_INIT_FAIL   -421
 Object cache initialization failed.
#define MSP_OC_ATTACH_FAIL   -422
 Failed to attach to an existing object cache.
#define MSP_OC_INFO_FAIL   -423
 Failure to retrieve info from oc.
#define MSP_SHM_NONE   -424
 SHM and Object cache iterator use this value to indicate end of iteration.
#define MSP_RTPRIO_THREAD_CREATE_FAIL   -501
 rtprio thread create failed
#define MSP_RTPRIO_THREAD_INVALID_CPU   -502
 Invalid CPU ID.
#define MSP_FDB_INIT_FAIL   -601
 Forwarding database initialization failed.
#define MSP_FDB_NOT_CONFIGURED   -602
 Forwarding database not configured.
#define MSP_FDB_API_ERROR_START   -620
 FDB Specific API errors will start from this number onward.
#define MSP_FDB_RECORD_NOT_FOUND   -621
 Matching entry not found in database.
#define MSP_FDB_ALREADY_ATTACHED   -622
 Attaching to a fdb without detaching previous instance.
#define MSP_FDB_ALREADY_INITIALIZED   -623
 Reinitializing a fdb.
#define MSP_POLICY_DB_INIT_FAIL   -701
#define MSP_POLICY_DB_NOT_CONFIGURED   -702
#define MSP_POLICY_DB_ATTACH_FAIL   -703
#define MSP_IFL_TBL_ATTACH_FAIL   -801

Constants used by APIs to iterate on the next available CPU/core.

#define MSP_NEXT_NONE   -1
 Initial value for cpu_num or core_num argument to msp_env_get_next_xxx.
#define MSP_NEXT_END   -1
 End value for cpu_num or core_num argument to c msp_env_get_next_xxx.
#define MSP_CPU_NONE   -1
 Returns the value of msp_env_get_next_xxx function's indicating there's no further valid CPU.
#define MSP_MAX_CPUS   32
 Max CPUs across all platforms.

Types of MP-SDK Messages.

#define MSP_MSG_TYPE_PACKET   2
 Message type is a data packet.
#define MSP_MSG_TYPE_FREEBACK   3
 Message type indicates to free a packet.

Defines

#define MSP_FIFO_HANDLE_INVALID   0
 The FIFO handle is invalid.
#define MSP_DATA_HANDLE_INVALID   0
 The data loop handle is invalid.
#define MSP_FIFO_DEFAULT_DEPTH   0
 Use system default for the depth of a FIFO.

Typedefs

typedef unsigned int msp_data_handle_t
 Packet loop(also called data loop) identifier.
typedef unsigned int msp_fifo_handle_t
 FIFO identifier.
typedef msp_fifo_create_s msp_fifo_create_t
 Data structure passed as an argument to msp_fifo_create.
typedef msp_dataloop_args msp_dataloop_args_t
 Data structure passed to the application's data loop.
typedef msp_dataloop_params_s msp_dataloop_params_t
 Data structure passed by the data loop creator to be in turn passed on to the data loop.
typedef msp_dataloop_result_s msp_dataloop_result_t
 Results of data loop creation passed back the data loop creator.
typedef void *(* msp_data_loop_t )(msp_dataloop_args_t *)
 Syntax for the data loop handler function.

Functions

int msp_init (void)
 Initializes the JUNOS MultiServices PIC SDK library for data path applications.
int msp_control_init (void)
 Initializes the MultiServices PIC SDK library for control path applications.
void msp_exit (void)
 Cleanup function for the MultiServices PIC SDK Library.
int msp_env_get_next_data_cpu (int cpu_num)
 Retrieves the next available data CPU.
int msp_env_get_next_control_cpu (int cpu_num)
 Retrieves next available control CPU.
int msp_env_get_next_user_cpu (int cpu_num)
 Retrieves the next available user CPU.
void * msp_data_recv (msp_data_handle_t dhandle, int *type)
 Receives messages from a data loop.
int msp_data_send (msp_data_handle_t dhandle, void *ptr, int type)
 Sends a message through a data loop.
int msp_data_create_loops (msp_data_loop_t data_loop, msp_dataloop_params_t *dloop_params)
 Attempts to install a data loop on all configured data CPUs.
int msp_data_create_loop_on_cpu (int cpu_num, msp_data_loop_t data_loop, msp_dataloop_params_t *dloop_params, msp_dataloop_result_t *dloop_result)
 Installs a data loop on a CPU.
int msp_data_get_cpu_num (msp_data_handle_t dhandle)
 Retrieves the associated CPU number from a data loop identifier.
int msp_data_loop_is_created (int cpu_num)
 Checks whether a data loop has been created on the CPU.
int msp_process_bind (int CPU)
 Allows a process to bind itself to a particular CPU.
int msp_process_unbind (void)
 Allows a process to unbind itself from the CPU to which it was bound.
int msp_env_get_next_data_core (int core_num)
 Retrieves next available data core.
int msp_env_get_next_data_cpu_in_core (int core_num, int cpu_num)
 Retrieves next available user CPU inside a data core.
int msp_env_get_next_control_core (int core_num)
 Retrieves next available control core.
int msp_env_get_next_control_cpu_in_core (int core_num, int cpu_num)
 Retrieves next available CPU inside a control core.
int msp_env_get_next_user_core (int core_num)
 Retrieves next available user core.
int msp_env_get_next_user_cpu_in_core (int core_num, int cpu_num)
 Retrieves next available CPU inside a user core.
int msp_env_cpu_to_core (int cpu_num)
 Gets the core number to which a CPU belongs.
int msp_env_get_max_cpus (void)
 Gets the maximum number of CPUs in the MultiServices PIC SDK environment.
int msp_fifo_create_fifo (int cpu_num, msp_fifo_create_t *fcreate)
 Creates a FIFO on a CPU cpu_num.
void msp_fifo_delete_fifo (int cpu_num)
 Deletes a FIFO on a CPU cpu_num.
void * msp_fifo_recv (msp_fifo_handle_t fhandle, int *type)
 Receives a message from the specified FIFO queue.
int msp_fifo_send (msp_fifo_handle_t fhandle, void *ptr, int type)
 Send a message through a FIFO.
msp_fifo_handle_t msp_fifo_get_handle_from_cpu (int cpu_num)
 Retrieves a FIFO queue identifier from a CPU number.
int msp_fifo_register_pthread (msp_fifo_handle_t fhandle, pthread_t tid)
 Associates a FIFO queue with a pthread.
int msp_fifo_unregister_pthread (msp_fifo_handle_t fhandle)
 Disassociates a FIFO queue from a pthread.
msp_fifo_handle_t msp_data_get_fhandle (msp_data_handle_t dhandle)
 Retrieves the associated FIFO queue identifier from a data loop identifier.
int msp_get_current_cpu (void)
 Returns the current CPU on which the thread of execution is running.
int msp_send_packet (void *buf)
 Transmits the packet using the current dataloop.


Detailed Description

Defines the functions and external data structures for the MultiServices PIC SDK.

This file must be included in any implementation of the MultiServices PIC SDK library.

API and external data structure definitions for MP-SDK.

This is the main header file to be included by the users of the MP-SDK library. Some important services of MP-SDK library are, Exposing the programming environment like number of available CPUs, create Packet Loops to send and receive data, create pthreads, bind the pthreads or processes to particular CPU.

The different types of CPUs are described below.

Control CPU: The CPU to use to write control plane applications. This CPU comes with full TCP/IP stack and applications can use socket programming to write network applications. MP-SDK documentation may refer to these applications as "Server Applications".

Data CPU: The CPU to use to write data plane applications. Data plane applications are generally fast path applications which are raw packet based. They generally process packets in a tight loop. We call them "Data Loops" or "Packet Loops". Most of the APIs in this file implement functionality to enable users to write the data plane based applications, also referred sometimes as "Transit applications". Data CPUs can also be used for any general computing.

User CPU: The CPU which isn't designated as any of the above CPU types is mapped as a User CPU. These CPU's aren't capable of handling any network traffic. Hence they can be used to run applications that do not have to deal with packet processing in general.

Other important terminologies explained.

Data Loop: Also called a "Packet Loop". The transit applications running on data CPU should run a Packet Loop which sends and receives data. A "Data Loop" is an abstraction provided by MP-SDK library which includes,

o A pthread which actually runs the "Data Loop".

o The above pthread is bound to a CPU.

o A FIFO(explained down below) reserved for the "Data Loop" to do the actual send and receive.

All the above will automatically be taken care by the Data Loop creation APIs.

FIFO: A "First In First Out" data structure used for the actual transmission and reception of messages. A message can be a network packet or any other type of data. The 'type' attribute of the FIFO APIs should be used to differentiate different types of messages. Data Loop users don't have to deal with FIFOs directly. But the FIFO APIs are available for users who want to use them directly. Sample applications for MP-SDK will demonstrate the usage of FIFOs directly.


Define Documentation

#define MSP_CPU_NONE   -1
 

Returns the value of msp_env_get_next_xxx function's indicating there's no further valid CPU.

This is targeted for deprecation, so please refrain from using it. Use MSP_NEXT_NONE instead.


Function Documentation

int msp_control_init void   ) 
 

Initializes the MultiServices PIC SDK library for control path applications.

This function initializes the MultiServices PIC SDK environment for control path applications. It matches current system capabilities, as well as any other required internal initialization.

This function must be called before using any other MultiServices PIC SDK functions.

Returns:
MSP_OK on success; otherwise, returns one of the the error codes listed below:
  • MSP_ENV_INIT_FAIL - Couldn't retrieve the MultiServices PIC SDK operating environment.
  • MSP_HASH_INIT_FAIL - hash & flow affinity initialization failed.
See also:
msp_init() for initializing data path application environment.

int msp_data_create_loop_on_cpu int  cpu_num,
msp_data_loop_t  data_loop,
msp_dataloop_params_t dloop_params,
msp_dataloop_result_t dloop_result
 

Installs a data loop on a CPU.

Parameters:
[in] cpu_num CPU number on which the data loop needs to be installed.
[in] data_loop The function that implements the data loop.
[in] *dloop_params A pointer of type msp_dataloop_params_t. Any application-specific data can be passed in the app_data field of dloop_params.
[out] *dloop_result A pointer of type msp_dataloop_result_t. Upon success dloop_result contains the useful information about the newly created data loop.
Returns:
MSP_OK on success; otherwise, return the error code:
  • MSP_DATALOOP_NULL_ARG - A NULL argument was passed.
  • MSP_MEM_ALLOC_FAIL - Could not allocate memory.
  • MSP_DATA_LOOP_EXISTS - A data loop already exists.
  • MSP_DATALOOP_CREATE_FAIL - Data loop creation failed.
  • MSP_DATALOOP_INVALID_CPU - An invalid CPU number was passed.

int msp_data_create_loops msp_data_loop_t  data_loop,
msp_dataloop_params_t dloop_params
 

Attempts to install a data loop on all configured data CPUs.

This function attempts to install a data loop on all configured data CPUs. A data loop, also called a packet loop is an abstraction provided by the MP SDK library, which includes:

o A pthread which actually runs the data loop.

o The above pthread is bound to a CPU.

o A FIFO reserved for the data loop to do the actual send and receive.

All the above will automatically be performed by the data loop creation functions.

This function returns an error code immediately if an attempt to install a data loop on a cpu fails. In this case, the data loops created earlier remain unaffected.

Parameters:
[in] data_loop The function that implements the data loop.
[in] *dloop_params A Pointer of type msp_dataloop_params_t. Any application-specific data can be passed in the app_data field of dloop_params.
Returns:
  • MSP_OK on success; otherwise, returns an error code:
  • MSP_DATALOOP_NULL_ARG - A NULL argument was passed.
  • MSP_MEM_ALLOC_FAIL - Could not allocate memory.
  • MSP_DATA_LOOP_EXISTS - A data loop already exists.
  • MSP_DATALOOP_CREATE_FAIL - Data loop creation failed.

int msp_data_get_cpu_num msp_data_handle_t  dhandle  ) 
 

Retrieves the associated CPU number from a data loop identifier.

Parameters:
[in] dhandle Data loop identifier
Returns:
CPU number used by dhandle on success; otherwise MSP_NEXT_NONE.

msp_fifo_handle_t msp_data_get_fhandle msp_data_handle_t  dhandle  ) 
 

Retrieves the associated FIFO queue identifier from a data loop identifier.

Parameters:
[in] dhandle Data loop identifier.
Returns:
FIFO identifier of type msp_fifo_handle_t on success; otherwise MSP_FIFO_HANDLE_INVALID.

int msp_data_loop_is_created int  cpu_num  ) 
 

Checks whether a data loop has been created on the CPU.

Parameters:
[in] cpu_num CPU number.
Returns:
1 if a data loop is created on CPU cpu_num; otherwise 0.

void* msp_data_recv msp_data_handle_t  dhandle,
int *  type
 

Receives messages from a data loop.

Parameters:
[in] dhandle Data loop identifier
[out] *type The message type being received.
Returns:
Pointer to received message on success; otherwise NULL.

int msp_data_send msp_data_handle_t  dhandle,
void *  ptr,
int  type
 

Sends a message through a data loop.

Parameters:
[in] dhandle Data loop identifier.
[in] *ptr The pointer to message to send.
[in] type The type of message being sent.
Returns:
MSP_OK on success; otherwise, returns an error code:
  • MSP_DATA_SEND_RETRY - Send retry needed.
  • MSP_DATA_SEND_FAIL - Send failed.

int msp_env_cpu_to_core int  cpu_num  ) 
 

Gets the core number to which a CPU belongs.

Parameters:
[in] cpu_num CPU number.
Returns:
Core number; otherwise MSP_NEXT_NONE to indicate an invalid cpu_num

int msp_env_get_max_cpus void   ) 
 

Gets the maximum number of CPUs in the MultiServices PIC SDK environment.

This function returns the maximum number of CPUs under all roles in the MultiServices PIC SDK environment.

Returns:
Maximum number of CPUs.

int msp_env_get_next_control_core int  core_num  ) 
 

Retrieves next available control core.

This function can be used to loop on all available control cores. Start calling this function with core_num equal to MSP_NEXT_NONE. Repeat until the function returns MSP_NEXT_END.

Parameters:
[in] core_num Current Core number.
Returns:
Next control core number; otherwise MSP_NEXT_NONE if no control cores are present.

int msp_env_get_next_control_cpu int  cpu_num  ) 
 

Retrieves next available control CPU.

This function can be used to loop on all available control CPUs. Start calling this function with cpu_num equal to MSP_NEXT_NONE. Repeat until this function returns MSP_NEXT_END.

Parameters:
[in] cpu_num Current CPU number.
Returns:
Next control CPU number; otherwise MSP_NEXT_END if no more control CPUs are present.

int msp_env_get_next_control_cpu_in_core int  core_num,
int  cpu_num
 

Retrieves next available CPU inside a control core.

This function is used to loop on all available control CPUs inside a core. Start calling this function with cpu_num equal to MSP_NEXT_NONE. Repeat until the function returns MSP_NEXT_END.

Parameters:
[in] core_num Core number.
[in] cpu_num Current CPU number.
Returns:
Next control CPU number inside core_num; otherwise MSP_NEXT_NONE if no control cores are present.

int msp_env_get_next_data_core int  core_num  ) 
 

Retrieves next available data core.

This function can be used to loop on all available data cores. Start calling this function with core_num equal to MSP_NEXT_NONE. Repeat until the function returns MSP_NEXT_END.

Parameters:
[in] core_num Current Core number.
Returns:
Next data core number; otherwise MSP_NEXT_NONE if no user cores are present.

int msp_env_get_next_data_cpu int  cpu_num  ) 
 

Retrieves the next available data CPU.

Call this function with the cpu_num argument set to MSP_CPU_NONE. This function can then be called repeatedly until the function returns the value MSP_CPU_NONE, indicating that no data CPUs remain.

Parameters:
[in] cpu_num Current CPU number.
Returns:
Next data CPU number or MSP_NEXT_END if no more data CPUs are present.

int msp_env_get_next_data_cpu_in_core int  core_num,
int  cpu_num
 

Retrieves next available user CPU inside a data core.

This function is used to loop on all available data CPUs inside a core. Start calling this function with cpu_num equal to MSP_NEXT_NONE. Repeat until the function returns MSP_NEXT_END.

Parameters:
[in] core_num Core number.
[in] cpu_num Current CPU number.
Returns:
Next data CPU number inside core_num; otherwise MSP_NEXT_NONE if no user cores are present.

int msp_env_get_next_user_core int  core_num  ) 
 

Retrieves next available user core.

This function can be used to loop on all available user cores. Start calling this function with core_num equal to MSP_NEXT_NONE. Repeat until the function returns MSP_NEXT_END.

Parameters:
[in] core_num Current Core number.
Returns:
Next user core number; otherwise MSP_NEXT_NONE if no user cores are present.

int msp_env_get_next_user_cpu int  cpu_num  ) 
 

Retrieves the next available user CPU.

This function can be used to loop on all available user CPUs. Start calling this function with cpu_num equal to MSP_NEXT_NONE. Repeat until the function returns MSP_NEXT_END.

Parameters:
[in] cpu_num Current CPU number.
Returns:
Next user CPU number or MSP_NEXT_END if no more user CPUs are present.

int msp_env_get_next_user_cpu_in_core int  core_num,
int  cpu_num
 

Retrieves next available CPU inside a user core.

This function is used to loop on all available user CPUs inside a core. Start calling this function with cpu_num equal to MSP_NEXT_NONE. Repeat until the function returns MSP_NEXT_END.

Parameters:
[in] core_num Core number.
[in] cpu_num Current CPU number.
Returns:
Next user CPU number inside core_num; otherwise MSP_NEXT_NONE if no user cores are present.

void msp_exit void   ) 
 

Cleanup function for the MultiServices PIC SDK Library.

Should be called upon the exit of the application.

This should only be used in a data path application environment.

See also:
msp_init()

int msp_fifo_create_fifo int  cpu_num,
msp_fifo_create_t fcreate
 

Creates a FIFO on a CPU cpu_num.

A FIFO is a "First In First Out" data structure used for the actual transmission and reception of messages. A message can be a network packet or any other type of data. The 'type' attribute of the FIFO functions should be used to differentiate different types of messages.

Parameters:
[in] cpu_num The CPU number on which the FIFO needs to be created.
[out] fcreate Pointer to msp_fifo_create_t type.
Returns:
A valid FIFO identifier in the fhandle field of the fcreate argument and a return code of MSP_OK. Otherwise, the relevant error code is returned otherwise:
  • fhandle of fcreate will have MSP_FIFO_HANDLE_INVALID under error conditions.
  • MSP_FIFO_ALREADY_CREATED - A FIFO has already been created.
  • MSP_FIFO_CREATE_FAIL - Failed to created a FIFO.
  • MSP_FIFO_INVALID_CPU - An invalid CPU number was passed.

void msp_fifo_delete_fifo int  cpu_num  ) 
 

Deletes a FIFO on a CPU cpu_num.

Parameters:
[in] cpu_num The CPU number on which the FIFO needs to be deleted.

msp_fifo_handle_t msp_fifo_get_handle_from_cpu int  cpu_num  ) 
 

Retrieves a FIFO queue identifier from a CPU number.

Parameters:
[in] cpu_num The CPU number.
Returns:
FIFO queue identifier of type msp_fifo_handle_t; otherwise MSP_FIFO_HANDLE_INVALID.

void* msp_fifo_recv msp_fifo_handle_t  fhandle,
int *  type
 

Receives a message from the specified FIFO queue.

Parameters:
[in] fhandle A FIFO queue identifier.
[out] *type The message type being received.
Returns:
Pointer to received message on success; otherwise NULL.

int msp_fifo_register_pthread msp_fifo_handle_t  fhandle,
pthread_t  tid
 

Associates a FIFO queue with a pthread.

Parameters:
[in] fhandle The FIFO queue identifier.
[in] tid The thread ID of the pthread being associated with the FIFO fhandle.
Returns:
Pointer to received message on success; otherwise NULL.

int msp_fifo_send msp_fifo_handle_t  fhandle,
void *  ptr,
int  type
 

Send a message through a FIFO.

Parameters:
[in] fhandle FIFO identifier
[in] *ptr The pointer to the message to send.
[in] type The type of message being sent.
Returns:
MSP_OK on success; otherwise returns an error code:
  • MSP_FIFO_SEND_RETRY - Send retry needed.
  • MSP_FIFO_SEND_FAIL - Send Failed.

int msp_fifo_unregister_pthread msp_fifo_handle_t  fhandle  ) 
 

Disassociates a FIFO queue from a pthread.

Parameters:
[in] fhandle The FIFO queue identifier.
Returns:
MSP_OK on success; otherwise, an error code.

int msp_get_current_cpu void   ) 
 

Returns the current CPU on which the thread of execution is running.

By the time the routine returns it may happen that the thread of execution has migrated to another CPU. This is governed by CPU affinity of that thread. However if the CPU affinity is set to a single CPU the thread of execution will keep on running on the same CPU.

Returns:
cpu number (0 onwards); otherwise -1.

int msp_init void   ) 
 

Initializes the JUNOS MultiServices PIC SDK library for data path applications.

This function initializes the MultiServices PIC SDK environment for data path applications. It matches current system capabilities, as well as any other required internal initialization. This function must be called before using any other MultiServices PIC SDK APIs.

msp_exit() should be called upon shutdown if using this to initialize the data path application environment.

Note:
Restarts are not supported. This routine may fail if called multiple times.
Returns:
MSP_OK on success; otherwise, returns one of the the error codes listed below:
  • MSP_ENV_INIT_FAIL - Couldn't retrieve the MultiServices PIC SDK operating environment.
  • MSP_FIFO_INIT_FAIL - FIFO sub-system initialization failed.
  • MSP_JBUF_INIT_FAIL - jbuf subsystem initialization failed.
  • MSP_HASH_INIT_FAIL - hash & flow affinity initialization failed.
See also:
msp_control_init() for initializing control path application environment.

int msp_process_bind int  CPU  ) 
 

Allows a process to bind itself to a particular CPU.

Using this function doesn't guarantee exclusive access of the CPU to the process, but ensures that the process doesn't migrate to another CPU.

Parameters:
[in] CPU CPU to which the process wants to bind.
Returns:
0 for success; otherwise errno on error.

int msp_process_unbind void   ) 
 

Allows a process to unbind itself from the CPU to which it was bound.

After the function returns, the process can be scheduled on any processor that the scheduling policy chooses. It has no affect on a process that was not bound.

Returns:
0 for success; otherwise @ errno on error.

int msp_send_packet void *  buf  ) 
 

Transmits the packet using the current dataloop.

Parameters:
[in] buf Jbuf to transmit
Returns:
MSP_OK on success. Otherwise returns an error code.
  • MSP_FIFO_HANDLE_INVALID - Invalid FIFO handle on current dataloop.
  • MSP_FIFO_SEND_RETRY - Send retry needed.
  • MSP_FIFO_SEND_FAIL - Send Failed.
  • MSP_DATALOOP_NULL_ARG - NULL packet to transmit.
  • MSP_FIFO_JBUF_TOO_LONG - Too much data in the packet.


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:24:47 2010 for libmp-sdk by Doxygen 1.4.5