Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e82edf1

Browse files
ON-17061: Move efct_ubufs_stats to ef_vi_stats and add additional stats
1 parent a0bf4c6 commit e82edf1

File tree

2 files changed

+62
-39
lines changed

2 files changed

+62
-39
lines changed

‎src/include/etherfabric/ef_vi.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,20 @@ typedef struct {
980980
uint32_t rx_ev_bad_q_label;
981981
/** Gaps in the event queue (empty slot followed by event) */
982982
uint32_t evq_gap;
983+
984+
// EF10CT-specific stats per RXQ
985+
struct {
986+
uint64_t buffers_freed;
987+
uint64_t post_fifo_full;
988+
uint64_t free_list_empty;
989+
uint64_t sw_fifo_empty;
990+
uint64_t hw_fifo_empty;
991+
uint64_t sentinel_wait;
992+
uint64_t acquire_failures;
993+
uint64_t release_count;
994+
uint64_t torn_down_out_of_order;
995+
uint64_t corrupt_rxq_state;
996+
} ef10ct_stats[EF_VI_MAX_EFCT_RXQS];
983997
} ef_vi_stats;
984998

985999
/*! \brief The type of NIC in use

‎src/lib/ciul/efct_ubufs.c‎

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,17 @@
1212
#include <etherfabric/internal/shrub_socket.h>
1313
#include <etherfabric/internal/shrub_client.h>
1414

15-
struct efct_ubufs_rxq_stats {
16-
uint64_t buffers_freed; /* Total buffers freed by the application */
17-
uint64_t post_fifo_full; /* Times we couldn't post due to fifo limit */
18-
uint64_t free_list_empty; /* Times free list was empty */
19-
uint64_t sw_fifo_empty; /* Times SW FIFO was empty on next() */
20-
uint64_t hw_fifo_empty; /* Times HW FIFO was empty */
21-
uint64_t sentinel_wait; /* Times we waited for sentinel update */
22-
uint64_t acquire_failures; /* Failed buffer acquisitions (shared mode) */
23-
uint64_t release_count; /* Buffer releases (shared mode) */
24-
};
15+
#define EF10CT_STATS_INC(vi, ix, counter) \
16+
do { \
17+
if ((vi)->vi_stats) \
18+
(vi)->vi_stats->ef10ct_stats[ix].counter++; \
19+
} while(0)
2520

2621
struct efct_ubufs_rxq
2722
{
2823
struct ef_shrub_client shrub_client;
2924
efch_resource_id_t rxq_id, memreg_id;
3025
volatile uint64_t *rx_post_buffer_reg;
31-
struct efct_ubufs_rxq_stats stats;
3226
};
3327

3428
struct efct_ubufs
@@ -40,7 +34,6 @@ struct efct_ubufs
4034
int shrub_server_socket_id;
4135
ef_driver_handle pd_dh;
4236
bool is_shrub_token_set;
43-
4437
struct efct_ubufs_rxq q[EF_VI_MAX_EFCT_RXQS];
4538
};
4639

@@ -62,11 +55,12 @@ static bool rxq_is_local(const ef_vi* vi, int ix)
6255
static void update_filled(ef_vi* vi, int ix)
6356
{
6457
ef_vi_efct_rxq_state* state = &vi->ep_state->rxq.efct_state[ix];
65-
struct efct_ubufs_rxq* rxq = &get_ubufs(vi)->q[ix];
6658
bool sentinel_wait = false;
59+
bool corrupt_queue_found = false;
6760

6861
if( !(vi->ep_state->rxq.efct_active_qs & (1 << ix)) ||
6962
state->fifo_tail_hw == -1 ) {
63+
EF10CT_STATS_INC(vi, ix, torn_down_out_of_order);
7064
return;
7165
}
7266

@@ -89,8 +83,10 @@ static void update_filled(ef_vi* vi, int ix)
8983
* reused before advancing the hardware tail beyond it.)
9084
*/
9185
EF_VI_ASSERT(vi->efct_rxqs.meta_offset == 0);
92-
if( state->fifo_tail_hw == -1 )
86+
if( state->fifo_tail_hw == -1 ) {
87+
corrupt_queue_found = true;
9388
break;
89+
}
9490

9591
desc = efct_rx_desc_for_sb(vi, ix, state->fifo_tail_hw);
9692
buffer = efct_superbuf_access(vi, ix, state->fifo_tail_hw);
@@ -105,8 +101,12 @@ static void update_filled(ef_vi* vi, int ix)
105101
state->fifo_count_hw--;
106102
}
107103

108-
rxq->stats.sentinel_wait += (sentinel_wait ? 1 : 0);
109-
rxq->stats.hw_fifo_empty += (state->fifo_count_hw == 0 ? 1 : 0);
104+
if ( corrupt_queue_found )
105+
EF10CT_STATS_INC(vi, ix, corrupt_rxq_state);
106+
if ( sentinel_wait )
107+
EF10CT_STATS_INC(vi, ix, sentinel_wait);
108+
if ( state->fifo_count_hw == 0 )
109+
EF10CT_STATS_INC(vi, ix, hw_fifo_empty);
110110
}
111111

112112
static void poison_superbuf(char *sbuf)
@@ -128,7 +128,6 @@ static void post_buffers(ef_vi* vi, int ix)
128128
{
129129
ef_vi_efct_rxq_state* state = &vi->ep_state->rxq.efct_state[ix];
130130
unsigned limit = get_ubufs(vi)->nic_fifo_limit;
131-
struct efct_ubufs_rxq* rxq = &get_ubufs(vi)->q[ix];
132131
bool free_list_was_empty = ( state->free_head == -1 );
133132
bool fifo_was_full = ( state->fifo_count_hw >= limit );
134133

@@ -160,8 +159,9 @@ static void post_buffers(ef_vi* vi, int ix)
160159
}
161160

162161
if ( free_list_was_empty )
163-
rxq->stats.free_list_empty++;
164-
rxq->stats.post_fifo_full += (fifo_was_full ? 1 : 0);
162+
EF10CT_STATS_INC(vi, ix, free_list_empty);
163+
if ( fifo_was_full )
164+
EF10CT_STATS_INC(vi, ix, post_fifo_full);
165165
}
166166

167167
static int efct_ubufs_next_shared(ef_vi* vi, int ix, bool* sentinel, unsigned* sbseq)
@@ -172,7 +172,7 @@ static int efct_ubufs_next_shared(ef_vi* vi, int ix, bool* sentinel, unsigned* s
172172
ef_shrub_buffer_id id;
173173
int rc = ef_shrub_client_acquire_buffer(&rxq->shrub_client, &id, sentinel);
174174
if ( rc < 0 ) {
175-
rxq->stats.acquire_failures++;
175+
EF10CT_STATS_INC(vi, ix, acquire_failures);
176176
return rc;
177177
}
178178
*sbseq = state->sbseq++;
@@ -183,14 +183,13 @@ static int efct_ubufs_next_local(ef_vi* vi, int ix, bool* sentinel, unsigned* sb
183183
{
184184
ef_vi_efct_rxq_state* state = &vi->ep_state->rxq.efct_state[ix];
185185
struct efct_rx_descriptor* desc;
186-
struct efct_ubufs_rxq* rxq = &get_ubufs(vi)->q[ix];
187186
int id;
188187

189188
update_filled(vi, ix);
190189
post_buffers(vi, ix);
191190

192191
if( state->fifo_count_sw == 0 ) {
193-
rxq->stats.sw_fifo_empty++;
192+
EF10CT_STATS_INC(vi, ix, sw_fifo_empty);
194193
return -EAGAIN;
195194
}
196195

@@ -224,17 +223,17 @@ static void efct_ubufs_free_shared(ef_vi* vi, int ix, int sbid)
224223
{
225224
struct efct_ubufs_rxq* rxq = &get_ubufs(vi)->q[ix];
226225
ef_shrub_client_release_buffer(&rxq->shrub_client, sbid);
227-
rxq->stats.release_count++;
226+
EF10CT_STATS_INC(vi, ix, release_count);
228227
}
229228

230229
static void efct_ubufs_free(ef_vi* vi, int ix, int sbid)
231230
{
232-
struct efct_ubufs_rxq* rxq = &get_ubufs(vi)->q[ix];
233231
if( rxq_is_local(vi, ix) )
234232
efct_ubufs_free_local(vi, ix, sbid);
235233
else
236234
efct_ubufs_free_shared(vi, ix, sbid);
237-
rxq->stats.buffers_freed++;
235+
236+
EF10CT_STATS_INC(vi, ix, buffers_freed);
238237
}
239238

240239
static bool efct_ubufs_local_available(const ef_vi* vi, int ix)
@@ -485,23 +484,30 @@ static void efct_ubufs_dump_stats(ef_vi* vi, ef_vi_dump_log_fn_t logger,
485484
const struct ef_shrub_client_state* client_state = ef_shrub_client_get_state(client);
486485
const ef_vi_efct_rxq* efct_rxq = &vi->efct_rxqs.q[ix];
487486
const ef_vi_efct_rxq_state *efct_state = efct_get_rxq_state(vi, ix);
488-
const struct efct_ubufs_rxq_stats* stats = &ubufs->q[ix].stats;
489487

490488
if( *efct_rxq->live.superbuf_pkts != 0 ) {
491489
logger(log_arg, " rxq[%d]: hw=%d cfg=%u pkts=%u", ix,
492490
efct_state->qid, efct_rxq->config_generation,
493491
*efct_rxq->live.superbuf_pkts);
494492

495-
logger(log_arg, " rxq[%d]: buffers freed=%" CI_PRIu64,
496-
ix, stats->buffers_freed);
497-
498-
logger(log_arg, " rxq[%d]: sw_fifo_empty=%" CI_PRIu64
499-
" hw_fifo_empty=%" CI_PRIu64 " free_list_empty=%" CI_PRIu64, ix,
500-
stats->sw_fifo_empty, stats->hw_fifo_empty, stats->free_list_empty);
501-
502-
logger(log_arg, " rxq[%d]: sentinel_wait=%" CI_PRIu64
503-
" post_fifo_full=%" CI_PRIu64, ix,
504-
stats->sentinel_wait, stats->post_fifo_full);
493+
if ( vi->vi_stats != NULL ) {
494+
logger(log_arg, " rxq[%d]: buffers freed=%" CI_PRIu64
495+
" torn_down_out_of_order=%" CI_PRIu64 " corrupt_rxq_state=%" CI_PRIu64,
496+
ix, vi->vi_stats->ef10ct_stats[ix].buffers_freed,
497+
vi->vi_stats->ef10ct_stats[ix].torn_down_out_of_order,
498+
vi->vi_stats->ef10ct_stats[ix].corrupt_rxq_state);
499+
500+
logger(log_arg, " rxq[%d]: sw_fifo_empty=%" CI_PRIu64
501+
" hw_fifo_empty=%" CI_PRIu64 " free_list_empty=%" CI_PRIu64, ix,
502+
vi->vi_stats->ef10ct_stats[ix].sw_fifo_empty,
503+
vi->vi_stats->ef10ct_stats[ix].hw_fifo_empty,
504+
vi->vi_stats->ef10ct_stats[ix].free_list_empty);
505+
506+
logger(log_arg, " rxq[%d]: sentinel_wait=%" CI_PRIu64
507+
" post_fifo_full=%" CI_PRIu64, ix,
508+
vi->vi_stats->ef10ct_stats[ix].sentinel_wait,
509+
vi->vi_stats->ef10ct_stats[ix].post_fifo_full);
510+
}
505511

506512
if( client_state ) {
507513
logger(log_arg, " rxq[%d]: server_fifo_size=%" CI_PRIu64
@@ -512,9 +518,12 @@ static void efct_ubufs_dump_stats(ef_vi* vi, ef_vi_dump_log_fn_t logger,
512518
" client_fifo_idx=%" CI_PRIu64, ix,
513519
client_state->metrics.client_fifo_size,
514520
client_state->client_fifo_index);
515-
logger(log_arg, " rxq[%d]: acquire_failures=%" CI_PRIu64
516-
" release_count=%" CI_PRIu64, ix,
517-
stats->acquire_failures, stats->release_count);
521+
if ( vi->vi_stats != NULL ) {
522+
logger(log_arg, " rxq[%d]: acquire_failures=%" CI_PRIu64
523+
" release_count=%" CI_PRIu64, ix,
524+
vi->vi_stats->ef10ct_stats[ix].acquire_failures,
525+
vi->vi_stats->ef10ct_stats[ix].release_count);
526+
}
518527
} else {
519528
logger(log_arg, " rxq[%d]: fifo_count_hw=%" CI_PRIu16
520529
" fifo_count_sw=%" CI_PRIu16, ix, efct_state->fifo_count_hw,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /