summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-09-03 15:41:45 +0200
committerDamjan Marion <dmarion@me.com>2018-09-03 18:41:13 +0000
commit8e71529ea86018ab05c8cb77081512cbd2e413a7 (patch)
tree8f7124d85db7a8eed7847b96e3228b6575bf548b /src/plugins
parentd5c70d556283794b3d63808879c7230b5eebaf95 (diff)
Deprecate old buffer replication scheme
Change-Id: I1f54b994425c58776e1445c8d9fe142e7a644d3d Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/buffer.c35
-rw-r--r--src/plugins/dpdk/device/device.c99
-rw-r--r--src/plugins/dpdk/device/dpdk.h3
-rw-r--r--src/plugins/dpdk/device/init.c3
4 files changed, 3 insertions, 137 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 10646de68a7..edace2aaf61 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -280,30 +280,9 @@ static_always_inline void
recycle_or_free (vlib_main_t * vm, vlib_buffer_main_t * bm, u32 bi,
vlib_buffer_t * b)
{
- vlib_buffer_free_list_t *fl;
u32 thread_index = vlib_get_thread_index ();
- vlib_buffer_free_list_index_t fi;
- fl = vlib_buffer_get_buffer_free_list (vm, b, &fi);
- /* The only current use of this callback: multicast recycle */
- if (PREDICT_FALSE (fl->buffers_added_to_freelist_function != 0))
- {
- int j;
-
- vlib_buffer_add_to_free_list (vm, fl, bi,
- (b->flags & VLIB_BUFFER_RECYCLE) == 0);
-
- for (j = 0; j < vec_len (vm->buffer_announce_list); j++)
- {
- if (fl == vm->buffer_announce_list[j])
- goto already_announced;
- }
- vec_add1 (vm->buffer_announce_list, fl);
- already_announced:
- ;
- }
- else if (PREDICT_TRUE ((b->flags & VLIB_BUFFER_RECYCLE) == 0))
- dpdk_rte_pktmbuf_free (vm, thread_index, b, 1);
+ dpdk_rte_pktmbuf_free (vm, thread_index, b, 1);
}
static_always_inline void
@@ -314,7 +293,7 @@ vlib_buffer_free_inline (vlib_main_t * vm,
vlib_buffer_t *bufp[n_buffers], **b = bufp;
u32 thread_index = vlib_get_thread_index ();
int i = 0;
- u32 simple_mask = (VLIB_BUFFER_NON_DEFAULT_FREELIST | VLIB_BUFFER_RECYCLE |
+ u32 simple_mask = (VLIB_BUFFER_NON_DEFAULT_FREELIST |
VLIB_BUFFER_NEXT_PRESENT);
u32 n_left, *bi;
u32 (*cb) (vlib_main_t * vm, u32 * buffers, u32 n_buffers,
@@ -379,16 +358,6 @@ vlib_buffer_free_inline (vlib_main_t * vm,
b += 1;
n_left -= 1;
}
- if (vec_len (vm->buffer_announce_list))
- {
- vlib_buffer_free_list_t *fl;
- for (i = 0; i < vec_len (vm->buffer_announce_list); i++)
- {
- fl = vm->buffer_announce_list[i];
- fl->buffers_added_to_freelist_function (vm, fl);
- }
- _vec_len (vm->buffer_announce_list) = 0;
- }
}
void
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index b2c87c7930d..c38eec09d81 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -26,8 +26,7 @@
#define foreach_dpdk_tx_func_error \
_(BAD_RETVAL, "DPDK tx function returned an error") \
- _(PKT_DROP, "Tx packet drops (dpdk tx failure)") \
- _(REPL_FAIL, "Tx packet drops (replication failure)")
+ _(PKT_DROP, "Tx packet drops (dpdk tx failure)")
typedef enum
{
@@ -65,48 +64,6 @@ dpdk_set_mac_address (vnet_hw_interface_t * hi, char *address)
}
}
-static struct rte_mbuf *
-dpdk_replicate_packet_mb (vlib_buffer_t * b)
-{
- dpdk_main_t *dm = &dpdk_main;
- struct rte_mbuf **mbufs = 0, *s, *d;
- u8 nb_segs;
- unsigned socket_id = rte_socket_id ();
- int i;
-
- ASSERT (dm->pktmbuf_pools[socket_id]);
- s = rte_mbuf_from_vlib_buffer (b);
- nb_segs = s->nb_segs;
- vec_validate (mbufs, nb_segs - 1);
-
- if (rte_pktmbuf_alloc_bulk (dm->pktmbuf_pools[socket_id], mbufs, nb_segs))
- {
- vec_free (mbufs);
- return 0;
- }
-
- d = mbufs[0];
- d->nb_segs = s->nb_segs;
- d->data_len = s->data_len;
- d->pkt_len = s->pkt_len;
- d->data_off = s->data_off;
- clib_memcpy (d->buf_addr, s->buf_addr, RTE_PKTMBUF_HEADROOM + s->data_len);
-
- for (i = 1; i < nb_segs; i++)
- {
- d->next = mbufs[i];
- d = mbufs[i];
- s = s->next;
- d->data_len = s->data_len;
- clib_memcpy (d->buf_addr, s->buf_addr,
- RTE_PKTMBUF_HEADROOM + s->data_len);
- }
-
- d = mbufs[0];
- vec_free (mbufs);
- return d;
-}
-
static void
dpdk_tx_trace_buffer (dpdk_main_t * dm, vlib_node_runtime_t * node,
dpdk_device_t * xd, u16 queue_id,
@@ -267,29 +224,6 @@ dpdk_prefetch_buffer (vlib_main_t * vm, struct rte_mbuf *mb)
}
static_always_inline void
-dpdk_buffer_recycle (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_buffer_t * b, u32 bi, struct rte_mbuf **mbp)
-{
- dpdk_main_t *dm = &dpdk_main;
- struct rte_mbuf *mb_new;
-
- if (PREDICT_FALSE (b->flags & VLIB_BUFFER_RECYCLE) == 0)
- return;
-
- mb_new = dpdk_replicate_packet_mb (b);
- if (PREDICT_FALSE (mb_new == 0))
- {
- vlib_error_count (vm, node->node_index,
- DPDK_TX_FUNC_ERROR_REPL_FAIL, 1);
- b->flags |= VLIB_BUFFER_REPL_FAIL;
- }
- else
- *mbp = mb_new;
-
- vec_add1 (dm->recycle[vm->thread_index], bi);
-}
-
-static_always_inline void
dpdk_buffer_tx_offload (dpdk_device_t * xd, vlib_buffer_t * b,
struct rte_mbuf *mb)
{
@@ -454,29 +388,6 @@ VNET_DEVICE_CLASS_TX_FN (dpdk_device_class) (vlib_main_t * vm,
n_left--;
}
- /* run inly if we have buffers to recycle */
- if (PREDICT_FALSE (all_or_flags & VLIB_BUFFER_RECYCLE))
- {
- struct rte_mbuf **mb_old;
- from = vlib_frame_vector_args (f);
- n_left = n_packets;
- mb_old = mb = ptd->mbufs;
- while (n_left > 0)
- {
- b[0] = vlib_buffer_from_rte_mbuf (mb[0]);
- dpdk_buffer_recycle (vm, node, b[0], from[0], &mb_old[0]);
-
- /* in case of REPL_FAIL we need to shift data */
- mb[0] = mb_old[0];
-
- if (PREDICT_TRUE ((b[0]->flags & VLIB_BUFFER_REPL_FAIL) == 0))
- mb++;
- mb_old++;
- from++;
- n_left--;
- }
- }
-
/* transmit as many packets as possible */
tx_pkts = n_packets = mb - ptd->mbufs;
n_left = tx_burst_vector_internal (vm, xd, ptd->mbufs, n_packets);
@@ -503,14 +414,6 @@ VNET_DEVICE_CLASS_TX_FN (dpdk_device_class) (vlib_main_t * vm,
}
}
- /* Recycle replicated buffers */
- if (PREDICT_FALSE (vec_len (dm->recycle[thread_index])))
- {
- vlib_buffer_free (vm, dm->recycle[thread_index],
- vec_len (dm->recycle[thread_index]));
- _vec_len (dm->recycle[thread_index]) = 0;
- }
-
return tx_pkts;
}
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index f75cd99e5d3..c5a9f94e458 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -404,9 +404,6 @@ typedef struct
dpdk_device_and_queue_t **devices_by_hqos_cpu;
dpdk_per_thread_data_t *per_thread_data;
- /* per-thread recycle lists */
- u32 **recycle;
-
/* buffer flags template, configurable to enable/disable tcp / udp cksum */
u32 buffer_flags_template;
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 23c12795361..0e9e6d6e9ad 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1790,7 +1790,6 @@ dpdk_init (vlib_main_t * vm)
{
dpdk_main_t *dm = &dpdk_main;
clib_error_t *error = 0;
- vlib_thread_main_t *tm = vlib_get_thread_main ();
/* verify that structs are cacheline aligned */
STATIC_ASSERT (offsetof (dpdk_device_t, cacheline0) == 0,
@@ -1811,8 +1810,6 @@ dpdk_init (vlib_main_t * vm)
dm->conf->num_mbufs = dm->conf->num_mbufs ? dm->conf->num_mbufs : NB_MBUF;
vec_add1 (dm->conf->eal_init_args, (u8 *) "vnet");
- vec_validate (dm->recycle, tm->n_thread_stacks - 1);
-
/* Default vlib_buffer_t flags, DISABLES tcp/udp checksumming... */
dm->buffer_flags_template =
(VLIB_BUFFER_TOTAL_LENGTH_VALID | VLIB_BUFFER_EXT_HDR_VALID