Skip to content

Commit b5a31c2

Browse files
committed
Add pfring_zc_get_num_rx_channels API. Print number of device queue in zcount and zbalance_ipc proc
1 parent 9785589 commit b5a31c2

File tree

8 files changed

+25
-3
lines changed

8 files changed

+25
-3
lines changed

userland/examples_zc/zbalance_ipc.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pfring_zc_cluster *zc;
7272
struct {
7373
u_int32_t num_devices;
7474
u_int32_t num_real_devices;
75+
u_int32_t num_rss_queues; /* Total number of RSS queues for all devides */
7576
u_int32_t num_in_queues;
7677
int bind_worker_core;
7778
char *device_list;
@@ -281,6 +282,7 @@ void print_stats() {
281282
char time_buf[128];
282283
double duration;
283284
int i, b, in_use;
285+
u_int32_t tot_num_rss_queues = 0;
284286

285287
if (start_time.tv_sec == 0)
286288
gettimeofday(&start_time, NULL);
@@ -291,10 +293,13 @@ void print_stats() {
291293

292294
duration = delta_time(&end_time, &start_time);
293295

294-
for (b = 0; b < num_balancers; b++)
295-
for (i = 0; i < balancer[b].num_devices; i++)
296+
for (b = 0; b < num_balancers; b++) {
297+
for (i = 0; i < balancer[b].num_devices; i++) {
296298
if (pfring_zc_stats(balancer[b].inzqs[i], &stats) == 0)
297299
tot_recv += stats.recv, tot_drop += stats.drop;
300+
tot_num_rss_queues += balancer[b].num_rss_queues;
301+
}
302+
}
298303

299304
if (!daemon_mode && !proc_stats_only) {
300305
trace(TRACE_INFO, "=========================");
@@ -345,9 +350,12 @@ void print_stats() {
345350

346351
snprintf(stats_buf, sizeof(stats_buf),
347352
"ClusterId: %d\n"
353+
"TotIFQueues: %d/%d\n"
348354
"TotQueues: %d\n"
349355
"Applications: %d\n",
350356
cluster_id,
357+
num_balancers,
358+
tot_num_rss_queues,
351359
num_consumer_queues,
352360
num_apps);
353361

@@ -1430,6 +1438,8 @@ int main(int argc, char* argv[]) {
14301438
return -1;
14311439
}
14321440

1441+
balancer[b].num_rss_queues += pfring_zc_get_num_rx_channels(balancer[b].inzqs[i]);
1442+
14331443
} else { /* create sw queue as ingress device */
14341444
pfring_zc_queue *ext_q = NULL;
14351445
pfring_zc_buffer_pool *ext_pool = NULL;

userland/examples_zc/zcount.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ int main(int argc, char* argv[]) {
392392
goto cleanup;
393393
}
394394

395+
printf("# Device RX channels: %d\n", pfring_zc_get_num_rx_channels(zq));
396+
395397
if (check_license || print_maintenance) {
396398
if (strncmp(device, "zc:", 3) == 0) {
397399
u_int32_t maintenance;
242 Bytes
Binary file not shown.
56 Bytes
Binary file not shown.
274 Bytes
Binary file not shown.
242 Bytes
Binary file not shown.
274 Bytes
Binary file not shown.

userland/lib/pfring_zc.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ pfring_zc_get_queue_settings(
626626
);
627627

628628
/**
629-
* Read queue speed.
629+
* Read queue speed (in case of device queue).
630630
* @param queue The queue handle.
631631
* @return The queue speed in Mbit/s, 0 if unknown.
632632
*/
@@ -635,6 +635,16 @@ pfring_zc_get_queue_speed(
635635
pfring_zc_queue *queue
636636
);
637637

638+
/**
639+
* Read total number of RSS queues (in case of device).
640+
* @param queue The queue handle.
641+
* @return The number of RSS queues for the bound device.
642+
*/
643+
u_int32_t
644+
pfring_zc_get_num_rx_channels(
645+
pfring_zc_queue *queue
646+
);
647+
638648
/**
639649
* Read the queue stats.
640650
* @param queue The queue handle.

0 commit comments

Comments
 (0)