30 #define TELEMETRY_DB_LOG_MAX_DEVICES (10)
32 #define TELEMETRY_DB_LOG_MAX_PORTS_PER_DEVICE (5)
34 #define TELEMETRY_DB_LOG_SIZE (TELEMETRY_DB_LOG_MAX_DEVICES + TELEMETRY_DB_LOG_MAX_PORTS_PER_DEVICE)
36 #define TELEMETRY_DB_MASK ((1UL << TELEMETRY_DB_LOG_SIZE) - 1UL)
38 #define TELEMETRY_DB_SIZE (1UL << TELEMETRY_DB_LOG_SIZE)
40 #define DB_ENTRY_AGING_TIME (5000000)
43 #define INVALID_MD_TIME_INTERVAL (2000000000)
138 uint16_t idx = (((uint16_t)device_id) & 0x3FFu) | ((((uint16_t)port) & 0x1Fu) << 10);
150 return ((uint32_t)(__builtin_bswap16(md->
tx_ts_nano_hi))) << 16 |
163 return __builtin_bswap32(((uint32_t)md->
tx_bytes_lo));
175 if (((__builtin_bswap32((md->
rx_ts_sec_hi))) >> 16) == 0x8000u) {
177 return ((__builtin_bswap32(md->
rx_ts_sec_hi)) & 0xFFFFu) << 16 |
199 uint8_t first_packet = 0;
209 if (db_entry->
valid == 0) {
232 response_pkt->
valid = 0;
237 if (new_bytes_ts.
bytes != old_bytes_ts.
bytes) {
252 response_pkt->
tx_ts = __builtin_bswap32(response_pkt->
tx_ts);
254 response_pkt->
pt = md->
pt & 3;
255 response_pkt->
valid = !first_packet;
273 response_pkt->
index = (num_mds - 1);
284 uint32_t request_size,
285 uint32_t max_response_size,
287 uint32_t *response_size)
289 if (request_size !=
sizeof(uint32_t))
298 (void)(max_response_size);
300 (void)(response_size);
#define __DPA_MEMORY
DPA 'Memory' memory space.
#define __dpa_thread_fence(MEMORY_SPACE, PRED_OP, SUCC_OP)
#define __DPA_W
Write memory operation.
doca_pcc_dev_error_t
API functions return status.
@ DOCA_PCC_DEV_STATUS_FAIL
DOCA_EXPERIMENTAL ALWAYS_INLINE uint8_t * doca_pcc_np_dev_get_l4_header(const struct doca_pcc_np_dev_request_packet *input)
Returns a pointer to the L4/udp header of the packet.
doca_pcc_dev_error_t doca_pcc_dev_np_user_packet_handler(struct doca_pcc_np_dev_request_packet *in, struct doca_pcc_np_dev_response_packet *out)
Main user function (implemented by the user) Called by the lib upon receiving a packet....
doca_pcc_dev_error_t doca_pcc_dev_user_mailbox_handle(void *request, uint32_t request_size, uint32_t max_response_size, void *response, uint32_t *response_size)
User callback to process a request from host to device.
DOCA_STABLE void doca_pcc_dev_printf(const char *format,...) __attribute__((format(printf
Print to Host.
DOCA_STABLE FORCE_INLINE uint32_t doca_pcc_dev_get_timer_lo(void)
Core timer access (elapsed time in uSec) function 32 bits.
#define DB_ENTRY_AGING_TIME
#define INVALID_MD_TIME_INTERVAL
static uint32_t telemetry_get_tx_bytes(struct switch_md *md)
#define TELEMETRY_DB_MASK
static uint16_t telemetry_db_hash(uint32_t device_id, uint16_t port)
static int telemetry_process_md(struct switch_md *md, struct int_response *response_pkt)
struct ifa2_md_hdr __attribute__
static uint32_t telemetry_get_q_len(struct switch_md *md)
static uint32_t telemetry_get_tx_ts_nano(struct switch_md *md)
struct telemetry_db_entry_t telemetry_db[TELEMETRY_DB_SIZE]
static uint8_t get_md_num_from_md_hdr(struct ifa2_md_hdr *md_hdr)
#define TELEMETRY_DB_SIZE
ALWAYS_INLINE uint32_t diff_with_wrap32(uint32_t greater_num, uint32_t smaller_num)
structure for response packet
uint16_t eg_queue_cell_cnt