event/octeontx: support event Rx adapter

Add Rx adapter queue add and delete API for both generic eth_devices as
well as HW backed eth_octeontx which supports direct event injection to
event device.
The HW injected event needs to be converted into mbuf, previously this
was done in eth_octeontx during rx_burst now it is moved to
event_octeontx as events from Rx adapter are dequeued directly from
event device.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
This commit is contained in:
Pavan Nikhilesh 2017-10-24 18:30:36 +05:30 committed by Jerin Jacob
parent d0d6549860
commit 45a914c5bd
2 changed files with 131 additions and 0 deletions

View File

@ -149,3 +149,8 @@ Burst mode support
Burst mode is not supported. Dequeue and Enqueue functions accepts only single Burst mode is not supported. Dequeue and Enqueue functions accepts only single
event at a time. event at a time.
Rx adapter support
~~~~~~~~~~~~~~~~~~
When eth_octeontx is used as Rx adapter event schedule type
``RTE_SCHED_TYPE_PARALLEL`` is not supported.

View File

@ -36,6 +36,8 @@
#include <rte_debug.h> #include <rte_debug.h>
#include <rte_dev.h> #include <rte_dev.h>
#include <rte_eal.h> #include <rte_eal.h>
#include <rte_ethdev.h>
#include <rte_event_eth_rx_adapter.h>
#include <rte_lcore.h> #include <rte_lcore.h>
#include <rte_log.h> #include <rte_log.h>
#include <rte_malloc.h> #include <rte_malloc.h>
@ -395,6 +397,123 @@ ssows_dump(struct ssows *ws, FILE *f)
fprintf(f, "\tpwqp=0x%"PRIx64"\n", val); fprintf(f, "\tpwqp=0x%"PRIx64"\n", val);
} }
static int
ssovf_eth_rx_adapter_caps_get(const struct rte_eventdev *dev,
const struct rte_eth_dev *eth_dev, uint32_t *caps)
{
int ret;
RTE_SET_USED(dev);
ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
if (ret)
*caps = RTE_EVENT_ETH_RX_ADAPTER_SW_CAP;
else
*caps = RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT;
return 0;
}
static int
ssovf_eth_rx_adapter_queue_add(const struct rte_eventdev *dev,
const struct rte_eth_dev *eth_dev, int32_t rx_queue_id,
const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
{
int ret = 0;
const struct octeontx_nic *nic = eth_dev->data->dev_private;
pki_mod_qos_t pki_qos;
RTE_SET_USED(dev);
ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
if (ret)
return -EINVAL;
if (rx_queue_id >= 0)
return -EINVAL;
if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
return -ENOTSUP;
memset(&pki_qos, 0, sizeof(pki_mod_qos_t));
pki_qos.port_type = 0;
pki_qos.index = 0;
pki_qos.mmask.f_tag_type = 1;
pki_qos.mmask.f_port_add = 1;
pki_qos.mmask.f_grp_ok = 1;
pki_qos.mmask.f_grp_bad = 1;
pki_qos.mmask.f_grptag_ok = 1;
pki_qos.mmask.f_grptag_bad = 1;
pki_qos.tag_type = queue_conf->ev.sched_type;
pki_qos.qos_entry.port_add = 0;
pki_qos.qos_entry.ggrp_ok = queue_conf->ev.queue_id;
pki_qos.qos_entry.ggrp_bad = queue_conf->ev.queue_id;
pki_qos.qos_entry.grptag_bad = 0;
pki_qos.qos_entry.grptag_ok = 0;
ret = octeontx_pki_port_modify_qos(nic->port_id, &pki_qos);
if (ret < 0)
ssovf_log_err("failed to modify QOS, port=%d, q=%d",
nic->port_id, queue_conf->ev.queue_id);
return ret;
}
static int
ssovf_eth_rx_adapter_queue_del(const struct rte_eventdev *dev,
const struct rte_eth_dev *eth_dev, int32_t rx_queue_id)
{
int ret = 0;
const struct octeontx_nic *nic = eth_dev->data->dev_private;
pki_del_qos_t pki_qos;
RTE_SET_USED(dev);
RTE_SET_USED(rx_queue_id);
ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
if (ret)
return -EINVAL;
pki_qos.port_type = 0;
pki_qos.index = 0;
memset(&pki_qos, 0, sizeof(pki_del_qos_t));
ret = octeontx_pki_port_delete_qos(nic->port_id, &pki_qos);
if (ret < 0)
ssovf_log_err("Failed to delete QOS port=%d, q=%d",
nic->port_id, queue_conf->ev.queue_id);
return ret;
}
static int
ssovf_eth_rx_adapter_start(const struct rte_eventdev *dev,
const struct rte_eth_dev *eth_dev)
{
int ret;
const struct octeontx_nic *nic = eth_dev->data->dev_private;
RTE_SET_USED(dev);
ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
if (ret)
return 0;
octeontx_pki_port_start(nic->port_id);
return 0;
}
static int
ssovf_eth_rx_adapter_stop(const struct rte_eventdev *dev,
const struct rte_eth_dev *eth_dev)
{
int ret;
const struct octeontx_nic *nic = eth_dev->data->dev_private;
RTE_SET_USED(dev);
ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
if (ret)
return 0;
octeontx_pki_port_stop(nic->port_id);
return 0;
}
static void static void
ssovf_dump(struct rte_eventdev *dev, FILE *f) ssovf_dump(struct rte_eventdev *dev, FILE *f)
{ {
@ -488,6 +607,13 @@ static const struct rte_eventdev_ops ssovf_ops = {
.port_link = ssovf_port_link, .port_link = ssovf_port_link,
.port_unlink = ssovf_port_unlink, .port_unlink = ssovf_port_unlink,
.timeout_ticks = ssovf_timeout_ticks, .timeout_ticks = ssovf_timeout_ticks,
.eth_rx_adapter_caps_get = ssovf_eth_rx_adapter_caps_get,
.eth_rx_adapter_queue_add = ssovf_eth_rx_adapter_queue_add,
.eth_rx_adapter_queue_del = ssovf_eth_rx_adapter_queue_del,
.eth_rx_adapter_start = ssovf_eth_rx_adapter_start,
.eth_rx_adapter_stop = ssovf_eth_rx_adapter_stop,
.dump = ssovf_dump, .dump = ssovf_dump,
.dev_start = ssovf_start, .dev_start = ssovf_start,
.dev_stop = ssovf_stop, .dev_stop = ssovf_stop,