aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/odp/device.c
diff options
context:
space:
mode:
authorMichal Mazur <mkm@semihalf.com>2017-09-19 20:18:41 +0200
committerMichal Mazur <mkm@semihalf.com>2017-12-14 15:18:05 +0100
commit7e1f3998634c89aa6344468d26df0de519578a5f (patch)
treefaa92641c1f2c5e4c330d522bfa08e4ffa6d2e91 /src/plugins/odp/device.c
parent0c552959dc425c5f00499d6a587d16275a6399db (diff)
Add support for multiple Rx and Tx queues
1) Incoming packets can be spread across multiple worker threads based on IP and TCP/UDP headers. 2) Multiple output queues are used in Burst mode if supported by hardware (checked in interface capabilities) 3) Synchronization of output traffic can be disabled due to multiple Tx queues - one for each thread. Change-Id: Ib5ee18103c860eae3b56ffc453a5953c729bb521 Signed-off-by: Michal Mazur <mkm@semihalf.com>
Diffstat (limited to 'src/plugins/odp/device.c')
-rwxr-xr-xsrc/plugins/odp/device.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/plugins/odp/device.c b/src/plugins/odp/device.c
index 3e111061..68397dbb 100755
--- a/src/plugins/odp/device.c
+++ b/src/plugins/odp/device.c
@@ -77,11 +77,12 @@ odp_packet_interface_tx (vlib_main_t * vm,
u32 n_left = frame->n_vectors;
vnet_interface_output_runtime_t *rd = (void *) node->runtime_data;
odp_packet_if_t *oif = pool_elt_at_index (om->interfaces, rd->dev_instance);
- odp_pktout_queue_t pktout;
+ uword queue_index = vlib_get_thread_index () % oif->tx_queues;
+ u32 mode = oif->mode;
odp_packet_t pkt_tbl[VLIB_FRAME_SIZE];
- u32 sent, count = 0;
+ odp_event_t evt_tbl[VLIB_FRAME_SIZE];
vlib_buffer_t *b0;
- u32 bi;
+ u32 bi, sent, count = 0;
if (PREDICT_FALSE (oif->lockp != 0))
{
@@ -89,11 +90,6 @@ odp_packet_interface_tx (vlib_main_t * vm,
;
}
- if (odp_pktout_queue (oif->pktio, &pktout, 1) != 1)
- {
- return -1;
- }
-
while (n_left > 0)
{
odp_packet_t pkt;
@@ -121,6 +117,8 @@ odp_packet_interface_tx (vlib_main_t * vm,
else if (diff < 0)
odp_packet_pull_tail (pkt, -diff);
pkt_tbl[count] = pkt;
+ if (mode == APPL_MODE_PKT_QUEUE)
+ evt_tbl[count] = odp_packet_to_event (pkt_tbl[count]);
count++;
bi = b0->next_buffer;
}
@@ -133,7 +131,22 @@ odp_packet_interface_tx (vlib_main_t * vm,
sent = 0;
while (count > 0)
{
- ret = odp_pktout_send (pktout, &pkt_tbl[sent], count);
+ switch (mode)
+ {
+ case APPL_MODE_PKT_SCHED:
+ case APPL_MODE_PKT_BURST:
+ ret =
+ odp_pktout_send (oif->outq[queue_index], &pkt_tbl[sent],
+ count);
+ break;
+ case APPL_MODE_PKT_QUEUE:
+ ret = odp_queue_enq_multi (oif->txq[queue_index],
+ &evt_tbl[sent], count);
+ break;
+ default:
+ ret = 0;
+ clib_error ("Invalid mode\n");
+ }
if (odp_unlikely (ret <= 0))
{
/* Drop one packet and try again */