From: Gilad Ben-Yossef <[email protected]>

PACKET_FANOUT and friends is only defined post kernel 3.1,
meaning a build against older kernel header fails.

By providing a backwards compatible define for older kernels
we allow the build to work, if run time attempts of using
the missing functionality on older kernels to degrade to
a run-time EINVAL error in init time if the specific feature
is used.

Signed-off-by: Gilad Ben-Yossef <[email protected]>
---
 platform/linux-generic/include/odp_packet_socket.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_socket.h 
b/platform/linux-generic/include/odp_packet_socket.h
index f991806..f38f5b0 100644
--- a/platform/linux-generic/include/odp_packet_socket.h
+++ b/platform/linux-generic/include/odp_packet_socket.h
@@ -29,6 +29,16 @@
 /** Max transmit (Tx) burst size*/
 #define ODP_PACKET_SOCKET_MAX_BURST_TX 32
 
+/*
+ * This makes sure that building for kernels older than 3.1 works
+ * and a fanout requests fails (for invalid packet socket option)
+ * in runtime if requested
+ */
+#ifndef PACKET_FANOUT
+#define PACKET_FANOUT          18
+#define PACKET_FANOUT_HASH     0
+#endif /* PACKET_FANOUT */
+
 typedef struct {
        int sockfd; /**< socket descriptor */
        odp_buffer_pool_t pool; /**< buffer pool to alloc packets from */
-- 
1.7.1


_______________________________________________
lng-odp mailing list
[email protected]
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to