-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ON-16037: added functions to read stats for interfaces #52
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to make static method which does the following.
pthread_mutex_lock(&printf_mutex);
printf(...)
pthread_mutex_unlock(&printf_mutex);
There is too much duplicated code. Please update #50 to do this also.
4b95caa
to
5723af0
Compare
src/lib/zf/zf_stats.c
Outdated
/* SPDX-FileCopyrightText: (c) Advanced Micro Devices, Inc. */ | ||
#include <zf_internal/zf_stack.h> | ||
|
||
/* ensure ef_vi/zf structures are the same size in case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intention is to always mirror the equivalent ef_vi data structures with same fields (and you want them to have their own name), I suggest just typedef'ing original structures to a new name.
However, you could just use the original ef_vi ones. There is a precedent in use of ef_vi_transmit_alt_overhead as part of TCPDirect API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it's used with ef_vi_transmit_alt_overhead that is because the user application will be making an ef_vi call. That's not the case here and I wanted to avoid having a user application pull in vi.h just to get two structure definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree with Paul here. The typedef will achieve the same thing. Perhaps it would be useful to do something like this if you wanted to change the struct field names.
Also, typedef-ing shouldn't mean the user needs to pull any more headers than they already have since zf_stats.c will include vi.h
(if that's what contains ef_vi_stats_layout
)
src/tests/zf_apps/zfsink.c
Outdated
printf("%10d %16d %16"PRIu64, pkt_rate, mbps, now_pkts); | ||
|
||
if( cfg_intf_stats ) | ||
zf_stats_print(stack, 1, stats_data, nic_cnt, zf_stats_layout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confused by passing empty stats data into a function name ..._print(). I would pull call to get the stats here before the print.
5723af0
to
159dd3b
Compare
src/tests/zf_apps/zfsink.c
Outdated
int i; | ||
|
||
/* only display names for the first NIC and assume others are the same */ | ||
if( stats_collection->num_intfs > 1 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coding style doesn't use braces for if condition containing single statement
src/include/zf/zf_stack.h
Outdated
int num_intfs; | ||
/** Array of layouts, one per interface */ | ||
zf_stats_layout** layout; | ||
} zf_stats_collection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think this should have layout in name as doesn't contains stats.
could perhaps just call this zf_stats_layout and name the data structures above zf_nic_stats_...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The zf_stats_field_layout
and zf_stats_layout
relate directly to the ef_vi_...
ones of the same name. I've updated this to zf_layout_collection
, since that is what it's mostly used for.
src/tests/zf_apps/zfsink.c
Outdated
printf("%10d %16d %16"PRIu64, pkt_rate, mbps, now_pkts); | ||
|
||
if( cfg_intf_stats ) { | ||
zf_stats_query(stack, stats_data, stats_collection, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cleaner to move the zf_stats_query outside of the printf lock as it doesn't need it
159dd3b
to
68f5a4d
Compare
src/lib/zf/zf_stats.c
Outdated
/* SPDX-FileCopyrightText: (c) Advanced Micro Devices, Inc. */ | ||
#include <zf_internal/zf_stack.h> | ||
|
||
/* ensure ef_vi/zf structures are the same size in case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I agree with Paul here. The typedef will achieve the same thing. Perhaps it would be useful to do something like this if you wanted to change the struct field names.
Also, typedef-ing shouldn't mean the user needs to pull any more headers than they already have since zf_stats.c will include vi.h
(if that's what contains ef_vi_stats_layout
)
cb554e6
to
3ec4c58
Compare
src/include/zf/zf_stats.h
Outdated
int total_data_size; | ||
/** Array of layouts, one per interface */ | ||
zf_stats_layout** layout; | ||
} zf_layout_collection; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact this doesn't include stats in the name bothers me slightly. Wondering if you could name it zf_vi_stats
(for consistency with onload) or possibly zf_nic_stats
or zf_interface_stats
with appropriate renaming elsewhere (e.g. zf_alloc_vi_stats
)?
3ec4c58
to
aac084b
Compare
aac084b
to
8c7da63
Compare
Added two functions to read the drop stats from the physical interfaces used by TCPDirect. Tested as working with physical interfaces themselves or a bond. The zfsink app was updated to make use of this additional functionality for testing and demo purposes.
The design mimics that of ef_vi itself with the two calls to get the layout and then the actual stats themselves. It could be changed to hold a copy of the layout internally within the stack so passing it back in wouldn't be required but it would add complexity and necessitate code changes in other files beyond the minimal updates to existing files here.
Testing with 'efsend' sending 1000 1-byte packets as a burst that is known to exceed zfsink's ability to avoid drops.