net/mlx5: fix build with old kernels
authorMoti Haimovsky <motih@mellanox.com>
Sun, 15 Jul 2018 17:31:39 +0000 (20:31 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 26 Jul 2018 12:05:52 +0000 (14:05 +0200)
This commit fixes compilation errors due to missing definitions
found when compiling mlx5 PMD from DPDK 17.11-LTS on Ubuntu 12.4
with kernel 3.15.

Fixes: 75ef62a94301 ("net/mlx5: fix link speed capability information")
Fixes: 5bfc9fc112dd ("net/mlx5: use static assert for compile-time sanity checks")
Cc: stable@dpdk.org
Signed-off-by: Moti Haimovsky <motih@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
drivers/net/mlx5/Makefile
drivers/net/mlx5/mlx5_defs.h
drivers/net/mlx5/mlx5_ethdev.c

index 81e3528..75bee46 100644 (file)
@@ -339,6 +339,51 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
                linux/tc_act/tc_vlan.h \
                enum TCA_VLAN_PUSH_VLAN_PRIORITY \
                $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_40000baseKR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_40000baseKR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_40000baseCR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_40000baseCR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_40000baseSR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_40000baseSR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_40000baseLR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_40000baseLR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_56000baseKR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_56000baseKR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_56000baseCR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_56000baseCR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_56000baseSR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_56000baseSR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_SUPPORTED_56000baseLR4_Full \
+               /usr/include/linux/ethtool.h \
+               define SUPPORTED_56000baseLR4_Full \
+               $(AUTOCONF_OUTPUT)
+       $Q sh -- '$<' '$@' \
+               HAVE_STATIC_ASSERT \
+               /usr/include/assert.h \
+               define static_assert \
+               $(AUTOCONF_OUTPUT)
 
 # Create mlx5_autoconf.h or update it in case it differs from the new one.
 
index f6ec415..439cc15 100644 (file)
 /* Cache size of mempool for Multi-Packet RQ. */
 #define MLX5_MPRQ_MP_CACHE_SZ 32
 
+/* Definition of static_assert found in /usr/include/assert.h */
+#ifndef HAVE_STATIC_ASSERT
+#define static_assert _Static_assert
+#endif
+
 #endif /* RTE_PMD_MLX5_DEFS_H_ */
index b8f9136..9cf2dc5 100644 (file)
 #include "mlx5_rxtx.h"
 #include "mlx5_utils.h"
 
+/* Supported speed values found in /usr/include/linux/ethtool.h */
+#ifndef HAVE_SUPPORTED_40000baseKR4_Full
+#define SUPPORTED_40000baseKR4_Full (1 << 23)
+#endif
+#ifndef HAVE_SUPPORTED_40000baseCR4_Full
+#define SUPPORTED_40000baseCR4_Full (1 << 24)
+#endif
+#ifndef HAVE_SUPPORTED_40000baseSR4_Full
+#define SUPPORTED_40000baseSR4_Full (1 << 25)
+#endif
+#ifndef HAVE_SUPPORTED_40000baseLR4_Full
+#define SUPPORTED_40000baseLR4_Full (1 << 26)
+#endif
+#ifndef HAVE_SUPPORTED_56000baseKR4_Full
+#define SUPPORTED_56000baseKR4_Full (1 << 27)
+#endif
+#ifndef HAVE_SUPPORTED_56000baseCR4_Full
+#define SUPPORTED_56000baseCR4_Full (1 << 28)
+#endif
+#ifndef HAVE_SUPPORTED_56000baseSR4_Full
+#define SUPPORTED_56000baseSR4_Full (1 << 29)
+#endif
+#ifndef HAVE_SUPPORTED_56000baseLR4_Full
+#define SUPPORTED_56000baseLR4_Full (1 << 30)
+#endif
+
 /* Add defines in case the running kernel is not the same as user headers. */
 #ifndef ETHTOOL_GLINKSETTINGS
 struct ethtool_link_settings {