diff mbox

[1/2] odp_packet_socket: define PACKET_FANOUT if needed

Message ID 1408877638-18082-2-git-send-email-giladb@ezchip.com
State Accepted
Commit c597a6036f3ae7b2d015332b76c4b03ad9dcd0d4
Headers show

Commit Message

Gilad Ben-Yossef Aug. 24, 2014, 10:53 a.m. UTC
From: Gilad Ben-Yossef <gilad@benyossef.com>

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 <giladb@ezchip.com>
---
 platform/linux-generic/include/odp_packet_socket.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
diff mbox

Patch

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 */