|
|
a6040a |
From bb12b6e32bafdba8836000d8515e5864f65f75be Mon Sep 17 00:00:00 2001
|
|
|
a6040a |
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
|
|
|
a6040a |
Date: Thu, 1 Feb 2018 14:30:57 +0100
|
|
|
a6040a |
Subject: [PATCH 5/9] net/mlx: add debug checks to glue structure
|
|
|
a6040a |
|
|
|
a6040a |
This code should catch mistakes early if a glue structure member is added
|
|
|
a6040a |
without a corresponding implementation in the library.
|
|
|
a6040a |
|
|
|
a6040a |
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
|
|
|
a6040a |
(cherry picked from commit 1b176cec4973a410eaeff00f33c6d49b795aa867)
|
|
|
a6040a |
---
|
|
|
a6040a |
drivers/net/mlx4/mlx4.c | 9 +++++++++
|
|
|
a6040a |
drivers/net/mlx5/mlx5.c | 9 +++++++++
|
|
|
a6040a |
2 files changed, 18 insertions(+)
|
|
|
a6040a |
|
|
|
a6040a |
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
|
|
|
a6040a |
index d12b00c..43d1b0a 100644
|
|
|
a6040a |
--- a/drivers/net/mlx4/mlx4.c
|
|
|
a6040a |
+++ b/drivers/net/mlx4/mlx4.c
|
|
|
a6040a |
@@ -764,6 +764,15 @@ struct mlx4_conf {
|
|
|
a6040a |
return;
|
|
|
a6040a |
assert(mlx4_glue);
|
|
|
a6040a |
#endif
|
|
|
a6040a |
+#ifndef NDEBUG
|
|
|
a6040a |
+ /* Glue structure must not contain any NULL pointers. */
|
|
|
a6040a |
+ {
|
|
|
a6040a |
+ unsigned int i;
|
|
|
a6040a |
+
|
|
|
a6040a |
+ for (i = 0; i != sizeof(*mlx4_glue) / sizeof(void *); ++i)
|
|
|
a6040a |
+ assert(((const void *const *)mlx4_glue)[i]);
|
|
|
a6040a |
+ }
|
|
|
a6040a |
+#endif
|
|
|
a6040a |
mlx4_glue->fork_init();
|
|
|
a6040a |
rte_pci_register(&mlx4_driver);
|
|
|
a6040a |
}
|
|
|
a6040a |
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
|
|
|
a6040a |
index 71ebdce..6a3746d 100644
|
|
|
a6040a |
--- a/drivers/net/mlx5/mlx5.c
|
|
|
a6040a |
+++ b/drivers/net/mlx5/mlx5.c
|
|
|
a6040a |
@@ -1090,6 +1090,15 @@ struct mlx5_args {
|
|
|
a6040a |
return;
|
|
|
a6040a |
assert(mlx5_glue);
|
|
|
a6040a |
#endif
|
|
|
a6040a |
+#ifndef NDEBUG
|
|
|
a6040a |
+ /* Glue structure must not contain any NULL pointers. */
|
|
|
a6040a |
+ {
|
|
|
a6040a |
+ unsigned int i;
|
|
|
a6040a |
+
|
|
|
a6040a |
+ for (i = 0; i != sizeof(*mlx5_glue) / sizeof(void *); ++i)
|
|
|
a6040a |
+ assert(((const void *const *)mlx5_glue)[i]);
|
|
|
a6040a |
+ }
|
|
|
a6040a |
+#endif
|
|
|
a6040a |
mlx5_glue->fork_init();
|
|
|
a6040a |
rte_pci_register(&mlx5_driver);
|
|
|
a6040a |
}
|
|
|
a6040a |
--
|
|
|
a6040a |
1.8.3.1
|
|
|
a6040a |
|