NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
doca_pcc_dev_event.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 
21 #ifndef DOCA_PCC_DEV_EVENT_H_
22 #define DOCA_PCC_DEV_EVENT_H_
23 
24 #include <doca_pcc_dev.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 // ======================================== Event access functions ========================================
31 // ========================================================================================================
32 
42 {
43  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_attr));
44 
46 }
47 
57 {
58  return __builtin_bswap32(event->flow_tag);
59 }
60 
70 {
71  return __builtin_bswap32(event->sn);
72 }
73 
83 {
84  return __builtin_bswap32(event->timestamp);
85 }
86 
95 {
96 #if __NV_DPA == __NV_DPA_BF3
97  return 0;
98 #elif __NV_DPA >= __NV_DPA_CX8
99  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_dword2));
100 
101  return ((doca_pcc_dev_event_general_dword2_t *)(&value))->ttl_hoplimit;
102 #endif
103 }
104 
113 {
114 #if __NV_DPA == __NV_DPA_BF3
115  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.roce_tx.extra));
116 
117  return ((doca_pcc_dev_roce_tx_extra_t *)(&value))->flow_qpn;
118 #elif __NV_DPA >= __NV_DPA_CX8
119  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_dword2));
120 
121  return ((doca_pcc_dev_event_general_dword2_t *)(&value))->flow_qpn;
122 #endif
123 }
124 
135 {
136  return __builtin_bswap32(event->ev_spec_attr.fw_data.data[n]);
137 }
138 
148 {
149  return __builtin_bswap32(event->ev_spec_attr.ack_nack_cnp.first_timestamp);
150 }
151 
161 {
162  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.roce_tx.cntrs));
163 
164  return *(doca_pcc_dev_roce_tx_cntrs_t *)(&value);
165 }
166 
176 {
177  return __builtin_bswap32(event->ev_spec_attr.ack_nack_cnp.first_sn);
178 }
179 
189 {
190  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.ack_nack_cnp.extra));
191 
193 }
194 
204 {
205 #if __NV_DPA == __NV_DPA_BF3
206  return __builtin_bswap32(event->ev_spec_attr.rtt_tstamp.req_send_timestamp);
207 #elif __NV_DPA >= __NV_DPA_CX8
208  return __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.rtt_tstamp.data0));
209 #endif
210 }
211 
221 {
222 #if __NV_DPA == __NV_DPA_BF3
223  return __builtin_bswap32(event->ev_spec_attr.rtt_tstamp.req_recv_timestamp);
224 #elif __NV_DPA >= __NV_DPA_CX8
225  return __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.rtt_tstamp.data1));
226 #endif
227 }
228 
238 {
239 #if __NV_DPA == __NV_DPA_BF3
240  return __builtin_bswap32(event->ev_spec_attr.rtt_tstamp.resp_send_timestamp);
241 #elif __NV_DPA >= __NV_DPA_CX8
242  return __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.rtt_tstamp.data2));
243 #endif
244 }
245 
261 {
262  return event->ev_spec_attr.reserved_at_0;
263 }
264 
270 {
271  (void)(event);
272  return 12;
273 }
274 
285 {
286 #if __NV_DPA == __NV_DPA_BF3
287  return 0;
288 #elif __NV_DPA >= __NV_DPA_CX8
289  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.rtt_tstamp.data3));
290 
291  return ((doca_pcc_dev_rtt_spec_data3_t *)(&value))->np_rx_port_counter;
292 #endif
293 }
294 
303 {
304 #if __NV_DPA == __NV_DPA_BF3
305  return 0;
306 #elif __NV_DPA >= __NV_DPA_CX8
307  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.rtt_tstamp.data3));
308 
309  return ((doca_pcc_dev_rtt_spec_data3_t *)(&value))->version;
310 #endif
311 }
312 
321 {
322 #if __NV_DPA == __NV_DPA_BF3
323  return 0;
324 #elif __NV_DPA >= __NV_DPA_CX8
325  uint32_t value = __builtin_bswap32(*(uint32_t *)(&event->ev_spec_attr.rtt_tstamp.data1));
326 
327  return ((doca_pcc_dev_rtt_spec_data1_t *)(&value))->port_type;
328 #endif
329 }
330 
331 #ifdef __cplusplus
332 }
333 #endif
334 
337 #endif /* DOCA_PCC_DEV_EVENT_H_ */
#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
#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
#define FORCE_INLINE
static inline wrapper
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_roce_ack_first_sn(doca_pcc_dev_event_t *event)
For ACK/NACK/CNP events, first coalesced event serial number.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_rtt_req_recv_timestamp(doca_pcc_dev_event_t *event)
For RTT events only, the time when RTT request is received.
DOCA_EXPERIMENTAL FORCE_INLINE size_t doca_pcc_dev_get_rtt_raw_data_size(doca_pcc_dev_event_t *event)
Returns the user defined event data size in bytes.
DOCA_STABLE FORCE_INLINE doca_pcc_dev_roce_tx_cntrs_t doca_pcc_dev_get_roce_tx_cntrs(doca_pcc_dev_event_t *event)
For TX events only, counters including byte count and packet count.
FORCE_INLINE uint32_t doca_pcc_dev_get_rtt_resp_port_type(__attribute__((unused)) doca_pcc_dev_event_t *event)
For rtt event, port type: 0 - 25G, 1 - 40G, 2 - 50G, 3 - 100G, 4 - 200G, 5 - 400G,...
FORCE_INLINE uint32_t doca_pcc_dev_get_rtt_np_rx_byte_counter(__attribute__((unused)) doca_pcc_dev_event_t *event)
For rtt event, np port rx byte counter in units of 256 bytes.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_sn(doca_pcc_dev_event_t *event)
For all events, serial number of this event.
FORCE_INLINE uint32_t doca_pcc_dev_get_flow_qpn(doca_pcc_dev_event_t *event)
For all events, return flow qpn (CX8+ all events, BF3 tx event only)
DOCA_EXPERIMENTAL FORCE_INLINE unsigned char * doca_pcc_dev_get_rtt_raw_data(doca_pcc_dev_event_t *event)
Returns the user defined event data.
DOCA_STABLE FORCE_INLINE doca_pcc_dev_ack_nack_cnp_extra_t doca_pcc_dev_get_ack_nack_cnp_extra(doca_pcc_dev_event_t *event)
For ACK/NACK/CNP events, extra information including number of coalesced events.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_roce_first_timestamp(doca_pcc_dev_event_t *event)
For TX/ACK/NACK/CNP events, first coalesced event timestamp.
FORCE_INLINE uint32_t doca_pcc_dev_get_ttl_hoplimit(__attribute__((unused)) doca_pcc_dev_event_t *event)
For all events, TTL (for IPv4) or HopLimit (for IPv6) header’s field in received packet.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_rtt_req_send_timestamp(doca_pcc_dev_event_t *event)
For RTT events only, the time when RTT request is sent.
DOCA_STABLE FORCE_INLINE doca_pcc_dev_event_general_attr_t doca_pcc_dev_get_ev_attr(doca_pcc_dev_event_t *event)
For all events, return structure with general information such as event type, subtype,...
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_rtt_resp_send_timestamp(doca_pcc_dev_event_t *event)
For RTT events only, the time when RTT response is sent.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_timestamp(doca_pcc_dev_event_t *event)
For all events, timestamp of this event.
FORCE_INLINE uint32_t doca_pcc_dev_get_rtt_resp_version(__attribute__((unused)) doca_pcc_dev_event_t *event)
For rtt event, rtt version.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_flowtag(doca_pcc_dev_event_t *event)
For all events, flow tag to indicate different flows.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_fw_settings(doca_pcc_dev_event_t *event, int n)
For FW events only, three DWORDs of FW data.
type value
struct mlnx_cc_ack_nack_cnp_extra_t extra
struct mlnx_cc_event_general_dword2_t ev_dword2
struct mlnx_cc_event_general_attr_t ev_attr
union mlnx_cc_event_spec_attr_t ev_spec_attr
struct mlnx_cc_roce_tx_cntrs_t cntrs
struct mlnx_cc_roce_tx_extra_t extra
struct mlnx_cc_rtt_spec_data0_t data0
struct mlnx_cc_rtt_spec_data1_t data1
struct mlnx_cc_rtt_spec_data2_t data2
struct mlnx_cc_ack_nack_cnp_t ack_nack_cnp