NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_pcc_dev_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES, ALL RIGHTS RESERVED.
3  *
4  * This software product is a proprietary product of NVIDIA CORPORATION &
5  * AFFILIATES (the "Company") and all right, title, and interest in and to the
6  * software product, including all associated intellectual property rights, are
7  * and shall remain exclusively with the Company.
8  *
9  * This software product is governed by the End User License Agreement
10  * provided with the software product.
11  *
12  */
13 
23 #ifndef DOCA_PCC_DEV_COMMON_H_
24 #define DOCA_PCC_DEV_COMMON_H_
25 
31 #define DOCA_DPA_DEVICE
32 
33 #include <stdint.h>
34 #include <stddef.h>
35 #include <doca_compat.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
44 #define ALWAYS_INLINE __attribute__((always_inline))
45 
49 #define FORCE_INLINE static inline ALWAYS_INLINE
50 
54 typedef enum {
58 
62 typedef enum {
66 
71 #define DOCA_PCC_DEV_GET_PORT_COUNTER_ID(port, type, plane) \
72  (((port & 0xF)) | ((type & 0xF) << 4) | ((plane & 0XF) << 8) | ((1) << 24))
73 
77 #define DOCA_PCC_DEV_MAX_NUM_PORTS (__NV_DPA >= __NV_DPA_CX8 ? 8 : 4)
78 
99 void doca_pcc_dev_nic_counters_config(uint32_t *counter_ids, uint32_t num_counters, uint32_t *values);
100 
112 
122 
133 uint32_t doca_pcc_dev_get_port_planes(uint32_t portid);
134 
145 uint32_t doca_pcc_dev_get_port_speed(uint32_t portid);
146 
157 void doca_pcc_dev_user_port_info_changed(uint32_t portid) __attribute__((weak));
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif /* DOCA_PCC_DEV_COMMON_H_ */
164 
#define __attribute__(_x_)
To allow compiling functions and structs that are using GCC attributes using attribute() in compilers...
Definition: doca_compat.h:81
#define DOCA_EXPERIMENTAL
To set a Symbol (or specifically a function) as experimental.
Definition: doca_compat.h:103
DOCA_EXPERIMENTAL ALWAYS_INLINE void doca_pcc_dev_nic_counters_sample(void)
Sample counters according to the prior configuration call.
DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_port_speed(uint32_t portid)
Get speed in Gbps units per a given port.
DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_port_planes(uint32_t portid)
Get number of available planes per a given port.
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.
doca_pcc_dev_nic_port_counter_types_t
NIC counter types.
#define ALWAYS_INLINE
force inline wrapper
DOCA_EXPERIMENTAL void doca_pcc_dev_user_port_info_changed(uint32_t portid) __attribute__((weak))
User callback triggered on a port state change.
doca_pcc_dev_error_t
API functions return status.
DOCA_EXPERIMENTAL uint32_t doca_pcc_dev_get_logical_ports(void)
Get mask of initiated logical ports.
@ DOCA_PCC_DEV_NIC_COUNTER_TYPE_RX_BYTES
@ DOCA_PCC_DEV_NIC_COUNTER_TYPE_TX_BYTES
@ DOCA_PCC_DEV_STATUS_OK
@ DOCA_PCC_DEV_STATUS_FAIL
uint32_t counter_ids[DOCA_PCC_DEV_MAX_NUM_PORTS]