[dpdk-dev] [PATCH v3 41/42] event/octeontx2: add devargs to limit timer adapters

pbhagavatula at marvell.com pbhagavatula at marvell.com
Fri Jun 28 20:23:52 CEST 2019


From: Pavan Nikhilesh <pbhagavatula at marvell.com>

Add devargs to limit the max number of TIM rings reserved on probe.
Since, TIM rings are HW resources we can avoid starving other
applications by not grabbing all the rings.
Example:

	--dev "0002:0e:00.0,tim_rings_lmt=2"

Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>
---
 doc/guides/eventdevs/octeontx2.rst       | 10 ++++++++++
 drivers/event/octeontx2/otx2_tim_evdev.c |  6 +++++-
 drivers/event/octeontx2/otx2_tim_evdev.h |  1 +
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/doc/guides/eventdevs/octeontx2.rst b/doc/guides/eventdevs/octeontx2.rst
index bbc66558f..baa866a1e 100644
--- a/doc/guides/eventdevs/octeontx2.rst
+++ b/doc/guides/eventdevs/octeontx2.rst
@@ -122,6 +122,16 @@ Runtime Config Options
 
     --dev "0002:0e:00.0,tim_stats_ena=1"
 
+- ``TIM limit max rings reserved``
+
+  The ``tim_rings_lmt`` devargs can be used to limit the max number of TIM
+  rings i.e. event timer adapter reserved on probe. Since, TIM rings are HW
+  resources we can avoid starving other applications by not grabbing all the
+  rings.
+  For example::
+
+    --dev "0002:0e:00.0,tim_rings_lmt=5"
+
 Debugging Options
 ~~~~~~~~~~~~~~~~~
 
diff --git a/drivers/event/octeontx2/otx2_tim_evdev.c b/drivers/event/octeontx2/otx2_tim_evdev.c
index cd9a679fb..c312bd541 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.c
+++ b/drivers/event/octeontx2/otx2_tim_evdev.c
@@ -527,6 +527,7 @@ otx2_tim_caps_get(const struct rte_eventdev *evdev, uint64_t flags,
 #define OTX2_TIM_DISABLE_NPA	"tim_disable_npa"
 #define OTX2_TIM_CHNK_SLOTS	"tim_chnk_slots"
 #define OTX2_TIM_STATS_ENA	"tim_stats_ena"
+#define OTX2_TIM_RINGS_LMT	"tim_rings_lmt"
 
 static void
 tim_parse_devargs(struct rte_devargs *devargs, struct otx2_tim_evdev *dev)
@@ -546,6 +547,8 @@ tim_parse_devargs(struct rte_devargs *devargs, struct otx2_tim_evdev *dev)
 			   &parse_kvargs_value, &dev->chunk_slots);
 	rte_kvargs_process(kvlist, OTX2_TIM_STATS_ENA, &parse_kvargs_flag,
 			   &dev->enable_stats);
+	rte_kvargs_process(kvlist, OTX2_TIM_RINGS_LMT, &parse_kvargs_value,
+			   &dev->min_ring_cnt);
 }
 
 void
@@ -583,7 +586,8 @@ otx2_tim_init(struct rte_pci_device *pci_dev, struct otx2_dev *cmn_dev)
 		goto mz_free;
 	}
 
-	dev->nb_rings = rsrc_cnt->tim;
+	dev->nb_rings = dev->min_ring_cnt ?
+		RTE_MIN(dev->min_ring_cnt, rsrc_cnt->tim) : rsrc_cnt->tim;
 
 	if (!dev->nb_rings) {
 		otx2_tim_dbg("No TIM Logical functions provisioned.");
diff --git a/drivers/event/octeontx2/otx2_tim_evdev.h b/drivers/event/octeontx2/otx2_tim_evdev.h
index c8d16b03f..5af724ef9 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.h
+++ b/drivers/event/octeontx2/otx2_tim_evdev.h
@@ -121,6 +121,7 @@ struct otx2_tim_evdev {
 	/* Dev args */
 	uint8_t disable_npa;
 	uint16_t chunk_slots;
+	uint16_t min_ring_cnt;
 	uint8_t enable_stats;
 	/* MSIX offsets */
 	uint16_t tim_msixoff[OTX2_MAX_TIM_RINGS];
-- 
2.22.0



More information about the dev mailing list