From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <harry.van.haaren@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id 06DAB101B
 for <dev@dpdk.org>; Wed, 20 Sep 2017 15:35:50 +0200 (CEST)
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 20 Sep 2017 06:35:50 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.42,421,1500966000"; d="scan'208";a="153521594"
Received: from silpixa00398672.ir.intel.com ([10.237.223.128])
 by fmsmga005.fm.intel.com with ESMTP; 20 Sep 2017 06:35:49 -0700
From: Harry van Haaren <harry.van.haaren@intel.com>
To: dev@dpdk.org
Cc: jerin.jacob@caviumnetworks.com,
 Harry van Haaren <harry.van.haaren@intel.com>
Date: Wed, 20 Sep 2017 14:36:02 +0100
Message-Id: <1505914563-182552-5-git-send-email-harry.van.haaren@intel.com>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1505914563-182552-1-git-send-email-harry.van.haaren@intel.com>
References: <1505405343-18234-1-git-send-email-harry.van.haaren@intel.com>
 <1505914563-182552-1-git-send-email-harry.van.haaren@intel.com>
Subject: [dpdk-dev] [PATCH v5 4/5] eventdev: add device started attribute
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Sep 2017 13:35:51 -0000

This commit adds an attribute to the eventdev, allowing applications
to retrieve if the eventdev is running or stopped. Note that no API
or ABI changes were required in adding the statistic, and code changes
are minimal.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventdev.c | 3 +++
 lib/librte_eventdev/rte_eventdev.h | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 73e1df0..480b26e 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -740,6 +740,9 @@ rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
 	case RTE_EVENT_DEV_ATTR_QUEUE_COUNT:
 		*attr_value = dev->data->nb_queues;
 		break;
+	case RTE_EVENT_DEV_ATTR_STARTED:
+		*attr_value = dev->data->dev_started;
+		break;
 	default:
 		return -EINVAL;
 	}
diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h
index 3fd447a..1b629fc 100644
--- a/lib/librte_eventdev/rte_eventdev.h
+++ b/lib/librte_eventdev/rte_eventdev.h
@@ -407,6 +407,10 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
  * The count of queues.
  */
 #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
+/**
+ * The status of the device, zero for stopped, non-zero for started.
+ */
+#define RTE_EVENT_DEV_ATTR_STARTED 2
 
 /**
  * Get an attribute from a device.
-- 
2.7.4