diff mbox

[API-NEXT,PATCHv2,7/7] linux-generic: default state for pktio is STOP

Message ID 1439550184-28383-8-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Aug. 14, 2015, 11:03 a.m. UTC
After open pktio remains stopped. Inside worker thread (after all
configuration done it should be started.) In that patch I just start
it everywhere to keep original logic and be easy for review. Putting
it inside worker threads will require thread arguments change and
understanding logic of current app. It's better to do further changes
in separate patches per app.

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 example/classifier/odp_classifier.c                       | 1 +
 example/generator/odp_generator.c                         | 2 +-
 example/ipsec/odp_ipsec.c                                 | 1 +
 example/packet/odp_pktio.c                                | 1 +
 platform/linux-generic/pktio/loop.c                       | 2 +-
 platform/linux-generic/pktio/socket.c                     | 2 +-
 platform/linux-generic/pktio/socket_mmap.c                | 2 +-
 test/performance/odp_l2fwd.c                              | 1 +
 test/performance/odp_pktio_perf.c                         | 2 +-
 test/validation/classification/odp_classification_tests.c | 1 +
 test/validation/pktio/pktio.c                             | 1 +
 11 files changed, 11 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index ac204af..ffa39f8 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -210,6 +210,7 @@  static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool)
 		EXAMPLE_ERR("pktio create failed for %s\n", dev);
 		exit(EXIT_FAILURE);
 	}
+	odp_pktio_start(pktio); /* @todo: move to worker thread */
 
 	odp_queue_param_init(&qparam);
 	qparam.sched.prio  = ODP_SCHED_PRIO_DEFAULT;
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 35a6fa8..3cf99fa 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -333,10 +333,10 @@  static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool)
 
 	/* Open a packet IO instance */
 	pktio = odp_pktio_open(dev, pool, &pktio_param);
-
 	if (pktio == ODP_PKTIO_INVALID)
 		EXAMPLE_ABORT("Error: pktio create failed for %s\n", dev);
 
+	odp_pktio_start(pktio); /* @todo: move to worker thread */
 	/*
 	 * Create and set the default INPUT queue associated with the 'pktio'
 	 * resource
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index d392925..c1401d7 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -529,6 +529,7 @@  void initialize_intf(char *intf)
 		EXAMPLE_ERR("Error: pktio create failed for %s\n", intf);
 		exit(EXIT_FAILURE);
 	}
+	odp_pktio_start(pktio); /* @todo: move to worker thread */
 	outq_def = odp_pktio_outq_getdef(pktio);
 
 	/*
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index f4574a2..66dce07 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -138,6 +138,7 @@  static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool, int mode)
 	pktio = odp_pktio_open(dev, pool, &pktio_param);
 	if (pktio == ODP_PKTIO_INVALID)
 		EXAMPLE_ABORT("Error: pktio create failed for %s\n", dev);
+	odp_pktio_start(pktio); /* @todo: move to worker thread */
 
 	snprintf(inq_name, sizeof(inq_name), "%" PRIu64 "-pktio_inq_def",
 		 odp_pktio_to_u64(pktio));
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index f61ccd5..ef77e34 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -41,7 +41,7 @@  static int loopback_open(odp_pktio_t id, pktio_entry_t *pktio_entry,
 	if (pktio_entry->s.pkt_loop.loopq == ODP_QUEUE_INVALID)
 		return -1;
 
-	pktio_entry->s.state = STATE_START;
+	pktio_entry->s.state = STATE_STOP;
 	return 0;
 }
 
diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c
index 7db9747..f1dd39c 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -248,7 +248,7 @@  static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev,
 		goto error;
 	}
 
-	pktio_entry->s.state = STATE_START;
+	pktio_entry->s.state = STATE_STOP;
 	return 0;
 
 error:
diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c
index 2e55672..3fd2b0f 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -486,7 +486,7 @@  static int sock_mmap_open(odp_pktio_t id ODP_UNUSED,
 			goto error;
 	}
 
-	pktio_entry->s.state = STATE_START;
+	pktio_entry->s.state = STATE_STOP;
 	return 0;
 
 error:
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 366bb15..2a8ed68 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -292,6 +292,7 @@  static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool,
 
 	printf("created pktio %" PRIu64 " (%s)\n",
 	       odp_pktio_to_u64(pktio), dev);
+	odp_pktio_start(pktio); /* @todo: move to worker thread */
 
 	/* no further setup needed for burst mode */
 	if (mode == APPL_MODE_PKT_BURST)
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index 1552579..5d739bc 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -709,7 +709,7 @@  static odp_pktio_t create_pktio(const char *iface, int schedule)
 		pktio_param.in_mode = ODP_PKTIN_MODE_POLL;
 
 	pktio = odp_pktio_open(iface, pool, &pktio_param);
-
+	odp_pktio_start(pktio); /* @todo: move to worker thread */
 	return pktio;
 }
 
diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
index c44ceb9..0592066 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -306,6 +306,7 @@  int classification_suite_init(void)
 			fprintf(stderr, "unable to destroy pool.\n");
 		return -1;
 	}
+	odp_pktio_start(pktio_loop); /* @todo: move to worker thread */
 	qparam.sched.prio  = ODP_SCHED_PRIO_DEFAULT;
 	qparam.sched.sync  = ODP_SCHED_SYNC_ATOMIC;
 	qparam.sched.group = ODP_SCHED_GROUP_ALL;
diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 4222463..11cb67f 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -239,6 +239,7 @@  static odp_pktio_t create_pktio(const char *iface, odp_queue_type_t q_type,
 	CU_ASSERT(pktio != ODP_PKTIO_INVALID);
 	CU_ASSERT(odp_pktio_to_u64(pktio) !=
 		  odp_pktio_to_u64(ODP_PKTIO_INVALID));
+	odp_pktio_start(pktio);
 
 	return pktio;
 }