summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Shin <jonshin@cisco.com>2016-08-18 08:16:27 -0700
committerSteve Shin <jonshin@cisco.com>2016-08-30 01:47:57 +0000
commitd7935e8c422e8e464e2a3062dbc7a9b9d34c4723 (patch)
tree24d8357ee44800c2d16aa6b375f94f3283abfdb8
parent94195c85fe91a6773b1b4ab4ac9fa5c7935b4622 (diff)
tuntap_rx modification to handle jumbo packets ( > 2K bytes)
Change-Id: Iebe30b87457741ac268b24c96fa7ea8ad1e101a6 Signed-off-by: Steve Shin <jonshin@cisco.com> (cherry picked from commit 82a7af95e7553747dcebdb865a9c9a67826745d4)
-rw-r--r--vnet/vnet/unix/tuntap.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/vnet/vnet/unix/tuntap.c b/vnet/vnet/unix/tuntap.c
index aefefc36d1a..83e7ec4f590 100644
--- a/vnet/vnet/unix/tuntap.c
+++ b/vnet/vnet/unix/tuntap.c
@@ -232,6 +232,7 @@ tuntap_rx (vlib_main_t * vm,
#else
dpdk_main_t * dm = &dpdk_main;
u32 free_list_index = dm->vlib_buffer_free_list_index;
+ struct rte_mbuf *first_mb = NULL, *prev_mb = NULL;
#endif
/** Make sure we have some RX buffers. */
@@ -288,6 +289,15 @@ tuntap_rx (vlib_main_t * vm,
b = vlib_get_buffer (vm, tm->rx_buffers[i_rx]);
#if DPDK == 1
mb = rte_mbuf_from_vlib_buffer(b);
+
+ if (first_mb == NULL)
+ first_mb = mb;
+
+ if (prev_mb != NULL)
+ {
+ prev_mb->next = mb;
+ first_mb->nb_segs++;
+ }
#endif
b->flags = 0;
b->current_data = 0;
@@ -296,12 +306,13 @@ tuntap_rx (vlib_main_t * vm,
n_bytes_left -= buffer_size;
#if DPDK == 1
rte_pktmbuf_data_len (mb) = b->current_length;
+ mb->data_off = RTE_PKTMBUF_HEADROOM + b->current_data;
#endif
if (n_bytes_left <= 0)
{
#if DPDK == 1
- rte_pktmbuf_pkt_len (mb) = n_bytes_in_packet;
+ rte_pktmbuf_pkt_len (first_mb) = n_bytes_in_packet;
#endif
break;
}
@@ -310,9 +321,7 @@ tuntap_rx (vlib_main_t * vm,
b->flags |= VLIB_BUFFER_NEXT_PRESENT;
b->next_buffer = tm->rx_buffers[i_rx];
#if DPDK == 1
- ASSERT(0);
- // ((struct rte_pktmbuf *)(b->mb))->next =
- // vlib_get_buffer (vm, tm->rx_buffers[i_rx])->mb;
+ prev_mb = mb;
#endif
}