This backports commit d1c76af9e added by Herbert which added the first
enums and then commit 5b252f0c2 added by Ben which gave the enums a
label and then pegged a typedef onto these. This backports these commits
in a forward compatible way upkeeping the introduction and then the
typedef. In order to make this work we use make backported code use
enums with the BACKPORT_prefix but upkeep the same values, this lets
us declare the typedef and peg it to a similar set.

Cc: Herbert Xu <[email protected]>
Cc: Ben Hutchings <[email protected]>
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
 backport/backport-include/linux/netdevice.h | 40 +++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/backport/backport-include/linux/netdevice.h 
b/backport/backport-include/linux/netdevice.h
index f99ea02..f77e3eb 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -20,6 +20,46 @@ struct inet6_dev;
  */
 #include <linux/hardirq.h>
 
+/* d1c76af9e */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
+enum { /* backport: provide the enum name already */
+       GRO_MERGED,
+       GRO_MERGED_FREE,
+       GRO_HELD,
+       GRO_NORMAL,
+       GRO_DROP,
+};
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+
+/*
+ * We can count on the enum definitions being present so
+ * but since we cannot dedeclare the enum but we have to
+ * peg the typedef to a similar enum we can just use the
+ * same values and then use the #defines below to modify
+ * code for older kernels to use the new enum we define
+ * here. This works even for switch statements and gcc -Wall.
+ * This backports 5b252f0c2
+ */
+enum gro_result {
+       BACKPORT_GRO_MERGED             = GRO_MERGED,
+       BACKPORT_GRO_MERGED_FREE        = GRO_MERGED_FREE,
+       BACKPORT_GRO_HELD               = GRO_HELD,
+       BACKPORT_GRO_NORMAL             = GRO_NORMAL,
+       BACKPORT_GRO_DROP               = GRO_DROP,
+};
+
+#define GRO_MERGED     BACKPORT_GRO_MERGED
+#define GRO_MERGED_FREE        BACKPORT_GRO_MERGED_FREE
+#define GRO_HELD       BACKPORT_GRO_HELD
+#define GRO_NORMAL     BACKPORT_GRO_NORMAL
+#define GRO_DROP       BACKPORT_GRO_DROP
+
+typedef enum gro_result gro_result_t;
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0) */
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
 #define dev_change_net_namespace(a, b, c) (-EOPNOTSUPP)
 
-- 
1.8.5.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to