From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 33971A0547;
	Fri, 12 Feb 2021 17:58:33 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 8A36F22A2B8;
	Fri, 12 Feb 2021 17:58:27 +0100 (CET)
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by mails.dpdk.org (Postfix) with ESMTP id 67CDA22A2AB
 for <dev@dpdk.org>; Fri, 12 Feb 2021 17:58:24 +0100 (CET)
IronPort-SDR: smyn2CPWNngAyckG41j1uJFrzgV+yVgH44Fv9gCa5FM+Kkv9kOQ5MbUaZ0SFQen9Rm3UETmX7U
 mAo8GCizJy7A==
X-IronPort-AV: E=McAfee;i="6000,8403,9893"; a="182511459"
X-IronPort-AV: E=Sophos;i="5.81,174,1610438400"; d="scan'208";a="182511459"
Received: from orsmga003.jf.intel.com ([10.7.209.27])
 by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 12 Feb 2021 08:58:24 -0800
IronPort-SDR: iX4PwLiswDwbXG0mdfmg3jxRyxE4M8wthR/mv+CpwW4CjNwavogabMXkizjqtDMfnP4fUyTz3t
 swv9pMyPEY+A==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.81,174,1610438400"; d="scan'208";a="360466441"
Received: from silpixa00400633.ir.intel.com ([10.237.213.44])
 by orsmga003.jf.intel.com with ESMTP; 12 Feb 2021 08:58:22 -0800
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com, mattias.ronnblom@ericsson.com,
 honnappa.nagarahalli@arm.com, Harry van Haaren <harry.van.haaren@intel.com>
Date: Fri, 12 Feb 2021 16:58:13 +0000
Message-Id: <20210212165814.2189305-2-harry.van.haaren@intel.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20210212165814.2189305-1-harry.van.haaren@intel.com>
References: <20210212165814.2189305-1-harry.van.haaren@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH v3 2/3] event/sw: add useful work done attribute
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

This commit exposes if useful work is done to the service
instance. The normal service_attr_get() API can be used to
retrieve the value of the attribute.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 drivers/event/sw/sw_evdev_scheduler.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c
index f747b3c6d4..c78f687446 100644
--- a/drivers/event/sw/sw_evdev_scheduler.c
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -5,6 +5,9 @@
 #include <rte_ring.h>
 #include <rte_hash_crc.h>
 #include <rte_event_ring.h>
+
+#include <rte_service_component.h>
+
 #include "sw_evdev.h"
 #include "iq_chunk.h"
 #include "event_ring.h"
@@ -559,6 +562,10 @@ sw_event_schedule(struct rte_eventdev *dev)
 	sw->sched_no_iq_enqueues += (in_pkts_total == 0);
 	sw->sched_no_cq_enqueues += (out_pkts_total == 0);
 
+	uint64_t work_done = (in_pkts_total + out_pkts_total) != 0;
+	rte_service_component_attr_set(sw->service_id,
+			RTE_SERVICE_ATTR_USEFUL_WORK_LAST_ITER, work_done);
+
 	/* push all the internal buffered QEs in port->cq_ring to the
 	 * worker cores: aka, do the ring transfers batched.
 	 */
-- 
2.25.1