diff mbox series

[API-NEXT,v1,2/3] linux-generic: pktio: drop support for indefinite waits in recv_tmo

Message ID 1516377621-1467-3-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/3] test: validation: drop use of indefinite wait in pktio test | expand

Commit Message

Github ODP bot Jan. 19, 2018, 4 p.m. UTC
From: Bill Fischofer <bill.fischofer@linaro.org>


Drop support for the deprecated ODP_PKTIN_WAIT option on
odp_pktin_recv_tmo() and odp_pktin_recv_mq_tmo()

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
/** Email created from pull request 410 (Bill-Fischofer-Linaro:pktio-dropwait)
 ** https://github.com/Linaro/odp/pull/410
 ** Patch: https://github.com/Linaro/odp/pull/410.patch
 ** Base sha: e77675624b9cfcd6ea83d11804ed0715b7fad2ec
 ** Merge commit sha: 203a819ff5a42c5c91240db386f4759a47813c99
 **/
 .../include/odp/api/plat/packet_io_types.h         |  1 -
 platform/linux-generic/odp_packet_io.c             | 60 ++++++++++------------
 2 files changed, 27 insertions(+), 34 deletions(-)
diff mbox series

Patch

diff --git a/platform/linux-generic/include/odp/api/plat/packet_io_types.h b/platform/linux-generic/include/odp/api/plat/packet_io_types.h
index 68ec964ca..7436bd3aa 100644
--- a/platform/linux-generic/include/odp/api/plat/packet_io_types.h
+++ b/platform/linux-generic/include/odp/api/plat/packet_io_types.h
@@ -45,7 +45,6 @@  typedef struct odp_pktout_queue_t {
 #define ODP_PKTIO_MACADDR_MAXSIZE 16
 
 #define ODP_PKTIN_NO_WAIT 0
-#define ODP_PKTIN_WAIT    UINT64_MAX
 
 /** Get printable format of odp_pktio_t */
 static inline uint64_t odp_pktio_to_u64(odp_pktio_t hdl)
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index e8cfc7584..eb514ea55 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -1692,29 +1692,26 @@  int odp_pktin_recv_tmo(odp_pktin_queue_t queue, odp_packet_t packets[], int num,
 		if (wait == 0)
 			return 0;
 
-		if (wait != ODP_PKTIN_WAIT) {
-			/* Avoid unnecessary system calls. Record the start time
-			 * only when needed and after the first call to recv. */
-			if (odp_unlikely(!started)) {
-				odp_time_t t;
-
-				t = odp_time_local_from_ns(wait * SLEEP_NSEC);
-				started = 1;
-				t1 = odp_time_sum(odp_time_local(), t);
-			}
-
-			/* Check every SLEEP_CHECK rounds if total wait time
-			 * has been exceeded. */
-			if ((wait & (SLEEP_CHECK - 1)) == 0) {
-				t2 = odp_time_local();
+		/* Avoid unnecessary system calls. Record the start time
+		 * only when needed and after the first call to recv. */
+		if (odp_unlikely(!started)) {
+			odp_time_t t;
+
+			t = odp_time_local_from_ns(wait * SLEEP_NSEC);
+			started = 1;
+			t1 = odp_time_sum(odp_time_local(), t);
+		}
 
-				if (odp_time_cmp(t2, t1) > 0)
-					return 0;
-			}
+		/* Check every SLEEP_CHECK rounds if total wait time
+		 * has been exceeded. */
+		if ((wait & (SLEEP_CHECK - 1)) == 0) {
+			t2 = odp_time_local();
 
-			wait--;
+			if (odp_time_cmp(t2, t1) > 0)
+				return 0;
 		}
 
+		wait--;
 		nanosleep(&ts, NULL);
 	}
 }
@@ -1746,25 +1743,22 @@  int odp_pktin_recv_mq_tmo(const odp_pktin_queue_t queues[], unsigned num_q,
 		if (wait == 0)
 			return 0;
 
-		if (wait != ODP_PKTIN_WAIT) {
-			if (odp_unlikely(!started)) {
-				odp_time_t t;
+		if (odp_unlikely(!started)) {
+			odp_time_t t;
 
-				t = odp_time_local_from_ns(wait * SLEEP_NSEC);
-				started = 1;
-				t1 = odp_time_sum(odp_time_local(), t);
-			}
-
-			if ((wait & (SLEEP_CHECK - 1)) == 0) {
-				t2 = odp_time_local();
+			t = odp_time_local_from_ns(wait * SLEEP_NSEC);
+			started = 1;
+			t1 = odp_time_sum(odp_time_local(), t);
+		}
 
-				if (odp_time_cmp(t2, t1) > 0)
-					return 0;
-			}
+		if ((wait & (SLEEP_CHECK - 1)) == 0) {
+			t2 = odp_time_local();
 
-			wait--;
+			if (odp_time_cmp(t2, t1) > 0)
+				return 0;
 		}
 
+		wait--;
 		nanosleep(&ts, NULL);
 	}
 }