event/octeontx2: allow adapters to resize inflight buffers
[dpdk.git] / drivers / event / octeontx2 / otx2_evdev.c
index c5a1509..914869b 100644 (file)
@@ -15,6 +15,7 @@
 #include "otx2_evdev_stats.h"
 #include "otx2_evdev.h"
 #include "otx2_irq.h"
+#include "otx2_tim_evdev.h"
 
 static inline int
 sso_get_msix_offsets(const struct rte_eventdev *event_dev)
@@ -528,6 +529,9 @@ sso_xaq_allocate(struct otx2_sso_evdev *dev)
        xaq_cnt = dev->nb_event_queues * OTX2_SSO_XAQ_CACHE_CNT;
        if (dev->xae_cnt)
                xaq_cnt += dev->xae_cnt / dev->xae_waes;
+       else if (dev->adptr_xae_cnt)
+               xaq_cnt += (dev->adptr_xae_cnt / dev->xae_waes) +
+                       (OTX2_SSO_XAQ_SLACK * dev->nb_event_queues);
        else
                xaq_cnt += (dev->iue / dev->xae_waes) +
                        (OTX2_SSO_XAQ_SLACK * dev->nb_event_queues);
@@ -1029,6 +1033,34 @@ sso_cleanup(struct rte_eventdev *event_dev, uint8_t enable)
        otx2_mbox_process(dev->mbox);
 }
 
+int
+sso_xae_reconfigure(struct rte_eventdev *event_dev)
+{
+       struct otx2_sso_evdev *dev = sso_pmd_priv(event_dev);
+       struct rte_mempool *prev_xaq_pool;
+       int rc = 0;
+
+       if (event_dev->data->dev_started)
+               sso_cleanup(event_dev, 0);
+
+       prev_xaq_pool = dev->xaq_pool;
+       dev->xaq_pool = NULL;
+       sso_xaq_allocate(dev);
+       rc = sso_ggrp_alloc_xaq(dev);
+       if (rc < 0) {
+               otx2_err("Failed to alloc xaq to ggrp %d", rc);
+               rte_mempool_free(prev_xaq_pool);
+               return rc;
+       }
+
+       rte_mempool_free(prev_xaq_pool);
+       rte_mb();
+       if (event_dev->data->dev_started)
+               sso_cleanup(event_dev, 1);
+
+       return 0;
+}
+
 static int
 otx2_sso_start(struct rte_eventdev *event_dev)
 {
@@ -1091,6 +1123,8 @@ static struct rte_eventdev_ops otx2_sso_ops = {
        .port_unlink      = otx2_sso_port_unlink,
        .timeout_ticks    = otx2_sso_timeout_ticks,
 
+       .timer_adapter_caps_get = otx2_tim_caps_get,
+
        .xstats_get       = otx2_sso_xstats_get,
        .xstats_reset     = otx2_sso_xstats_reset,
        .xstats_get_names = otx2_sso_xstats_get_names,
@@ -1310,6 +1344,7 @@ otx2_sso_init(struct rte_eventdev *event_dev)
                event_dev->dev_ops->dev_selftest();
        }
 
+       otx2_tim_init(pci_dev, (struct otx2_dev *)dev);
 
        return 0;
 
@@ -1345,6 +1380,7 @@ dev_fini:
                return -EAGAIN;
        }
 
+       otx2_tim_fini();
        otx2_dev_fini(pci_dev, dev);
 
        return 0;