summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-08 02:04:51 +0000
committerLuis R. Rodriguez <mcgrof@do-not-panic.com>2014-04-08 18:16:22 -0700
commitd6bcb51b5ce48bbe616fcc5e6b9e798b8edcdb44 (patch)
tree6b241dc6e1dd1ae6e9d972bd3b40c431267bbe70
parent3fec3a2ac0b0bbfc1fe7e0debb840ed5859eeb37 (diff)
backports: add GRO_* enums, and its new gro_result_t typedef
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 <herbert@gondor.apana.org.au> Cc: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
-rw-r--r--backport/backport-include/linux/netdevice.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index f99ea02e..f77e3ebd 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)