diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2011-12-21 19:38:06 +0000 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2011-12-21 19:42:58 +0000 |
commit | 612acd067d70d88937e48bfcac7eec7b1ee12ea4 (patch) | |
tree | eae905eb1a0ba73f51ae0adf3e27b3a7bc9fa61c /sfc.c | |
parent | e1ee596326ae84091056ba7b390b810f607fa412 (diff) | |
download | ethtool-612acd067d70d88937e48bfcac7eec7b1ee12ea4.tar.gz |
sfc: Omit zero values in register tables
Some register tables on Solarflare controllers are very large and may
have only a few rows in use. Make register dumps more readable by
omitting rows where all bits read as zero.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'sfc.c')
-rw-r--r-- | sfc.c | 29 |
1 files changed, 20 insertions, 9 deletions
@@ -3777,6 +3777,15 @@ print_simple_table(unsigned revision, const struct efx_nic_reg_table *table, return buf; } +static int buf_is_zero(const u8 *buf, size_t size) +{ + size_t i; + for (i = 0; i < size; i++) + if (buf[i]) + return 0; + return 1; +} + static const void * print_complex_table(unsigned revision, const struct efx_nic_reg_table *table, const void *buf) @@ -3808,16 +3817,18 @@ print_complex_table(unsigned revision, const struct efx_nic_reg_table *table, fputc('\n', stdout); for (j = 0; j < table->rows; j++) { - printf("%4zu", j); - for (i = 0; i < table->field_count; i++) { - field = &table->fields[i]; - if (!(revision >= field->min_revision && - revision <= field->max_revision)) - continue; - printf(" %*s", (int)column_padding(field), ""); - print_field_value(field, buf); + if (!buf_is_zero(buf, size)) { + printf("%4zu", j); + for (i = 0; i < table->field_count; i++) { + field = &table->fields[i]; + if (!(revision >= field->min_revision && + revision <= field->max_revision)) + continue; + printf(" %*s", (int)column_padding(field), ""); + print_field_value(field, buf); + } + fputc('\n', stdout); } - fputc('\n', stdout); buf = (const u8 *)buf + size; } |