diff options
author | Damjan Marion <damarion@cisco.com> | 2021-03-29 18:22:22 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2021-03-31 15:10:12 +0000 |
commit | 6b88aa287133797cb66f73374bbfade7637dab55 (patch) | |
tree | 96175f304f97cacd7132e9a2234259773a197734 /src/plugins/avf/format.c | |
parent | 7b9b19d7bb6d72bf56ab8f1e0c2f35b15f79b983 (diff) |
avf: improve capabilities handling
Type: improvement
Change-Id: If35b40168414807e928cb3026633ae9d2fa703ed
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/avf/format.c')
-rw-r--r-- | src/plugins/avf/format.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/plugins/avf/format.c b/src/plugins/avf/format.c index 9bdf4a5e428..5dbfae2b378 100644 --- a/src/plugins/avf/format.c +++ b/src/plugins/avf/format.c @@ -57,14 +57,26 @@ u8 * format_avf_vf_cap_flags (u8 * s, va_list * args) { u32 flags = va_arg (*args, u32); - u8 *t = 0; + int not_first = 0; -#define _(a, b, c) if (flags & (1 << a)) \ - t = format (t, "%s%s", t ? " ":"", c); - foreach_avf_vf_cap_flag; + char *strs[32] = { +#define _(a, b, c) [a] = c, + foreach_avf_vf_cap_flag #undef _ - s = format (s, "%v", t); - vec_free (t); + }; + + for (int i = 0; i < 32; i++) + { + if ((flags & (1 << i)) == 0) + continue; + if (not_first) + s = format (s, " "); + if (strs[i]) + s = format (s, "%s", strs[i]); + else + s = format (s, "unknown(%u)", i); + not_first = 1; + } return s; } @@ -100,8 +112,8 @@ format_avf_device (u8 * s, va_list * args) AVF_QUEUE_SZ_MIN, AVF_QUEUE_SZ_MAX); s = format (s, "\n%Uflags: %U", format_white_space, indent, format_avf_device_flags, ad); - s = format (s, "\n%Uoffload features: %U", format_white_space, indent, - format_avf_vf_cap_flags, ad->feature_bitmap); + s = format (s, "\n%Ucapability flags: %U", format_white_space, indent, + format_avf_vf_cap_flags, ad->cap_flags); s = format (s, "\n%Unum-queue-pairs %d max-vectors %u max-mtu %u " "rss-key-size %u rss-lut-size %u", format_white_space, indent, |