[ovs-dev] [PATCH] netdev-linux: Fix build with old kernel headers.

Ben Pfaff blp at nicira.com
Tue Mar 24 17:51:56 UTC 2015


Commit 677d9158fc0a (netdev-linux: Support for SFQ, FQ_CoDel and CoDel
qdiscs.) added support for new qdiscs.  The commit uses TCA_CODEL_* and
TCA_FQ_CODEL_* not in old kernel headers, causing a build failure against
such headers.  This commit should fix the problem by defining these values
ourselves.  (I haven't tested it against old headers, so I might have
missed something, but it's a straightforward change and at worst won't do
harm.)

It appears that sfq (also added by the same commit) was in Linux before
2.6.32, so it seems unlikely that we need any compatibility code there.

CC: Jonathan Vestin <jonavest at kau.se>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/netdev-linux.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 8253dfb..5e6f01e 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -2841,6 +2841,14 @@ const struct netdev_class netdev_internal_class =
 
 #define CODEL_N_QUEUES 0x0000
 
+/* In sufficiently new kernel headers these are defined as enums in
+ * <linux/pkt_sched.h>.  Define them here as macros to help out with older
+ * kernels.  (This overrides any enum definition in the header file but that's
+ * harmless.) */
+#define TCA_CODEL_TARGET   1
+#define TCA_CODEL_LIMIT    2
+#define TCA_CODEL_INTERVAL 3
+
 struct codel {
     struct tc tc;
     uint32_t target;
@@ -3052,6 +3060,17 @@ static const struct tc_ops tc_ops_codel = {
 
 #define FQCODEL_N_QUEUES 0x0000
 
+/* In sufficiently new kernel headers these are defined as enums in
+ * <linux/pkt_sched.h>.  Define them here as macros to help out with older
+ * kernels.  (This overrides any enum definition in the header file but that's
+ * harmless.) */
+#define TCA_FQ_CODEL_TARGET     1
+#define TCA_FQ_CODEL_LIMIT      2
+#define TCA_FQ_CODEL_INTERVAL   3
+#define TCA_FQ_CODEL_ECN        4
+#define TCA_FQ_CODEL_FLOWS      5
+#define TCA_FQ_CODEL_QUANTUM    6
+
 struct fqcodel {
     struct tc tc;
     uint32_t target;
-- 
2.1.3




More information about the dev mailing list