summaryrefslogtreecommitdiffstats
path: root/src/vnet/dev/format.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-12-07 16:40:02 +0100
committerDamjan Marion <damarion@cisco.com>2023-12-08 16:02:36 +0100
commitd1eb1b7523cc1378f7caef93966420f67a5ddc69 (patch)
tree9c8bd125496cf132fb1fb064cf2fc413848a8a6b /src/vnet/dev/format.c
parent31d4891cfe9451fecce1e26e51153d608c76a4f8 (diff)
dev: caps and rx/tx offload support
Type: improvement Change-Id: I7972f595444eacdb020f3fa2a60331c40766fc0b Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/dev/format.c')
-rw-r--r--src/vnet/dev/format.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/src/vnet/dev/format.c b/src/vnet/dev/format.c
index 944da0698ea..ff301615e10 100644
--- a/src/vnet/dev/format.c
+++ b/src/vnet/dev/format.c
@@ -122,6 +122,12 @@ format_vnet_dev_port_info (u8 *s, va_list *args)
s = format (s, "\n%UMax RX frame size is %u (max supported %u)",
format_white_space, indent, port->max_rx_frame_size,
port->attr.max_supported_rx_frame_size);
+ s = format (s, "\n%UCaps: %U", format_white_space, indent,
+ format_vnet_dev_port_caps, &port->attr.caps);
+ s = format (s, "\n%URX Offloads: %U", format_white_space, indent,
+ format_vnet_dev_port_rx_offloads, &port->attr.rx_offloads);
+ s = format (s, "\n%UTX Offloads: %U", format_white_space, indent,
+ format_vnet_dev_port_tx_offloads, &port->attr.tx_offloads);
if (port->port_ops.format_status)
s = format (s, "\n%UDevice Specific Port Status:\n%U%U",
format_white_space, indent, format_white_space, indent + 2,
@@ -407,3 +413,74 @@ format_vnet_dev_log (u8 *s, va_list *args)
vec_add1 (s, ' ');
return s;
}
+
+u8 *
+format_vnet_dev_port_caps (u8 *s, va_list *args)
+{
+ vnet_dev_port_caps_t *c = va_arg (*args, vnet_dev_port_caps_t *);
+ u32 line = 0;
+
+ if (c->as_number == 0)
+ return s;
+
+#define _(n) \
+ if (c->n) \
+ { \
+ if (line++) \
+ vec_add1 (s, ' '); \
+ for (char *str = #n; *str; str++) \
+ vec_add1 (s, *str == '_' ? '-' : *str); \
+ }
+ foreach_vnet_dev_port_caps;
+#undef _
+
+ return s;
+}
+
+u8 *
+format_vnet_dev_port_rx_offloads (u8 *s, va_list *args)
+{
+ vnet_dev_port_rx_offloads_t *c =
+ va_arg (*args, vnet_dev_port_rx_offloads_t *);
+ u32 line = 0;
+
+ if (c->as_number == 0)
+ return s;
+
+#define _(n) \
+ if (c->n) \
+ { \
+ if (line++) \
+ vec_add1 (s, ' '); \
+ for (char *str = #n; *str; str++) \
+ vec_add1 (s, *str == '_' ? '-' : *str); \
+ }
+ foreach_vnet_dev_port_rx_offloads;
+#undef _
+
+ return s;
+}
+
+u8 *
+format_vnet_dev_port_tx_offloads (u8 *s, va_list *args)
+{
+ vnet_dev_port_tx_offloads_t *c =
+ va_arg (*args, vnet_dev_port_tx_offloads_t *);
+ u32 line = 0;
+
+ if (c->as_number == 0)
+ return s;
+
+#define _(n) \
+ if (c->n) \
+ { \
+ if (line++) \
+ vec_add1 (s, ' '); \
+ for (char *str = #n; *str; str++) \
+ vec_add1 (s, *str == '_' ? '-' : *str); \
+ }
+ foreach_vnet_dev_port_tx_offloads;
+#undef _
+
+ return s;
+}