Implement QoS framework.
[sliver-openvswitch.git] / lib / learning-switch.c
index 092274c..7eb9e1c 100644 (file)
@@ -27,6 +27,7 @@
 #include "mac-learning.h"
 #include "ofpbuf.h"
 #include "ofp-print.h"
+#include "ofp-util.h"
 #include "openflow/openflow.h"
 #include "poll-loop.h"
 #include "queue.h"
@@ -220,13 +221,7 @@ lswitch_run(struct lswitch *sw, struct rconn *rconn)
 static void
 wait_timeout(long long int started)
 {
-    long long int now = time_msec();
-    long long int timeout = 10000 - (now - started);
-    if (timeout <= 0) {
-        poll_immediate_wake();
-    } else {
-        poll_timer_wait(timeout);
-    }
+    poll_timer_wait_until(started + 10000);
 }
 
 void
@@ -404,10 +399,11 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn, void *opi_)
     pkt_len = ntohs(opi->header.length) - pkt_ofs;
     pkt.data = opi->data;
     pkt.size = pkt_len;
-    flow_extract(&pkt, in_port, &flow);
+    flow_extract(&pkt, 0, in_port, &flow);
 
     if (may_learn(sw, in_port) && sw->ml) {
-        if (mac_learning_learn(sw->ml, flow.dl_src, 0, in_port)) {
+        if (mac_learning_learn(sw->ml, flow.dl_src, 0, in_port,
+                               GRAT_ARP_LOCK_NONE)) {
             VLOG_DBG_RL(&rl, "%016llx: learned that "ETH_ADDR_FMT" is on "
                         "port %"PRIu16, sw->datapath_id,
                         ETH_ADDR_ARGS(flow.dl_src), in_port);
@@ -424,7 +420,7 @@ process_packet_in(struct lswitch *sw, struct rconn *rconn, void *opi_)
     }
 
     if (sw->ml) {
-        int learned_port = mac_learning_lookup(sw->ml, flow.dl_dst, 0);
+        int learned_port = mac_learning_lookup(sw->ml, flow.dl_dst, 0, NULL);
         if (learned_port >= 0 && may_send(sw, learned_port)) {
             out_port = learned_port;
         }