diff mbox

[1/2] linux-generic: mmap: jumbo frames support

Message ID 1424440666-30218-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Feb. 20, 2015, 1:57 p.m. UTC
Support for jumbo frames for linux-generic with unsegmented buffers.
Test for pkio is also adjusted to work with 9*1024=9216 bytes packets.
https://bugs.linaro.org/show_bug.cgi?id=509

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 platform/linux-generic/odp_packet_socket.c |  2 +-
 test/validation/odp_pktio.c                | 10 +++++++---
 test/validation/odp_pktio_run              |  4 ++--
 3 files changed, 10 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c
index 41e57c1..3f971c9 100644
--- a/platform/linux-generic/odp_packet_socket.c
+++ b/platform/linux-generic/odp_packet_socket.c
@@ -586,7 +586,7 @@  static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring,
 static void mmap_fill_ring(struct ring *ring, unsigned blocks)
 {
 	ring->req.tp_block_size = getpagesize() << 2;
-	ring->req.tp_frame_size = TPACKET_ALIGNMENT << 7;
+	ring->req.tp_frame_size = 9216 + TPACKET_HDRLEN;
 	ring->req.tp_block_nr = blocks;
 
 	ring->req.tp_frame_nr = ring->req.tp_block_size /
diff --git a/test/validation/odp_pktio.c b/test/validation/odp_pktio.c
index 3f9de3c..21cc598 100644
--- a/test/validation/odp_pktio.c
+++ b/test/validation/odp_pktio.c
@@ -14,7 +14,7 @@ 
 #include <stdlib.h>
 
 #define PKT_BUF_NUM            32
-#define PKT_BUF_SIZE           1856
+#define PKT_BUF_SIZE           9216
 #define MAX_NUM_IFACES         2
 #define TEST_SEQ_INVALID       ((uint32_t)~0)
 #define TEST_SEQ_MAGIC         0x92749451
@@ -34,9 +34,11 @@  typedef struct {
 } pktio_info_t;
 
 /** structure of test packet UDP payload */
-typedef struct {
+typedef struct  __attribute__((__packed__)) {
 	uint32be_t magic;
 	uint32be_t seq;
+	char data[9162]; /* total size of eth packet 9216 */
+	uint32be_t magic2;
 } pkt_test_data_t;
 
 /** default packet pool */
@@ -66,6 +68,7 @@  static int pktio_pkt_set_seq(odp_packet_t pkt)
 	pkt_test_data_t data;
 
 	data.magic = TEST_SEQ_MAGIC;
+	data.magic2 = TEST_SEQ_MAGIC;
 	data.seq   = tstseq;
 
 	l4_off = odp_packet_l4_offset(pkt);
@@ -92,7 +95,8 @@  static uint32_t pktio_pkt_seq(odp_packet_t pkt)
 		odp_packet_copydata_out(pkt, l4_off+ODPH_UDPHDR_LEN,
 					sizeof(data), &data);
 
-		if (data.magic == TEST_SEQ_MAGIC)
+		if (data.magic == TEST_SEQ_MAGIC &&
+		    data.magic2 == TEST_SEQ_MAGIC)
 			return data.seq;
 	}
 
diff --git a/test/validation/odp_pktio_run b/test/validation/odp_pktio_run
index 08288e6..b9d7e3c 100755
--- a/test/validation/odp_pktio_run
+++ b/test/validation/odp_pktio_run
@@ -56,8 +56,8 @@  setup_env1()
 		echo "pktio: error: unable to create veth pair"
 		exit $TEST_SKIPPED
 	fi
-	ip link set $IF0 up
-	ip link set $IF1 up
+	ip link set $IF0 mtu 9216 up
+	ip link set $IF1 mtu 9216 up
 
 	# network needs a little time to come up
 	sleep 1