aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-04-17 19:26:31 +0200
committerDamjan Marion <dmarion.lists@gmail.com>2018-04-17 20:13:17 +0000
commit89b16e66a4f3df9c3851702a3d186947ed377f82 (patch)
tree73e3b45857b7f6da187427e00c7730351f4e0ba7 /src/plugins
parent669d07dc016757b856e1014a415996cf9f0ebc58 (diff)
dpdk: print device flags in the 'show hardware' output
Change-Id: I0d10f13a56420b119fdfad97dcc135b245c269e1 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/device/dpdk.h31
-rw-r--r--src/plugins/dpdk/device/format.c17
2 files changed, 37 insertions, 11 deletions
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index 1f43a484224..d52e96634e2 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -152,6 +152,26 @@ typedef struct
u32 flush_count;
} dpdk_device_hqos_per_hqos_thread_t;
+#define foreach_dpdk_device_flags \
+ _( 0, ADMIN_UP, "admin-up") \
+ _( 1, PROMISC, "promisc") \
+ _( 2, PMD, "pmd") \
+ _( 3, PMD_INIT_FAIL, "pmd-init-fail") \
+ _( 4, MAYBE_MULTISEG, "maybe-multiseg") \
+ _( 5, HAVE_SUBIF, "subif") \
+ _( 6, HQOS, "hqos") \
+ _( 7, BOND_SLAVE, "bond-slave") \
+ _( 8, BOND_SLAVE_UP, "bond-slave-up") \
+ _( 9, TX_OFFLOAD, "tx-offload") \
+ _(10, INTEL_PHDR_CKSUM, "intel-phdr-cksum") \
+
+enum
+{
+#define _(a, b, c) DPDK_DEVICE_FLAG_##b = (1 << a),
+ foreach_dpdk_device_flags
+#undef _
+};
+
typedef struct
{
CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
@@ -174,17 +194,6 @@ typedef struct
i8 cpu_socket;
u16 flags;
-#define DPDK_DEVICE_FLAG_ADMIN_UP (1 << 0)
-#define DPDK_DEVICE_FLAG_PROMISC (1 << 1)
-#define DPDK_DEVICE_FLAG_PMD (1 << 2)
-#define DPDK_DEVICE_FLAG_PMD_INIT_FAIL (1 << 3)
-#define DPDK_DEVICE_FLAG_MAYBE_MULTISEG (1 << 4)
-#define DPDK_DEVICE_FLAG_HAVE_SUBIF (1 << 5)
-#define DPDK_DEVICE_FLAG_HQOS (1 << 6)
-#define DPDK_DEVICE_FLAG_BOND_SLAVE (1 << 7)
-#define DPDK_DEVICE_FLAG_BOND_SLAVE_UP (1 << 8)
-#define DPDK_DEVICE_FLAG_TX_OFFLOAD (1 << 9)
-#define DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM (1 << 10)
u16 nb_tx_desc;
CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 36f921d598b..d37cc8c0664 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -255,6 +255,21 @@ format_dpdk_device_name (u8 * s, va_list * args)
return ret;
}
+u8 *
+format_dpdk_device_flags (u8 * s, va_list * args)
+{
+ dpdk_device_t *xd = va_arg (*args, dpdk_device_t *);
+ u8 *t = 0;
+
+#define _(a, b, c) if (xd->flags & (1 << a)) \
+t = format (t, "%s%s", t ? " ":"", c);
+ foreach_dpdk_device_flags
+#undef _
+ s = format (s, "%v", t);
+ vec_free (t);
+ return s;
+}
+
static u8 *
format_dpdk_device_type (u8 * s, va_list * args)
{
@@ -463,6 +478,8 @@ format_dpdk_device (u8 * s, va_list * args)
s = format (s, "%U\n%Ucarrier %U",
format_dpdk_device_type, xd->device_index,
format_white_space, indent + 2, format_dpdk_link_status, xd);
+ s = format (s, "%Uflags: %U\n",
+ format_white_space, indent + 2, format_dpdk_device_flags, xd);
rte_eth_dev_info_get (xd->device_index, &di);