NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
DOCA PCC Device Common
Collaboration diagram for DOCA PCC Device Common:

Macros

#define DOCA_DPA_DEVICE
 declares that we are compiling for the DPA Device More...
 
#define ALWAYS_INLINE   __attribute__((always_inline))
 force inline wrapper More...
 
#define FORCE_INLINE   static inline ALWAYS_INLINE
 static inline wrapper More...
 
#define DOCA_PCC_DEV_GET_PORT_COUNTER_ID(port, type, plane)    (((port & 0xF)) | ((type & 0xF) << 4) | ((plane & 0XF) << 8) | ((1) << 24))
 Generates a unique ID using the logical port number, counter type, and plane parameters for identifying specific port counters. More...
 
#define DOCA_PCC_DEV_MAX_NUM_PORTS   (__NV_DPA >= __NV_DPA_CX8 ? 8 : 4)
 Max number of NIC ports supported by the lib. More...
 

Enumerations

enum  doca_pcc_dev_error_t { DOCA_PCC_DEV_STATUS_OK = 0 , DOCA_PCC_DEV_STATUS_FAIL = 1 }
 API functions return status. More...
 
enum  doca_pcc_dev_nic_port_counter_types_t { DOCA_PCC_DEV_NIC_COUNTER_TYPE_RX_BYTES = 0x1 , DOCA_PCC_DEV_NIC_COUNTER_TYPE_TX_BYTES = 0x2 }
 NIC counter types. More...
 

Functions

DOCA_EXPERIMENTAL void doca_pcc_dev_nic_counters_config (uint32_t *counter_ids, uint32_t num_counters, uint32_t *values)
 Prepare a list of counters to read. More...
 
DOCA_EXPERIMENTAL ALWAYS_INLINE void doca_pcc_dev_nic_counters_sample (void)
 Sample counters according to the prior configuration call. More...
 
DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_logical_ports (void)
 Get mask of initiated logical ports. More...
 
DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_port_planes (uint32_t portid)
 Get number of available planes per a given port. More...
 
DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_port_speed (uint32_t portid)
 Get speed in Gbps units per a given port. More...
 
DOCA_EXPERIMENTAL void doca_pcc_dev_user_port_info_changed (uint32_t portid) __attribute__((weak))
 User callback triggered on a port state change. More...
 

Detailed Description

DOCA PCC Device library. For more details please refer to the user guide on DOCA devzone.

Macro Definition Documentation

◆ ALWAYS_INLINE

#define ALWAYS_INLINE   __attribute__((always_inline))

force inline wrapper

Definition at line 44 of file doca_pcc_dev_common.h.

◆ DOCA_DPA_DEVICE

#define DOCA_DPA_DEVICE

declares that we are compiling for the DPA Device

Note
Must be defined before the first API use/include of DOCA

Definition at line 31 of file doca_pcc_dev_common.h.

◆ DOCA_PCC_DEV_GET_PORT_COUNTER_ID

#define DOCA_PCC_DEV_GET_PORT_COUNTER_ID (   port,
  type,
  plane 
)     (((port & 0xF)) | ((type & 0xF) << 4) | ((plane & 0XF) << 8) | ((1) << 24))

Generates a unique ID using the logical port number, counter type, and plane parameters for identifying specific port counters.

Definition at line 71 of file doca_pcc_dev_common.h.

◆ DOCA_PCC_DEV_MAX_NUM_PORTS

#define DOCA_PCC_DEV_MAX_NUM_PORTS   (__NV_DPA >= __NV_DPA_CX8 ? 8 : 4)

Max number of NIC ports supported by the lib.

Definition at line 77 of file doca_pcc_dev_common.h.

◆ FORCE_INLINE

#define FORCE_INLINE   static inline ALWAYS_INLINE

static inline wrapper

Definition at line 49 of file doca_pcc_dev_common.h.

Enumeration Type Documentation

◆ doca_pcc_dev_error_t

API functions return status.

Enumerator
DOCA_PCC_DEV_STATUS_OK 

completed successfully

DOCA_PCC_DEV_STATUS_FAIL 

Failed

Definition at line 54 of file doca_pcc_dev_common.h.

◆ doca_pcc_dev_nic_port_counter_types_t

NIC counter types.

Enumerator
DOCA_PCC_DEV_NIC_COUNTER_TYPE_RX_BYTES 

RX bytes NIC counter type

DOCA_PCC_DEV_NIC_COUNTER_TYPE_TX_BYTES 

TX bytes NIC counter type

Definition at line 62 of file doca_pcc_dev_common.h.

Function Documentation

◆ doca_pcc_dev_get_logical_ports()

DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_logical_ports ( void  )

Get mask of initiated logical ports.

Note
- it is recommended to get logical ports mask in the port info change callback.
See also
doca_pcc_dev_user_port_info_changed()
Returns
- ports mask

◆ doca_pcc_dev_get_port_planes()

DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_port_planes ( uint32_t  portid)

Get number of available planes per a given port.

Note
- it is recommended to get port planes in the port info change callback.
See also
doca_pcc_dev_user_port_info_changed()
Parameters
[in]portid- port number
Returns
- number of port planes

◆ doca_pcc_dev_get_port_speed()

DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_port_speed ( uint32_t  portid)

Get speed in Gbps units per a given port.

Note
- it is recommended to get port speed in the port info change callback.
See also
doca_pcc_dev_user_port_info_changed()
Parameters
[in]portid- port number
Returns
- port speed

◆ doca_pcc_dev_nic_counters_config()

DOCA_EXPERIMENTAL void doca_pcc_dev_nic_counters_config ( uint32_t *  counter_ids,
uint32_t  num_counters,
uint32_t *  values 
)

Prepare a list of counters to read.

The list is stored in kernel memory. A single counters config per process is supported.

Warning
process crashes in case of: counters_ids too large bad pointers of values, counter_ids unknown counter
Note
  • arrays memory must be defined in global or heap memory only.
  • it is recommended to configure counters in the port info change callback.
See also
doca_pcc_dev_user_port_info_changed()
Parameters
[in]counter_ids- An array of counter ids.
[in]num_counters- number of counters in the counter_ids array
[out]values- buffer to store counters values (32b) read by doca_pcc_dev_nic_counters_sample()

◆ doca_pcc_dev_nic_counters_sample()

DOCA_EXPERIMENTAL ALWAYS_INLINE void doca_pcc_dev_nic_counters_sample ( void  )

Sample counters according to the prior configuration call.

Warning
process crashes in case of: doca_pcc_dev_nic_counters_config() never called

Sample counter_ids, num_counters and values buffer provided in the last successful call to doca_pcc_dev_nic_counters_config(). This call ensures fastest sampling on a pre-checked counter ids and buffers.

◆ doca_pcc_dev_user_port_info_changed()

DOCA_EXPERIMENTAL void doca_pcc_dev_user_port_info_changed ( uint32_t  portid)

User callback triggered on a port state change.

The user may implement this function to initiate port related operations, E.G counter sampling, or parameters changes

Note
: Implementation of this function is optional.
Parameters
[in]portid- changed port id

Definition at line 57 of file np_nic_telemetry_dev_main.c.