+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)
+{
+ const struct octeontx_nic *nic = eth_dev->data->dev_private;
+ struct ssovf_evdev *edev = ssovf_pmd_priv(dev);
+ uint16_t free_idx = UINT16_MAX;
+ struct octeontx_rxq *rxq;
+ pki_mod_qos_t pki_qos;
+ uint8_t found = false;
+ int i, ret = 0;
+ void *old_ptr;
+
+ ret = strncmp(eth_dev->data->name, "eth_octeontx", 12);
+ if (ret)
+ return -EINVAL;
+
+ if (queue_conf->ev.sched_type == RTE_SCHED_TYPE_PARALLEL)
+ return -ENOTSUP;
+
+ /* eth_octeontx only supports one rq. */
+ rx_queue_id = rx_queue_id == -1 ? 0 : rx_queue_id;
+ rxq = eth_dev->data->rx_queues[rx_queue_id];
+ /* Add rxq pool to list of used pools and reduce available events. */
+ for (i = 0; i < edev->rxq_pools; i++) {
+ if (edev->rxq_pool_array[i] == (uintptr_t)rxq->pool) {
+ edev->rxq_pool_rcnt[i]++;
+ found = true;
+ break;
+ } else if (free_idx == UINT16_MAX &&
+ edev->rxq_pool_array[i] == 0) {
+ free_idx = i;
+ }
+ }
+
+ if (!found) {
+ uint16_t idx;
+
+ if (edev->available_events < rxq->pool->size) {
+ ssovf_log_err(
+ "Max available events %"PRIu32" requested events in rxq pool %"PRIu32"",
+ edev->available_events, rxq->pool->size);
+ return -ENOMEM;
+ }
+
+ if (free_idx != UINT16_MAX) {
+ idx = free_idx;
+ } else {
+ old_ptr = edev->rxq_pool_array;
+ edev->rxq_pools++;
+ edev->rxq_pool_array = rte_realloc(
+ edev->rxq_pool_array,
+ sizeof(uint64_t) * edev->rxq_pools, 0);
+ if (edev->rxq_pool_array == NULL) {
+ edev->rxq_pools--;
+ edev->rxq_pool_array = old_ptr;
+ return -ENOMEM;
+ }
+
+ old_ptr = edev->rxq_pool_rcnt;
+ edev->rxq_pool_rcnt = rte_realloc(
+ edev->rxq_pool_rcnt,
+ sizeof(uint8_t) * edev->rxq_pools, 0);
+ if (edev->rxq_pool_rcnt == NULL) {
+ edev->rxq_pools--;
+ edev->rxq_pool_rcnt = old_ptr;
+ return -ENOMEM;
+ }
+ idx = edev->rxq_pools - 1;
+ }
+
+ edev->rxq_pool_array[idx] = (uintptr_t)rxq->pool;
+ edev->rxq_pool_rcnt[idx] = 1;
+ edev->available_events -= rxq->pool->size;
+ }
+
+ 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.qos_entry.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);
+
+ edev->rx_offload_flags = nic->rx_offload_flags;
+ edev->tx_offload_flags = nic->tx_offload_flags;
+ 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)
+{
+ const struct octeontx_nic *nic = eth_dev->data->dev_private;
+ struct ssovf_evdev *edev = ssovf_pmd_priv(dev);
+ struct octeontx_rxq *rxq;
+ pki_del_qos_t pki_qos;
+ uint8_t found = false;
+ int i, ret = 0;
+
+ rx_queue_id = rx_queue_id == -1 ? 0 : rx_queue_id;
+ rxq = eth_dev->data->rx_queues[rx_queue_id];
+ for (i = 0; i < edev->rxq_pools; i++) {
+ if (edev->rxq_pool_array[i] == (uintptr_t)rxq->pool) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ edev->rxq_pool_rcnt[i]--;
+ if (edev->rxq_pool_rcnt[i] == 0)
+ edev->rxq_pool_array[i] = 0;
+ edev->available_events += rxq->pool->size;
+ }
+
+ 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, rx_queue_id);
+ return ret;
+}
+
+static int
+ssovf_eth_rx_adapter_start(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev)
+{
+ RTE_SET_USED(dev);
+ RTE_SET_USED(eth_dev);
+
+ return 0;
+}
+
+
+static int
+ssovf_eth_rx_adapter_stop(const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev)
+{
+ RTE_SET_USED(dev);
+ RTE_SET_USED(eth_dev);
+
+ return 0;
+}
+
+static int
+ssovf_eth_tx_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 = 0;
+ else
+ *caps = RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT;
+
+ return 0;
+}
+
+static int
+ssovf_eth_tx_adapter_create(uint8_t id, const struct rte_eventdev *dev)
+{
+ RTE_SET_USED(id);
+ RTE_SET_USED(dev);
+ return 0;
+}
+
+static int
+ssovf_eth_tx_adapter_free(uint8_t id, const struct rte_eventdev *dev)
+{
+ RTE_SET_USED(id);
+ RTE_SET_USED(dev);
+ return 0;
+}
+
+static int
+ssovf_eth_tx_adapter_queue_add(uint8_t id, const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev, int32_t tx_queue_id)
+{
+ RTE_SET_USED(id);
+ RTE_SET_USED(dev);
+ RTE_SET_USED(eth_dev);
+ RTE_SET_USED(tx_queue_id);
+ return 0;
+}
+
+static int
+ssovf_eth_tx_adapter_queue_del(uint8_t id, const struct rte_eventdev *dev,
+ const struct rte_eth_dev *eth_dev, int32_t tx_queue_id)
+{
+ RTE_SET_USED(id);
+ RTE_SET_USED(dev);
+ RTE_SET_USED(eth_dev);
+ RTE_SET_USED(tx_queue_id);
+ return 0;
+}
+
+static int
+ssovf_eth_tx_adapter_start(uint8_t id, const struct rte_eventdev *dev)
+{
+ RTE_SET_USED(id);
+ RTE_SET_USED(dev);
+ return 0;
+}
+
+static int
+ssovf_eth_tx_adapter_stop(uint8_t id, const struct rte_eventdev *dev)
+{
+ RTE_SET_USED(id);
+ RTE_SET_USED(dev);
+ return 0;
+}
+
+