[ovs-dev] [threaded-learning 22/25] ofproto: Refactor eviction cases to use common code.

2013-09-10 Thread Ben Pfaff
Signed-off-by: Ben Pfaff --- ofproto/ofproto.c | 79 ++--- 1 file changed, 27 insertions(+), 52 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index c05afd6..09a07f6 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -3523

[ovs-dev] [threaded-learning 20/25] ofproto: Mark immutable members of struct rule 'const'.

2013-09-10 Thread Ben Pfaff
One difficult part of make flow_mods thread-safe is sorting out which members of each structure can be modified under which locks and, especially, documenting this in a way that makes it hard for programmers to get it wrong later. The compiler provides some tools for us, however, and 'const' is on

[ovs-dev] [threaded-learning 24/25] ofproto: Remove redundant cls parameter from a few functions.

2013-09-10 Thread Ben Pfaff
Previously this parameter was useful for Clang locking annotations but it isn't actually a locking requirement anymore, so remove the parameter. Signed-off-by: Ben Pfaff --- ofproto/ofproto-dpif.c |2 +- ofproto/ofproto-provider.h |3 +-- ofproto/ofproto.c | 33 +++

[ovs-dev] [threaded-learning 25/25] ofproto-dpif: Move "learn" actions into individual threads.

2013-09-10 Thread Ben Pfaff
Before OVS introduced threading, any given ``learn'' action took effect in the flow table before the next incoming flow was set up. This meant that if a packet came in, used ``learn'' to set up a flow to handle replies, and then a reply came in, the reply would always hit the flow set up by the ``

Re: [ovs-dev] [PATCH 03/11] ofproto: Factor code out of collect_rules_{loose, strict} into new helper.

2013-09-10 Thread Ben Pfaff
This patch and the remaining ones in this series are superseded and replaced by the ones in the "threaded-learning" series that I just posted. ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev

[ovs-dev] [threaded-learning 15/25] ofproto: Drop 'expirable_mutex' in favor of new global 'ofproto_mutex'.

2013-09-10 Thread Ben Pfaff
This is the first step toward making a global lock that protects everything needed for updating the flow table. This commit starts out by merging one lock into the new one, and later commits will continue that process. The mutex is initially a recursive one, because I wasn't sure that there were

[ovs-dev] [threaded-learning 19/25] ofproto: Make some functions for rules private to ofproto.c.

2013-09-10 Thread Ben Pfaff
These aren't used outside this file. Signed-off-by: Ben Pfaff --- ofproto/ofproto-provider.h |5 - ofproto/ofproto.c |6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 3684b0c..d477434 10064

[ovs-dev] [threaded-learning 21/25] ofproto: New helper any_pending_ops().

2013-09-10 Thread Ben Pfaff
This function is trivial now but in an upcoming commit it will need to become slightly more complicated, which makes writing it as a function worthwhile. Until then, this commit simplifies the logic, which was redundant since the 'deletions' hmap always points into the 'pending' list anyway. Sign

[ovs-dev] [threaded-learning 13/25] classifier: Allow CLS_CURSOR_FOR_EACH to use a const-qualified iterator.

2013-09-10 Thread Ben Pfaff
Signed-off-by: Ben Pfaff --- lib/classifier.c |3 ++- lib/classifier.h |2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/classifier.c b/lib/classifier.c index 93ee977..36eb1f0 100644 --- a/lib/classifier.c +++ b/lib/classifier.c @@ -500,8 +500,9 @@ cls_cursor_first

[ovs-dev] [threaded-learning 16/25] ofproto: Protect index by cookie with ofproto_mutex.

2013-09-10 Thread Ben Pfaff
The cookie index is only used for flow_mods, so it makes sense to use this global mutex. Signed-off-by: Ben Pfaff --- ofproto/ofproto-provider.h |5 +++-- ofproto/ofproto.c | 15 +++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto-provid

[ovs-dev] [threaded-learning 12/25] guarded-list: New data structure for thread-safe queue.

2013-09-10 Thread Ben Pfaff
We already had two queues that were suitable for replacement by this data structure, and I intend to add another one later on. Signed-off-by: Ben Pfaff --- lib/automake.mk|2 ++ lib/guarded-list.c | 65 +++ lib/guarded-list.h | 36 +

[ovs-dev] [threaded-learning 17/25] ofproto: Replace rwlock in struct rule by a mutex.

2013-09-10 Thread Ben Pfaff
A rwlock is suitable when one expects long hold times so there is a need for some parallelism for readers. But when the lock is held briefly, it makes more sense to use a mutex for two reasons. First, a rwlock is more complex than a mutex so one would expect it to be more expensive to acquire. S

[ovs-dev] [threaded-learning 18/25] ofproto: Remove ->timeout_mutex from struct rule (just use ->mutex).

2013-09-10 Thread Ben Pfaff
I think that ->timeout_mutex and ->mutex were separate because the latter (which was actually a rwlock named ->rwlock until recently) was held for long periods of time, which meant that having a separate ->timeout_mutex reduced lock contention. But ->mutex is now only held briefly, so it seems rea

[ovs-dev] [threaded-learning 14/25] ofproto: Move rule_execute() out of ofopgroup_complete().

2013-09-10 Thread Ben Pfaff
One goal we're moving toward is to be able to execute "learn" actions in each thread that handles packets that arrive on an interface just before we forward those packets. The planned strategy there is to have a global lock that protects everything required to modify the flow table. Generally thi

[ovs-dev] [threaded-learning 10/25] ofproto: Break actions out of rule into new rule_actions structure.

2013-09-10 Thread Ben Pfaff
This permits code to ensure long-term access to a rule's actions without holding a long-term lock on the rule's rwlock. Signed-off-by: Ben Pfaff --- ofproto/connmgr.c|4 +- ofproto/ofproto-dpif-xlate.c | 16 +++-- ofproto/ofproto-dpif.c | 26 +--- ofproto/ofproto-dp

[ovs-dev] [threaded-learning 08/25] ofproto: Move function find_meter() into ofpacts as ofpacts_get_meter().

2013-09-10 Thread Ben Pfaff
ofproto is too big anyway so we might as well move out code that can reasonably live elsewhere. Signed-off-by: Ben Pfaff --- lib/ofp-actions.c | 24 lib/ofp-actions.h |1 + ofproto/ofproto.c | 33 + 3 files changed, 30 insertions(+

[ovs-dev] [threaded-learning 06/25] ofproto-dpif: Remove vestigial "clogged" feature.

2013-09-10 Thread Ben Pfaff
Signed-off-by: Ben Pfaff --- ofproto/ofproto-dpif.c | 64 ++-- 1 file changed, 2 insertions(+), 62 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index b52d4ee..97735e2 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofpr

[ovs-dev] [threaded-learning 11/25] ofproto: Add a ref_count to "struct rule" to protect it from being freed.

2013-09-10 Thread Ben Pfaff
Taking a read-lock on the 'rwlock' member of struct rule prevents members of the rule from changing. This is a short-term use of the 'rwlock': one takes the lock, reads some members, and releases the lock. Taking a read-lock on the 'rwlock' also prevents the rule from being freed. This is often a

[ovs-dev] [threaded-learning 09/25] ofproto: Remove soon-to-be-invalid optimizations.

2013-09-10 Thread Ben Pfaff
Until now, ofproto_add_flow() and ofproto_delete_flow() assumed that the flow table could not change between its flow table check and its later modification to the flow table. This assumption will soon be untrue, so remove it. Signed-off-by: Ben Pfaff --- ofproto/ofproto.c | 64 ++

[ovs-dev] [threaded-learning 07/25] ofproto: Merge ofproto_rule_delete() and ofproto_delete_rule().

2013-09-10 Thread Ben Pfaff
These functions were identical but had different names (one just called the other). Make them a single function. Signed-off-by: Ben Pfaff --- ofproto/ofproto.c | 35 +++ 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto

[ovs-dev] [threaded-learning 00/25] Execute "learn" actions during xlate

2013-09-10 Thread Ben Pfaff
Before we introduced threading, any given ``learn'' action took effect in the flow table before the next incoming flow was set up. This meant that if a packet came in, used ``learn'' to set up a flow to handle replies, and then a reply came in, the reply would always hit the flow set up by the ``l

[ovs-dev] [threaded-learning 02/25] ofproto: Support out_group feature when matching on cookie.

2013-09-10 Thread Ben Pfaff
Found by inspection. Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- ofproto/ofproto.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 03738ab..e7ee60e 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2982,7

[ovs-dev] [threaded-learning 05/25] ofproto: Avoid gratuitous memory allocation and free.

2013-09-10 Thread Ben Pfaff
Signed-off-by: Ben Pfaff --- ofproto/ofproto.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 388463a..b027873 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1717,10 +1717,9 @@ ofproto_add_flow(struct ofproto *ofpro

[ovs-dev] [threaded-learning 04/25] ofproto: Correct comments.

2013-09-10 Thread Ben Pfaff
Signed-off-by: Ben Pfaff Signed-off-by: Ben Pfaff --- ofproto/ofproto.c |5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 81b6c43..388463a 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2276,7 +2276,7 @@ ofproto_r

[ovs-dev] [threaded-learning 01/25] ofproto: Do not call ->rule_destruct() if ->rule_construct() failed.

2013-09-10 Thread Ben Pfaff
Found by inspection. Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- ofproto/ofproto.c | 23 +++ 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 4d33de7..03738ab 100644 --- a/ofproto/ofproto.c +++ b/ofproto/of

[ovs-dev] [threaded-learning 03/25] ofproto: Factor code out of collect_rules_{loose, strict} into new helper.

2013-09-10 Thread Ben Pfaff
Signed-off-by: Ben Pfaff --- ofproto/ofproto.c | 125 +++-- 1 file changed, 55 insertions(+), 70 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index e7ee60e..81b6c43 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -2935

Re: [ovs-dev] [PATCH] openflow-1.1+: OFPT_TABLE_MOD: Use enum ofp11_table_config in struct ofputil_table_mod

2013-09-10 Thread Simon Horman
On Tue, Sep 10, 2013 at 09:17:10AM -0700, Andy Zhou wrote: > I don't think OFPTC11_TABLE_MISS_MASK is a possible value. It is there to > simply indicate there are 2 bits used for miss configuration. May be it > should be outside of the enum definition? I agree that OFPTC11_TABLE_MISS_MASK isn't a

[ovs-dev] [PATCH] openflow-1.1+: move OFPTC11_TABLE_MISS_MASK out of enum

2013-09-10 Thread Andy Zhou
OFPTC11_TABLE_MISS_MASK is not a valid configuration, but to indicate there are only 2 bits being used for table miss configuration. Move it out of the enum definition. Reported-by: Simon Horman Signed-off-by: Andy Zhou --- include/openflow/openflow-1.1.h |3 ++- 1 file changed, 2 insertion

Re: [ovs-dev] [PATCH] ofproto: Reduce default number of miss handlers.

2013-09-10 Thread Ben Pfaff
On Tue, Sep 10, 2013 at 3:37 PM, Ethan Jackson wrote: > The default number of miss handlers should be the number of processors > minus two to account for the dispatcher and main threads. > > Signed-off-by: Ethan Jackson > I was a little concerned about this but you said off-list that you couldn

[ovs-dev] [PATCH] ofproto: Reduce default number of miss handlers.

2013-09-10 Thread Ethan Jackson
The default number of miss handlers should be the number of processors minus two to account for the dispatcher and main threads. Signed-off-by: Ethan Jackson --- ofproto/ofproto.c|5 +++-- vswitchd/vswitch.xml |2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ofpr

Re: [ovs-dev] [PATCH] ofproto: Fix core dump due to uninitialized cls_rule.

2013-09-10 Thread Ben Pfaff
On Tue, Sep 10, 2013 at 01:31:17PM -0700, Ethan Jackson wrote: > Bug #19568. > Signed-off-by: Ethan Jackson Acked-by: Ben Pfaff ___ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev

Re: [ovs-dev] [PATCH v2] Fix a bug in conversion between flow/mask and flow key

2013-09-10 Thread Ben Pfaff
Applied, thanks. On Tue, Sep 10, 2013 at 01:51:52PM -0700, Andy Zhou wrote: > Sorry, I attached a wrong file. Try again. > > > On Wed, Sep 4, 2013 at 3:37 PM, Ben Pfaff wrote: > > > The code that this changes checks for two values in icmpv6_type. The > > new version of the code checks for one

Re: [ovs-dev] [PATCH v2] Fix a bug in conversion between flow/mask and flow key

2013-09-10 Thread Andy Zhou
Sorry, I attached a wrong file. Try again. On Wed, Sep 4, 2013 at 3:37 PM, Ben Pfaff wrote: > The code that this changes checks for two values in icmpv6_type. The > new version of the code checks for one value in tp_src or a different > value in tp_dst. Should it check for two values in tp_sr

Re: [ovs-dev] [PATCH] ofproto-dpif: Don't hold mac rwlock while calling send_packet().

2013-09-10 Thread Ben Pfaff
On Fri, Sep 06, 2013 at 12:53:17PM -0700, Ethan Jackson wrote: > Holding the mac learning rwlock while calling send_packet() which > calls xlate_actions() is dangerous because somewhere deep in the chain > the same lock might be acquired causing a deadlock. Though we haven't > run into this proble

Re: [ovs-dev] [PATCH] ofproto: Fix core dump due to uninitialized cls_rule.

2013-09-10 Thread Ethan Jackson
Thanks, I'll merge shortly. On Tue, Sep 10, 2013 at 1:40 PM, Ben Pfaff wrote: > On Tue, Sep 10, 2013 at 01:31:17PM -0700, Ethan Jackson wrote: >> Bug #19568. >> Signed-off-by: Ethan Jackson > > Acked-by: Ben Pfaff ___ dev mailing list dev@openvswitch.

Re: [ovs-dev] [PATCH] ofproto-dpif: Don't hold mac rwlock while calling send_packet().

2013-09-10 Thread Ethan Jackson
Not too worried about it. Thanks for the review, Ethan On Tue, Sep 10, 2013 at 1:47 PM, Ben Pfaff wrote: > On Fri, Sep 06, 2013 at 12:53:17PM -0700, Ethan Jackson wrote: >> Holding the mac learning rwlock while calling send_packet() which >> calls xlate_actions() is dangerous because somewhere d

[ovs-dev] [PATCH] ofproto: Fix core dump due to uninitialized cls_rule.

2013-09-10 Thread Ethan Jackson
Bug #19568. Signed-off-by: Ethan Jackson --- ofproto/ofproto.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index e7ee60e..a9a20b8 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1290,7 +1290,6 @@ ofproto_run(struct ofpr

Re: [ovs-dev] [PATCH 02/11] ofproto: Support out_group feature when matching on cookie.

2013-09-10 Thread Ben Pfaff
On Mon, Sep 09, 2013 at 02:36:50PM -0700, Ethan Jackson wrote: > Acked-by: Ethan Jackson > > > On Mon, Sep 9, 2013 at 2:22 PM, Ben Pfaff wrote: > > Found by inspection. > > > > Signed-off-by: Ben Pfaff Thanks for reviewing the first two patches. I applied these to master. I applied the firs

Re: [ovs-dev] Rapid Spanning Tree Protocol (RSTP) implementation

2013-09-10 Thread Martino Fornasa
Ben Pfaff wrote: On Tue, Sep 10, 2013 at 03:26:48PM +0200, Martino Fornasa wrote: This sounds very nice. Do you plan to make the result available to the Open vSwitch community? We do, as soon as we reach a decent stage in the porting. In this moment we are dealing with stp-related components

Re: [ovs-dev] [PATCH] openflow-1.1+: OFPT_TABLE_MOD: Use enum ofp11_table_config in struct ofputil_table_mod

2013-09-10 Thread Andy Zhou
I don't think OFPTC11_TABLE_MISS_MASK is a possible value. It is there to simply indicate there are 2 bits used for miss configuration. May be it should be outside of the enum definition? On Sun, Sep 8, 2013 at 6:28 PM, Simon Horman wrote: > It seems convenient and in keeping with other Open vS

Re: [ovs-dev] Rapid Spanning Tree Protocol (RSTP) implementation

2013-09-10 Thread Ben Pfaff
On Tue, Sep 10, 2013 at 05:34:28PM +0200, Martino Fornasa wrote: > Ben Pfaff wrote: > >On Tue, Sep 10, 2013 at 03:26:48PM +0200, Martino Fornasa wrote: > >This sounds very nice. Do you plan to make the result available to > >the Open vSwitch community? > We do, as soon as we reach a decent stage in

Re: [ovs-dev] Rapid Spanning Tree Protocol (RSTP) implementation

2013-09-10 Thread Ben Pfaff
On Tue, Sep 10, 2013 at 03:26:48PM +0200, Martino Fornasa wrote: > at M3S (http://www.m3s.it) we developed a complete implementation of > the Rapid Spanning Tree Protocol (RSTP) as defined in the standard > IEEE 802.1D-2004 (which is the evolution of the first standard > defining RSTP, IEEE 802.1w)

[ovs-dev] Rapid Spanning Tree Protocol (RSTP) implementation

2013-09-10 Thread Martino Fornasa
Hi, at M3S (http://www.m3s.it) we developed a complete implementation of the Rapid Spanning Tree Protocol (RSTP) as defined in the standard IEEE 802.1D-2004 (which is the evolution of the first standard defining RSTP, IEEE 802.1w). The implementation has been tested in a lab environment and we