NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
pcc_core.h
Go to the documentation of this file.
1 
26 #ifndef PCC_CORE_H_
27 #define PCC_CORE_H_
28 
29 #include <doca_pcc.h>
30 #include <doca_dev.h>
31 #include <doca_error.h>
32 
33 #define PCC_RP_THREADS_NUM_DEFAULT_VALUE \
34  (48 + 1) /* Default Number of PCC RP threads, the extra one is used for communication */
35 #define PCC_NP_THREADS_NUM_DEFAULT_VALUE (16) /* Default Number of PCC NP threads */
36 #define WAIT_TIME_DEFAULT_VALUE (-1) /* Wait time - default value (infinity) */
37 #define IFA2_HOP_LIMIT_DEFAULT_VALUE (0xFE) /* IFA2 packet hop limit value */
38 #define IFA2_GNS_DEFAULT_VALUE (0xF) /* IFA2 packet GNS value */
39 #define IFA2_GNS_IGNORE_DEFAULT_VALUE (0) /* IFA2 packet GNS value */
40 #define IFA2_GNS_IGNORE_DEFAULT_MASK (0) /* IFA2 packet GNS value */
41 #define PCC_COREDUMP_FILE_DEFAULT_PATH ("/tmp/doca_pcc_coredump.txt") /* Default pathname for device coredump file */
42 #define PCC_PRINT_BUFFER_SIZE_DEFAULT_VALUE (512 * 2048) /* Device print buffer size - default value */
43 #define PCC_MAILBOX_REQUEST_SIZE (sizeof(uint32_t)) /* Size of the mailbox request */
44 #define PCC_MAILBOX_RESPONSE_SIZE (0) /* Size of the mailbox response. Currently not used */
45 #define MAX_USER_ARG_SIZE (1024) /* Maximum size of user input argument */
46 #define MAX_ARG_SIZE (MAX_USER_ARG_SIZE + 1) /* Maximum size of input argument */
47 
48 #define LOG_LEVEL_CRIT (20) /* Critical log level */
49 #define LOG_LEVEL_ERROR (30) /* Error log level */
50 #define LOG_LEVEL_WARNING (40) /* Warning log level */
51 #define LOG_LEVEL_INFO (50) /* Info log level */
52 #define LOG_LEVEL_DEBUG (60) /* Debug log level */
53 
54 /* Default PCC RP threads */
56 /* Default PCC NP threads */
58 
59 /* Log level */
60 extern int log_level;
61 
62 #define PRINT_CRIT(...) \
63  do { \
64  if (log_level >= LOG_LEVEL_CRIT) \
65  printf(__VA_ARGS__); \
66  } while (0)
67 
68 #define PRINT_ERROR(...) \
69  do { \
70  if (log_level >= LOG_LEVEL_ERROR) \
71  printf(__VA_ARGS__); \
72  } while (0)
73 
74 #define PRINT_WARNING(...) \
75  do { \
76  if (log_level >= LOG_LEVEL_WARNING) \
77  printf(__VA_ARGS__); \
78  } while (0)
79 
80 #define PRINT_INFO(...) \
81  do { \
82  if (log_level >= LOG_LEVEL_INFO) \
83  printf(__VA_ARGS__); \
84  } while (0)
85 
86 #define PRINT_DEBUG(...) \
87  do { \
88  if (log_level >= LOG_LEVEL_DEBUG) \
89  printf(__VA_ARGS__); \
90  } while (0)
91 
92 /*
93  * DOCA PCC Reaction Point RTT Template DPA program name
94  */
95 extern struct doca_pcc_app *pcc_rp_rtt_template_app;
96 
97 /*
98  * DOCA PCC Reaction Point Switch Telemetry DPA program name
99  */
100 extern struct doca_pcc_app *pcc_rp_switch_telemetry_app;
101 
102 /*
103  * DOCA PCC Notification Point NIC Telemetry DPA program name
104  */
105 extern struct doca_pcc_app *pcc_np_nic_telemetry_app;
106 
107 /*
108  * DOCA PCC Notification Point Switch Telemetry DPA program name
109  */
110 extern struct doca_pcc_app *pcc_np_switch_telemetry_app;
111 
115 typedef enum {
120 
124 typedef enum {
127 } pcc_role_t;
128 
129 struct pcc_config {
130  char device_name[DOCA_DEVINFO_IBDEV_NAME_SIZE]; /* DOCA device name */
131  pcc_role_t role; /* PCC role */
132  struct doca_pcc_app *app; /* Device program */
133  uint32_t threads_num; /* Number of PCC threads */
134  uint32_t threads_list[MAX_ARG_SIZE]; /* Threads numbers */
135  int wait_time; /* Wait duration */
137  bool remote_sw_handler; /* CCMAD probe type remote SW handler flag */
138  uint8_t hop_limit; /* IFA2 hop limit value */
139  uint8_t gns; /* IFA2 GNS value */
140  uint8_t gns_ignore_value; /* IFA2 GNS ignore value */
141  uint8_t gns_ignore_mask; /* IFA2 GNS ignore mask */
142  char coredump_file[MAX_ARG_SIZE]; /* Coredump file pathname */
143  char dpa_resources_file[MAX_ARG_SIZE]; /* DPA resources yaml file path */
144  char dpa_application_key[MAX_ARG_SIZE]; /* DPA application file name */
145 };
146 
148  struct doca_dev *doca_device; /* DOCA device */
149  struct doca_pcc *doca_pcc; /* DOCA PCC context */
150 };
151 
152 /*
153  * Initialize the PCC application resources
154  *
155  * @cfg [in]: PCC application user configurations
156  * @resources [in/out]: PCC resources
157  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
158  */
160 
161 /*
162  * Send the ports bandwidth to device via mailbox
163  *
164  * @cfg [in]: PCC application user configurations
165  * @resources [in]: PCC resources
166  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
167  */
169 
170 /*
171  * Destroy the PCC application resources
172  *
173  * @resources [in]: PCC resources
174  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
175  */
177 
178 /*
179  * Register the command line parameters for the PCC application.
180  *
181  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
182  */
184 
185 #endif /* PCC_CORE_H_ */
struct rdma_resources resources
#define DOCA_DEVINFO_IBDEV_NAME_SIZE
Buffer size to hold Infiniband/RoCE device name. Including a null terminator.
Definition: doca_dev.h:309
enum doca_error doca_error_t
DOCA API return codes.
const struct ip_frag_config * cfg
Definition: ip_frag_dp.c:0
struct doca_pcc_app * pcc_np_nic_telemetry_app
const uint32_t default_pcc_rp_threads_list[PCC_RP_THREADS_NUM_DEFAULT_VALUE]
Definition: pcc_core.c:57
pcc_role_t
intelemetry request packet format
Definition: pcc_core.h:124
@ PCC_ROLE_NP
Definition: pcc_core.h:126
@ PCC_ROLE_RP
Definition: pcc_core.h:125
doca_error_t pcc_init(struct pcc_config *cfg, struct pcc_resources *resources)
Definition: pcc_core.c:246
#define PCC_RP_THREADS_NUM_DEFAULT_VALUE
Definition: pcc_core.h:33
struct doca_pcc_app * pcc_rp_switch_telemetry_app
struct doca_pcc_app * pcc_np_switch_telemetry_app
#define PCC_NP_THREADS_NUM_DEFAULT_VALUE
Definition: pcc_core.h:35
const uint32_t default_pcc_np_threads_list[PCC_NP_THREADS_NUM_DEFAULT_VALUE]
Definition: pcc_core.c:62
pcc_dev_probe_packet_type_t
intelemetry request packet format
Definition: pcc_core.h:115
@ PCC_DEV_PROBE_PACKET_IFA1
Definition: pcc_core.h:117
@ PCC_DEV_PROBE_PACKET_IFA2
Definition: pcc_core.h:118
@ PCC_DEV_PROBE_PACKET_CCMAD
Definition: pcc_core.h:116
#define MAX_ARG_SIZE
Definition: pcc_core.h:46
struct doca_pcc_app * pcc_rp_rtt_template_app
int log_level
Definition: pcc.c:40
doca_error_t register_pcc_params(void)
Definition: pcc_core.c:898
doca_error_t pcc_mailbox_send(struct pcc_config *cfg, struct pcc_resources *resources)
Definition: pcc_core.c:491
doca_error_t pcc_destroy(struct pcc_resources *resources)
Definition: pcc_core.c:525
uint8_t gns
Definition: pcc_core.h:139
char coredump_file[MAX_ARG_SIZE]
Definition: pcc_core.h:142
int wait_time
Definition: pcc_core.h:135
uint8_t gns_ignore_value
Definition: pcc_core.h:140
uint32_t threads_list[MAX_ARG_SIZE]
Definition: pcc_core.h:134
struct doca_pcc_app * app
Definition: pcc_core.h:132
uint32_t threads_num
Definition: pcc_core.h:133
pcc_role_t role
Definition: pcc_core.h:131
char dpa_application_key[MAX_ARG_SIZE]
Definition: pcc_core.h:144
char device_name[DOCA_DEVINFO_IBDEV_NAME_SIZE]
Definition: pcc_core.h:130
uint8_t hop_limit
Definition: pcc_core.h:138
uint8_t gns_ignore_mask
Definition: pcc_core.h:141
char dpa_resources_file[MAX_ARG_SIZE]
Definition: pcc_core.h:143
pcc_dev_probe_packet_type_t probe_packet_format
Definition: pcc_core.h:136
bool remote_sw_handler
Definition: pcc_core.h:137
struct doca_dev * doca_device
Definition: pcc_core.h:148
struct doca_pcc * doca_pcc
Definition: pcc_core.h:149