From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gage.eads@intel.com>
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id C48A328C3
 for <dev@dpdk.org>; Wed,  9 Aug 2017 21:58:52 +0200 (CEST)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga105.fm.intel.com with ESMTP; 09 Aug 2017 12:58:51 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.41,349,1498546800"; d="scan'208";a="121798485"
Received: from txasoft-yocto.an.intel.com (HELO txasoft-yocto.an.intel.com.)
 ([10.123.72.111])
 by orsmga002.jf.intel.com with ESMTP; 09 Aug 2017 12:58:50 -0700
From: Gage Eads <gage.eads@intel.com>
To: dev@dpdk.org
Cc: jerin.jacob@caviumnetworks.com, nipun.gupta@nxp.com,
 hemant.agrawal@nxp.com, harry.van.haaren@intel.com,
 bruce.richardson@intel.com
Date: Wed,  9 Aug 2017 14:58:04 -0500
Message-Id: <1502308684-28031-1-git-send-email-gage.eads@intel.com>
X-Mailer: git-send-email 2.7.4
Subject: [dpdk-dev] [PATCH] eventdev: ease single-link queue config
	requirements
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, 09 Aug 2017 19:58:53 -0000

Events sent through single-link queues are naturally in-order and
atomic, without reordering or atomic scheduling. Logically the
nb_atomic_flows and nb_atomic_order_sequences arguments don't apply to a
single link queue, but applications must set these (depending on the queue
config type) to bypass the is_valid_{ordered, atomic}_queue_conf() checks
in the eventdev layer.

This commit updates those is_valid_* functions to ignore queues with the
SINGLE_LINK flag, to simplify their configuration.

Signed-off-by: Gage Eads <gage.eads@intel.com>
---
 examples/eventdev_pipeline_sw_pmd/main.c | 6 +-----
 lib/librte_eventdev/rte_eventdev.c       | 8 ++++++--
 test/test/test_eventdev_sw.c             | 4 ----
 3 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/examples/eventdev_pipeline_sw_pmd/main.c b/examples/eventdev_pipeline_sw_pmd/main.c
index dd75cb7..09b90c3 100644
--- a/examples/eventdev_pipeline_sw_pmd/main.c
+++ b/examples/eventdev_pipeline_sw_pmd/main.c
@@ -696,11 +696,7 @@ setup_eventdev(struct prod_data *prod_data,
 	};
 	const struct rte_event_queue_conf tx_q_conf = {
 			.priority = RTE_EVENT_DEV_PRIORITY_HIGHEST,
-			.event_queue_cfg =
-					RTE_EVENT_QUEUE_CFG_ATOMIC_ONLY |
-					RTE_EVENT_QUEUE_CFG_SINGLE_LINK,
-			.nb_atomic_flows = 1024,
-			.nb_atomic_order_sequences = 1024,
+			.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK,
 	};
 
 	struct port_link worker_queues[MAX_NUM_STAGES];
diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index bbb3805..46bf24c 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -519,7 +519,9 @@ rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
 static inline int
 is_valid_atomic_queue_conf(const struct rte_event_queue_conf *queue_conf)
 {
-	if (queue_conf && (
+	if (queue_conf &&
+		!(queue_conf->event_queue_cfg &
+		  RTE_EVENT_QUEUE_CFG_SINGLE_LINK) && (
 		((queue_conf->event_queue_cfg &
 			RTE_EVENT_QUEUE_CFG_TYPE_MASK)
 			== RTE_EVENT_QUEUE_CFG_ALL_TYPES) ||
@@ -535,7 +537,9 @@ is_valid_atomic_queue_conf(const struct rte_event_queue_conf *queue_conf)
 static inline int
 is_valid_ordered_queue_conf(const struct rte_event_queue_conf *queue_conf)
 {
-	if (queue_conf && (
+	if (queue_conf &&
+		!(queue_conf->event_queue_cfg &
+		  RTE_EVENT_QUEUE_CFG_SINGLE_LINK) && (
 		((queue_conf->event_queue_cfg &
 			RTE_EVENT_QUEUE_CFG_TYPE_MASK)
 			== RTE_EVENT_QUEUE_CFG_ALL_TYPES) ||
diff --git a/test/test/test_eventdev_sw.c b/test/test/test_eventdev_sw.c
index ba8c053..7219886 100644
--- a/test/test/test_eventdev_sw.c
+++ b/test/test/test_eventdev_sw.c
@@ -267,8 +267,6 @@ create_directed_qids(struct test *t, int num_qids, const uint8_t ports[])
 	static const struct rte_event_queue_conf conf = {
 			.priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
 			.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK,
-			.nb_atomic_flows = 1024,
-			.nb_atomic_order_sequences = 1024,
 	};
 
 	for (i = t->nb_qids; i < t->nb_qids + num_qids; i++) {
@@ -1334,8 +1332,6 @@ port_single_lb_reconfig(struct test *t)
 	static const struct rte_event_queue_conf conf_single_link = {
 		.priority = RTE_EVENT_DEV_PRIORITY_NORMAL,
 		.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK,
-		.nb_atomic_flows = 1024,
-		.nb_atomic_order_sequences = 1024,
 	};
 	if (rte_event_queue_setup(evdev, 1, &conf_single_link) < 0) {
 		printf("%d: error creating qid\n", __LINE__);
-- 
2.7.4