NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_pcc.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 
22 #ifndef DOCA_PCC_H_
23 #define DOCA_PCC_H_
24 
25 #include <stdbool.h>
26 #include <doca_compat.h>
27 #include <doca_error.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 struct doca_devinfo;
37 struct doca_dev;
38 struct doca_pcc;
39 
47 struct doca_pcc_app;
48 
49 /* Single trace message struct */
50 struct doca_pcc_bin_report;
51 
64 doca_error_t doca_devinfo_get_is_pcc_supported(const struct doca_devinfo *devinfo);
65 
78 doca_error_t doca_pcc_np_cap_is_supported(const struct doca_devinfo *devinfo);
79 
97 doca_error_t doca_pcc_create(struct doca_dev *doca_dev, struct doca_pcc **pcc);
98 
116 doca_error_t doca_pcc_np_create(struct doca_dev *doca_dev, struct doca_pcc **pcc);
117 
134 doca_error_t doca_pcc_destroy(struct doca_pcc *pcc);
135 
151 doca_error_t doca_pcc_start(struct doca_pcc *pcc);
152 
165 doca_error_t doca_pcc_stop(struct doca_pcc *pcc);
166 
179 doca_error_t doca_pcc_get_min_num_threads(struct doca_pcc *pcc, uint32_t *min_num_threads);
180 
193 doca_error_t doca_pcc_get_max_num_threads(struct doca_pcc *pcc, uint32_t *max_num_threads);
194 
212 doca_error_t doca_pcc_set_app(struct doca_pcc *pcc, struct doca_pcc_app *app);
213 
229 doca_error_t doca_pcc_cap_get_num_probe_format_slots(struct doca_pcc *pcc, uint32_t *num_probe_format_slots);
230 
250 doca_error_t doca_pcc_set_ccmad_probe_packet_format(struct doca_pcc *pcc, uint32_t probe_format_slot);
251 
269 doca_error_t doca_pcc_set_ifa1_probe_packet_format(struct doca_pcc *pcc, uint32_t probe_format_slot);
270 
288 doca_error_t doca_pcc_set_ifa2_probe_packet_format(struct doca_pcc *pcc, uint32_t probe_format_slot);
289 
308 doca_error_t doca_pcc_rp_set_ccmad_remote_sw_handler(struct doca_pcc *pcc, uint32_t probe_format_slot, bool sw_handler);
309 
324 
344  uint32_t probe_format_slot,
345  uint8_t header_size);
346 
350 typedef enum {
353 
374  uint32_t probe_format_slot,
376 
399 doca_error_t doca_pcc_set_ifa1_probe_marker(struct doca_pcc *pcc, uint32_t probe_format_slot, uint64_t probe_marker);
400 
420 doca_error_t doca_pcc_rp_set_ifa2_gns(struct doca_pcc *pcc, uint32_t probe_format_slot, uint8_t gns);
421 
447  uint32_t probe_format_slot,
448  uint8_t ignore_mask,
449  uint8_t ignore_value);
450 
470 doca_error_t doca_pcc_rp_set_ifa2_hop_limit(struct doca_pcc *pcc, uint32_t probe_format_slot, uint8_t hop_limit);
471 
489 doca_error_t doca_pcc_set_thread_affinity(struct doca_pcc *pcc, uint32_t num_threads, uint32_t *affinity_configs);
490 
507 doca_error_t doca_pcc_set_trace_message(struct doca_pcc *pcc, char **trace_message);
508 
523 
538 
556 doca_error_t doca_pcc_trace_buf_set(struct doca_pcc *pcc, void *buf_addr, uint32_t buf_size);
557 
570 doca_error_t doca_pcc_trace_buf_get(struct doca_pcc *pcc, void **buf_addr, uint32_t *buf_size);
571 
589 doca_error_t doca_pcc_trace_file_set(struct doca_pcc *pcc, const char *file_path);
590 
607 doca_error_t doca_pcc_trace_file_get(struct doca_pcc *pcc, char **file_path, uint32_t *file_path_len);
608 
619 typedef int (*doca_pcc_trace_callback_t)(void *ctx, struct doca_pcc_bin_report *reps, int reps_size);
620 
636  doca_pcc_trace_callback_t trace_callback,
637  void *user_ctx);
638 
654 doca_error_t doca_pcc_set_print_buffer_size(struct doca_pcc *pcc, size_t buffer_size);
655 
672 doca_error_t doca_pcc_set_dev_coredump_file(struct doca_pcc *pcc, const char *file_name);
673 
690 doca_error_t doca_pcc_set_mailbox(struct doca_pcc *pcc, uint32_t max_request_size, uint32_t max_response_size);
691 
706 doca_error_t doca_pcc_mailbox_get_request_buffer(struct doca_pcc *pcc, void **request_buffer);
707 
722 doca_error_t doca_pcc_mailbox_get_response_buffer(struct doca_pcc *pcc, void **response_buffer);
723 
741 doca_error_t doca_pcc_mailbox_send(struct doca_pcc *pcc,
742  uint32_t request_size,
743  uint32_t *response_size,
744  uint32_t *cb_ret_val);
745 
761 doca_error_t doca_pcc_wait(struct doca_pcc *pcc, int wait_time);
762 
766 typedef enum {
772 
787 doca_error_t doca_pcc_get_process_state(const struct doca_pcc *pcc, doca_pcc_process_state_t *process_state);
788 
805 doca_error_t doca_pcc_dump_debug(const struct doca_pcc *pcc);
806 
826 doca_error_t doca_pcc_enable_debug(const struct doca_pcc *pcc, bool enable);
827 
828 #ifdef __cplusplus
829 }
830 #endif
831 
832 #endif /* DOCA_PCC_H_ */
833 
#define DOCA_EXPERIMENTAL
To set a Symbol (or specifically a function) as experimental.
Definition: doca_compat.h:103
#define DOCA_STABLE
To set a Symbol (or specifically a function) as stable API, i.e. it won't be changed.
Definition: doca_compat.h:96
enum doca_error doca_error_t
DOCA API return codes.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_rp_set_ccmad_custom_header_location(struct doca_pcc *pcc, uint32_t probe_format_slot, doca_pcc_ccmad_custom_header_loc_t header_loc)
Set customized header of CCMAD probe packet in RP.
DOCA_STABLE doca_error_t doca_pcc_create(struct doca_dev *doca_dev, struct doca_pcc **pcc)
Create programmable CC Reaction Point context.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_trace_file_get(struct doca_pcc *pcc, char **file_path, uint32_t *file_path_len)
Get trace file path to write trace into.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_cap_is_ccmad_custom_header_supported(const struct doca_devinfo *devinfo)
Get whether the DOCA device supports PCC ccmad customized header in reaction point.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_activate_tracer(struct doca_pcc *pcc)
Enable trace printing.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_set_ifa1_probe_packet_format(struct doca_pcc *pcc, uint32_t probe_format_slot)
Set ifa1 probe packet format for the pcc process.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_dump_debug(const struct doca_pcc *pcc)
Dump device side debug info.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_mailbox_send(struct doca_pcc *pcc, uint32_t request_size, uint32_t *response_size, uint32_t *cb_ret_val)
Send mailbox request data to device.
doca_pcc_ccmad_custom_header_loc_t
CCMAD custom header location.
Definition: doca_pcc.h:350
DOCA_EXPERIMENTAL doca_error_t doca_pcc_mailbox_get_response_buffer(struct doca_pcc *pcc, void **response_buffer)
Get mailbox response data buffer address that contains data transferred from device.
DOCA_STABLE doca_error_t doca_pcc_set_trace_message(struct doca_pcc *pcc, char **trace_message)
Set message for trace printing.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_rp_set_ccmad_remote_sw_handler(struct doca_pcc *pcc, uint32_t probe_format_slot, bool sw_handler)
Set sw remote handler for CCMAD probe type.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_mailbox_get_request_buffer(struct doca_pcc *pcc, void **request_buffer)
Get mailbox request data buffer address to fill and transfer to device.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_set_mailbox(struct doca_pcc *pcc, uint32_t max_request_size, uint32_t max_response_size)
Set mailbox attributes to obtain and pass data from and to the device.
DOCA_STABLE doca_error_t doca_pcc_destroy(struct doca_pcc *pcc)
Destroy a DOCA PCC context.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_set_ccmad_probe_packet_format(struct doca_pcc *pcc, uint32_t probe_format_slot)
Set CCMAD probe packet format for the pcc process.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_set_ifa2_probe_packet_format(struct doca_pcc *pcc, uint32_t probe_format_slot)
Set ifa2 probe packet format for the pcc process.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_rp_set_ifa2_hop_limit(struct doca_pcc *pcc, uint32_t probe_format_slot, uint8_t hop_limit)
Set hop_limit field in the metadata header for IFA2 packets.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_set_ifa1_probe_marker(struct doca_pcc *pcc, uint32_t probe_format_slot, uint64_t probe_marker)
Set probe marker value for IFA1 probe.
DOCA_STABLE doca_error_t doca_pcc_stop(struct doca_pcc *pcc)
Stop a PCC context.
DOCA_STABLE doca_error_t doca_pcc_set_app(struct doca_pcc *pcc, struct doca_pcc_app *app)
Set program app for PCC context.
DOCA_STABLE doca_error_t doca_pcc_wait(struct doca_pcc *pcc, int wait_time)
Wait on events or timeout from device for given time in seconds.
DOCA_STABLE doca_error_t doca_pcc_get_min_num_threads(struct doca_pcc *pcc, uint32_t *min_num_threads)
Get a minimal required number of threads handling CC events.
doca_pcc_process_state_t
Process states.
Definition: doca_pcc.h:766
DOCA_EXPERIMENTAL doca_error_t doca_pcc_np_create(struct doca_dev *doca_dev, struct doca_pcc **pcc)
Create programmable CC Notification Point context.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_trace_file_set(struct doca_pcc *pcc, const char *file_path)
Set trace file path to write trace into.
DOCA_STABLE doca_error_t doca_devinfo_get_is_pcc_supported(const struct doca_devinfo *devinfo)
Get whether the DOCA device supports PCC reaction point.
int(* doca_pcc_trace_callback_t)(void *ctx, struct doca_pcc_bin_report *reps, int reps_size)
Tracer user callback, to be defined by user and called when traces are sent by DPA.
Definition: doca_pcc.h:619
DOCA_STABLE doca_error_t doca_pcc_get_max_num_threads(struct doca_pcc *pcc, uint32_t *max_num_threads)
Get a maximal allowed number of threads handling CC events.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_trace_buf_get(struct doca_pcc *pcc, void **buf_addr, uint32_t *buf_size)
Get trace buffer address to write trace into.
DOCA_STABLE doca_error_t doca_pcc_set_thread_affinity(struct doca_pcc *pcc, uint32_t num_threads, uint32_t *affinity_configs)
Configure affinity of threads handling CC events.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_rp_set_ccmad_custom_header_size(struct doca_pcc *pcc, uint32_t probe_format_slot, uint8_t header_size)
Set customized header of CCMAD probe packet in RP.
DOCA_STABLE doca_error_t doca_pcc_set_print_buffer_size(struct doca_pcc *pcc, size_t buffer_size)
Set buffer size of DPA print message.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_enable_debug(const struct doca_pcc *pcc, bool enable)
Enable or disable device side debug.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_rp_set_ifa2_gns(struct doca_pcc *pcc, uint32_t probe_format_slot, uint8_t gns)
Set GNS value for IFA2 packets.
DOCA_STABLE doca_error_t doca_pcc_start(struct doca_pcc *pcc)
Start a PCC context Register the pcc process in the NIC hw.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_cap_get_num_probe_format_slots(struct doca_pcc *pcc, uint32_t *num_probe_format_slots)
Get number of available probe format slots.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_np_cap_is_supported(const struct doca_devinfo *devinfo)
Get whether the DOCA device supports PCC notification point.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_register_trace_handler(struct doca_pcc *pcc, doca_pcc_trace_callback_t trace_callback, void *user_ctx)
Register a user callback that is triggered when traces arrive from the device.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_trace_buf_set(struct doca_pcc *pcc, void *buf_addr, uint32_t buf_size)
Set trace buffer address to write trace into.
DOCA_STABLE doca_error_t doca_pcc_set_dev_coredump_file(struct doca_pcc *pcc, const char *file_name)
Set output file to write crash data and coredump in case of unrecoverable error on the device.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_deactivate_tracer(struct doca_pcc *pcc)
Disable trace printing.
DOCA_EXPERIMENTAL doca_error_t doca_pcc_np_set_ifa2_gns_ignore(struct doca_pcc *pcc, uint32_t probe_format_slot, uint8_t ignore_mask, uint8_t ignore_value)
Set GNS ignore for IFA2 packets.
DOCA_STABLE doca_error_t doca_pcc_get_process_state(const struct doca_pcc *pcc, doca_pcc_process_state_t *process_state)
Return the state of the process.
@ DOCA_PCC_CCMAD_CUSTOM_HEADER_LOCATION_MAD_PAYLOAD
Definition: doca_pcc.h:351
@ DOCA_PCC_PS_ACTIVE
Definition: doca_pcc.h:767
@ DOCA_PCC_PS_DEACTIVATED
Definition: doca_pcc.h:769
@ DOCA_PCC_PS_ERROR
Definition: doca_pcc.h:770
@ DOCA_PCC_PS_STANDBY
Definition: doca_pcc.h:768
struct upf_accel_ctx * ctx