CNDP  22.08.0
cne_system.h File Reference
#include <sys/syscall.h>
#include <stdint.h>
#include <cne_common.h>

Go to the source code of this file.

Functions

CNDP_API unsigned cne_core_id (unsigned lcore_id)
 
CNDP_API unsigned int cne_max_lcores (void)
 
CNDP_API int cne_max_numa_nodes (void)
 
CNDP_API int cne_lcore_id (void)
 
CNDP_API int cne_lcore_id_by_thread (int thread_idx)
 
CNDP_API unsigned int cne_socket_id (unsigned lcore_id)
 
CNDP_API unsigned int cne_socket_id_self (void)
 
CNDP_API uint16_t cne_device_socket_id (char *netdev)
 
CNDP_API unsigned int cne_socket_count (void)
 
CNDP_API uint64_t cne_get_timer_hz (void)
 

Detailed Description

API for lcore and socket manipulation

Definition in file cne_system.h.

Function Documentation

◆ cne_core_id()

CNDP_API unsigned cne_core_id ( unsigned  lcore_id)

Get cpu core_id base in lcore ID value from /sys/.../cpuX path.

This function is private to the CNE.

Parameters
lcore_idThe lcore ID value to location.

◆ cne_max_lcores()

CNDP_API unsigned int cne_max_lcores ( void  )

Return the number of execution units (lcores) on the system.

Returns
the number of execution units (lcores) on the system.
Examples
examples/dlb_test/dlb_test.c, and examples/helloworld/main.c.

◆ cne_max_numa_nodes()

CNDP_API int cne_max_numa_nodes ( void  )

Return the number of NUMA zones.

Returns
The number of numa zones.
Examples
examples/dlb_test/dlb_test.c, and examples/helloworld/main.c.

◆ cne_lcore_id()

CNDP_API int cne_lcore_id ( void  )

◆ cne_lcore_id_by_thread()

CNDP_API int cne_lcore_id_by_thread ( int  thread_idx)

Return the lcore ID of the given thread id.

Parameters
thread_idxThread id to get find the lcore id
Returns
-1 on error or lcore id value

◆ cne_socket_id()

CNDP_API unsigned int cne_socket_id ( unsigned  lcore_id)

Return the ID of the physical socket of the logical core we are running on.

Parameters
lcore_idThe lcore ID value to use to return the socket ID.
Returns
The ID of current lcore id's physical socket

◆ cne_socket_id_self()

CNDP_API unsigned int cne_socket_id_self ( void  )

Return the socket id for the current lcore

Returns
The ID of the socket for the current lcore

◆ cne_device_socket_id()

CNDP_API uint16_t cne_device_socket_id ( char *  netdev)

Return the socket id for the given netdev name

Parameters
netdevThe netdev name string.
Returns
The ID of the socket for the given netdev name or -1 if not found.

◆ cne_socket_count()

CNDP_API unsigned int cne_socket_count ( void  )

Return number of physical sockets detected on the system.

Note that number of nodes may not be correspondent to their physical id's: for example, a system may report two socket id's, but the actual socket id's may be 0 and 8.

Returns
the number of physical sockets as recognized by CNE

◆ cne_get_timer_hz()

CNDP_API uint64_t cne_get_timer_hz ( void  )

Get the measured frequency of the RDTSC counter

Returns
The TSC frequency for this lcore
Examples
examples/timer/main.c.