This commit replaces the numbers with appropriate macros. Also
use time_wall_usec() in ipfix_now().

Signed-off-by: Bhanuprakash Bodireddy <[email protected]>
---
 ofproto/ofproto-dpif-ipfix.c | 12 ++++++------
 ofproto/ofproto-dpif-sflow.c |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 4d16878..7afb60e 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -1673,8 +1673,8 @@ ipfix_cache_next_timeout_msec(const struct 
dpif_ipfix_exporter *exporter,
 
     LIST_FOR_EACH (entry, cache_flow_start_timestamp_list_node,
                    &exporter->cache_flow_start_timestamp_list) {
-        *next_timeout_msec = entry->flow_start_timestamp_usec / 1000LL
-            + 1000LL * exporter->cache_active_timeout;
+        *next_timeout_msec = entry->flow_start_timestamp_usec / USEC_PER_MSEC
+            + USEC_PER_MSEC * exporter->cache_active_timeout;
         return true;
     }
 
@@ -1869,7 +1869,7 @@ ipfix_update_stats(struct dpif_ipfix_exporter *exporter,
 static uint64_t
 ipfix_now(void)
 {
-    return time_wall_msec() * 1000ULL;
+    return time_wall_usec();
 }
 
 /* Add an entry into a flow cache.  The entry is either aggregated into
@@ -2290,7 +2290,7 @@ ipfix_put_data_set(uint32_t export_time_sec,
         /* Calculate the negative deltas relative to the export time
          * in seconds sent in the header, not the exact export
          * time. */
-        export_time_usec = 1000000LL * export_time_sec;
+        export_time_usec = USEC_PER_SEC * export_time_sec;
         flow_start_delta_usec = export_time_usec
             - entry->flow_start_timestamp_usec;
         flow_end_delta_usec = export_time_usec
@@ -2620,7 +2620,7 @@ dpif_ipfix_cache_expire(struct dpif_ipfix_exporter 
*exporter,
     }
 
     max_flow_start_timestamp_usec = export_time_usec -
-        1000000LL * exporter->cache_active_timeout;
+        USEC_PER_SEC * exporter->cache_active_timeout;
 
     LIST_FOR_EACH_SAFE (entry, next_entry, 
cache_flow_start_timestamp_list_node,
                         &exporter->cache_flow_start_timestamp_list) {
@@ -2672,7 +2672,7 @@ get_export_time_now(uint64_t *export_time_usec, uint32_t 
*export_time_sec)
     /* The IPFIX start and end deltas are negative deltas relative to
      * the export time, so set the export time 1 second off to
      * calculate those deltas. */
-    *export_time_sec = DIV_ROUND_UP(*export_time_usec, 1000000);
+    *export_time_sec = DIV_ROUND_UP(*export_time_usec, USEC_PER_SEC);
 }
 
 static void
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index ccf8964..ae33a84 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -1405,7 +1405,7 @@ dpif_sflow_wait(struct dpif_sflow *ds) OVS_EXCLUDED(mutex)
 {
     ovs_mutex_lock(&mutex);
     if (ds->collectors != NULL) {
-        poll_timer_wait_until(ds->next_tick * 1000LL);
+        poll_timer_wait_until(ds->next_tick * MSEC_PER_SEC);
     }
     ovs_mutex_unlock(&mutex);
 }
-- 
2.4.11

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to