igb: fix max RX packet size and support dual VLAN
[dpdk.git] / lib / librte_timer / rte_timer.c
index a944bee..f3798ae 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  *   BSD LICENSE
  * 
- *   Copyright(c) 2010-2012 Intel Corporation. All rights reserved.
+ *   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
  *   All rights reserved.
  * 
  *   Redistribution and use in source and binary forms, with or without 
@@ -30,7 +30,6 @@
  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * 
- *  version: DPDK.L.1.2.3-3
  */
 
 #include <string.h>
@@ -204,7 +203,7 @@ timer_set_running_state(struct rte_timer *tim)
 static void
 timer_add(struct rte_timer *tim, unsigned tim_lcore, int local_is_locked)
 {
-       uint64_t cur_time = rte_get_hpet_cycles();
+       uint64_t cur_time = rte_get_timer_cycles();
        unsigned lcore_id = rte_lcore_id();
        struct rte_timer *t, *t_prev;
 
@@ -323,7 +322,7 @@ rte_timer_reset(struct rte_timer *tim, uint64_t ticks,
                enum rte_timer_type type, unsigned tim_lcore,
                rte_timer_cb_t fct, void *arg)
 {
-       uint64_t cur_time = rte_get_hpet_cycles();
+       uint64_t cur_time = rte_get_timer_cycles();
        uint64_t period;
 
        if (unlikely((tim_lcore != (unsigned)LCORE_ID_ANY) &&
@@ -388,7 +387,8 @@ rte_timer_stop(struct rte_timer *tim)
 void
 rte_timer_stop_sync(struct rte_timer *tim)
 {
-       while (rte_timer_stop(tim) != 0);
+       while (rte_timer_stop(tim) != 0)
+               rte_pause();
 }
 
 /* Test the PENDING status of the timer handle tim */
@@ -404,10 +404,14 @@ void rte_timer_manage(void)
        union rte_timer_status status;
        struct rte_timer *tim, *tim2;
        unsigned lcore_id = rte_lcore_id();
-       uint64_t cur_time = rte_get_hpet_cycles();
+       uint64_t cur_time;
        int ret;
 
        __TIMER_STAT_ADD(manage, 1);
+       /* optimize for the case where per-cpu list is empty */
+       if (LIST_EMPTY(&priv_timer[lcore_id].pending))
+               return;
+       cur_time = rte_get_timer_cycles();
 
        /* browse ordered list, add expired timers in 'expired' list */
        rte_spinlock_lock(&priv_timer[lcore_id].list_lock);