@@ -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)
@@ -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);
}
}