aboutsummaryrefslogtreecommitdiff
path: root/lib/learn.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-09-12 16:19:57 -0700
committerBen Pfaff <blp@nicira.com>2011-09-13 11:46:09 -0700
commit75a75043564dc9b002fffa6c6ad71e0d4d5c892e (patch)
tree2e059054c5b3e146e3777c013f6cac42246ffa4c /lib/learn.h
parent308881afb61e292c629b36a357cfc37153884000 (diff)
Implement new "learn" action.
There are a few loose ends here. First, learning actions cause too much flow revalidation. Upcoming commits will fix that problem. The following additional issues have not yet been addressed: * Resource limits: nothing yet limits the maximum number of flows that can be learned. It is possible to exhaust all system memory. * Age reporting: there is no way to find out how soon a learned table entry is due to be evicted. To try this action out, here's a recipe for a very simple-minded MAC learning switch. It uses a 10-second MAC expiration time to make it easier to see what's going on: ovs-vsctl del-controller br0 ovs-ofctl del-flows br0 ovs-ofctl add-flow br0 "table=0 actions=learn(table=1, hard_timeout=10, \ NXM_OF_VLAN_TCI[0..11], NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[], \ output:NXM_OF_IN_PORT[]), resubmit(,1)" ovs-ofctl add-flow br0 "table=1 priority=0 actions=flood" You can then dump the MAC learning table with: ovs-ofctl dump-flows br0 table=1
Diffstat (limited to 'lib/learn.h')
-rw-r--r--lib/learn.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/learn.h b/lib/learn.h
new file mode 100644
index 00000000..19a9089c
--- /dev/null
+++ b/lib/learn.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Nicira Networks.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LEARN_H
+#define LEARN_H 1
+
+struct ds;
+struct flow;
+struct ofpbuf;
+struct ofputil_flow_mod;
+struct nx_action_learn;
+
+/* NXAST_LEARN helper functions.
+ *
+ * See include/openflow/nicira-ext.h for NXAST_LEARN specification.
+ */
+
+int learn_check(const struct nx_action_learn *, const struct flow *);
+void learn_execute(const struct nx_action_learn *, const struct flow *,
+ struct ofputil_flow_mod *);
+
+void learn_parse(struct ofpbuf *, char *, const struct flow *);
+void learn_format(const struct nx_action_learn *, struct ds *);
+
+#endif /* learn.h */