This set looks good to me.<br><br><div class="gmail_quote">On Mon, Apr 19, 2010 at 5:08 PM, Ben Pfaff <span dir="ltr"><<a href="mailto:blp@nicira.com">blp@nicira.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Open vSwitch has always advertised maximum flow table sizes, but it has<br>
never enforced them. This commit implements enforcement.<br>
<br>
Bug #1899.<br>
---<br>
ofproto/ofproto.c | 14 ++++++++++++--<br>
1 files changed, 12 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c<br>
index 6498f7c..f77fc97 100644<br>
--- a/ofproto/ofproto.c<br>
+++ b/ofproto/ofproto.c<br>
@@ -67,6 +67,10 @@ enum {<br>
TABLEID_WILD = 1 /* Wildcard table. */<br>
};<br>
<br>
+/* Maximum number of rules of each kind permitted. */<br>
+#define MAX_EXACT_FLOWS 65536<br>
+#define MAX_WILD_FLOWS 65536<br>
+<br>
struct ofport {<br>
struct netdev *netdev;<br>
struct ofp_phy_port opp; /* In host byte order. */<br>
@@ -2538,7 +2542,7 @@ handle_table_stats_request(struct ofproto *p, struct ofconn *ofconn,<br>
strcpy(ots->name, "exact");<br>
ots->wildcards = htonl(0);<br>
ots->active_count = htonl(ofproto_count_visible_exact(p));<br>
- ots->max_entries = htonl(dpstats.max_capacity);<br>
+ ots->max_entries = htonl(MIN(MAX_EXACT_FLOWS, dpstats.max_capacity));<br>
ots->lookup_count = htonll(dpstats.n_frags + dpstats.n_hit +<br>
dpstats.n_missed);<br>
ots->matched_count = htonll(dpstats.n_hit); /* XXX */<br>
@@ -2551,7 +2555,7 @@ handle_table_stats_request(struct ofproto *p, struct ofconn *ofconn,<br>
ots->wildcards = p->tun_id_from_cookie ? htonl(OVSFW_ALL)<br>
: htonl(OFPFW_ALL);<br>
ots->active_count = htonl(ofproto_count_visible_wild(p));<br>
- ots->max_entries = htonl(65536);<br>
+ ots->max_entries = htonl(MAX_WILD_FLOWS);<br>
ots->lookup_count = htonll(0); /* XXX */<br>
ots->matched_count = htonll(0); /* XXX */<br>
<br>
@@ -2975,6 +2979,12 @@ add_flow(struct ofproto *p, struct ofconn *ofconn,<br>
}<br>
}<br>
<br>
+ if (ofm->match.wildcards<br>
+ ? ofproto_count_visible_wild(p) >= MAX_WILD_FLOWS<br>
+ : ofproto_count_visible_exact(p) >= MAX_EXACT_FLOWS) {<br>
+ return ofp_mkerr(OFPET_FLOW_MOD_FAILED, OFPFMFC_ALL_TABLES_FULL);<br>
+ }<br>
+<br>
rule = rule_create(p, NULL, (const union ofp_action *) ofm->actions,<br>
n_actions, ntohs(ofm->idle_timeout),<br>
ntohs(ofm->hard_timeout), ofm->cookie,<br>
<font color="#888888">--<br>
1.6.6.1<br>
<br>
<br>
_______________________________________________<br>
dev mailing list<br>
<a href="mailto:dev@openvswitch.org">dev@openvswitch.org</a><br>
<a href="http://openvswitch.org/mailman/listinfo/dev_openvswitch.org" target="_blank">http://openvswitch.org/mailman/listinfo/dev_openvswitch.org</a><br>
</font></blockquote></div><br>