aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-05-24 15:34:32 +0200
committerOle Trøan <otroan@employees.org>2019-05-29 09:06:43 +0000
commit86387c37e452792ad35d7d46d2823fa393a7ca96 (patch)
tree09ff55e031152a879fe7834ef001900874f23cbd /src/plugins
parente4218be67141311e8999059d7f848af4c2c311df (diff)
dpdk: make sure each segment have initalized rte_mbuf
Change-Id: I0e28d059143fb7489d27a10c5b4a152d0d7dfb1f Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/device/device.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 6285d93ac96..e4a92f0f0e2 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -94,23 +94,13 @@ dpdk_validate_rte_mbuf (vlib_main_t * vm, vlib_buffer_t * b,
int maybe_multiseg)
{
struct rte_mbuf *mb, *first_mb, *last_mb;
+ last_mb = first_mb = mb = rte_mbuf_from_vlib_buffer (b);
/* buffer is coming from non-dpdk source so we need to init
rte_mbuf header */
if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_EXT_HDR_VALID) == 0))
- {
- vlib_buffer_t *b2 = b;
- last_mb = mb = rte_mbuf_from_vlib_buffer (b2);
- rte_pktmbuf_reset (mb);
- while (maybe_multiseg && (b2->flags & VLIB_BUFFER_NEXT_PRESENT))
- {
- b2 = vlib_get_buffer (vm, b2->next_buffer);
- mb = rte_mbuf_from_vlib_buffer (b2);
- rte_pktmbuf_reset (mb);
- }
- }
+ rte_pktmbuf_reset (mb);
- last_mb = first_mb = mb = rte_mbuf_from_vlib_buffer (b);
first_mb->nb_segs = 1;
mb->data_len = b->current_length;
mb->pkt_len = maybe_multiseg ? vlib_buffer_length_in_chain (vm, b) :
@@ -121,6 +111,8 @@ dpdk_validate_rte_mbuf (vlib_main_t * vm, vlib_buffer_t * b,
{
b = vlib_get_buffer (vm, b->next_buffer);
mb = rte_mbuf_from_vlib_buffer (b);
+ if (PREDICT_FALSE ((b->flags & VLIB_BUFFER_EXT_HDR_VALID) == 0))
+ rte_pktmbuf_reset (mb);
last_mb->next = mb;
last_mb = mb;
mb->data_len = b->current_length;