[ovs-git] Open vSwitch: ofproto: Make OFPFC_ADD internally modify a rule instead of swapping. (master)

dev at openvswitch.org dev at openvswitch.org
Tue Aug 27 20:23:52 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  b277c7cc6984ef0aa233d5fed48db8a4d6af2210 (commit)
       via  0fb88c18fb26dcbe353501d346ac03295d552b36 (commit)
       via  994c997345100f1868d8fbee508443475c556439 (commit)
       via  b2c1f00b730c3b92e8c1ff37b7d0f8c7a9a44934 (commit)
       via  1828ae514071007c9a0180889151ce9b00aae8fc (commit)
      from  c2dd5e999fc8e172be3a167c71e587bb50da7d97 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b277c7cc6984ef0aa233d5fed48db8a4d6af2210
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=b277c7cc6984ef0aa233d5fed48db8a4d6af2210
Author: Ben Pfaff <blp at nicira.com>
		
ofproto: Make OFPFC_ADD internally modify a rule instead of swapping.
		
add_flow() in ofproto.c has a race: it adds a new flow to the flow table
before calling ->rule_construct().  That means that (in ofproto-dpif) the
new flow is visible to the forwarder threads before gets properly
initialized.

One solution would be to lock the flow table across the entire operation,
but this is not desirable:

   * We would need a write-lock but this would be expensive for
     implementing "learn" flow_mods that often don't really modify anything
     at all.

   * The code would need to keep the lock across a couple of differen calls
     into the client, which seems undesirable if it can be avoided.

   * The code in add_flow() is difficult to understand already.

Instead, I've decided to refactor add_flow() to simplify it and make it
easier to understand.  I think this will also improve the potential for
concurrency.

This commit starts off by collapsing two different cases together into
(almost) one.  In particular, OpenFlow has two ways to modify a flow with a
"flow_mod" command.  You can use an "add" flow_mod to replace the flow, or
you can use a "modify" flow_mod to change it.  The differences in semantics
are minor, but until now Open vSwitch has treated them quite differently.
This commit merges both cases, treating them as variants of what was
previously a "modify".  The advantage is that add_flow() no longer has to
deal with two flows at a time in the "add" case (the old flow being
deleted, the new flow replacing that one).  This does not fix the race, but
it makes it easier to deal with in a later commit.

Transforming "add" into a form of "modify" requires that "modify" be able
to reset flow statistic counters.  OpenFlow 1.2 and later make this an
optional flag in a "flow_mod".  Until now, we haven't implemented that
feature of OF1.2+, but we get it pretty much for free with this
refactoring, so this commit also adds that OF1.2+ feature too.

Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Ethan Jackson <ethan at nicira.com>


commit 0fb88c18fb26dcbe353501d346ac03295d552b36
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=0fb88c18fb26dcbe353501d346ac03295d552b36
Author: Ben Pfaff <blp at nicira.com>
		
ofp-util: Abstract flow_mod OFPFF_* flags.
		
The OFPFF_* flags used in flow_mods are just confusing enough that it
seems worthwhile to try to abstract them out.  In particular:

    * OFPFF_EMERG was introduced in OF1.0, deleted in OF1.1, and then
      its bit was reused for a different purpose in OF1.2.

    * OFPFF_RESET_COUNTS was introduced in OF1.2 but the semantics that it
      specifies are implied by "add" commands in earlier versions, so
      proper translation requires the OpenFlow version number and flow_mod
      command.

This commit does the abstraction.

Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Ethan Jackson <ethan at nicira.com>


commit 994c997345100f1868d8fbee508443475c556439
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=994c997345100f1868d8fbee508443475c556439
Author: Ben Pfaff <blp at nicira.com>
		
ofproto-dpif-xlate: Fix fin_timeout to make rules expirable.
		
In an Open vSwitch flow table that has a configured maximum number of
flows, flows that have an idle or hard timeout, or both, are expirable,
and flows with neither are permanent.  The fin_timeout action can change
a flow that has no idle or hard timeout into one that has either one or
both, which should make a permanent flow into an expirable one, but the
implementation was buggy and did not actually make the flow expirable.
This commit fixes the problem.

This commit also moves most of the implementation of fin_timeout from
ofproto-dpif-xlate into ofproto, because this seems to better respect the
layering.

Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Ethan Jackson <ethan at nicira.com>


commit b2c1f00b730c3b92e8c1ff37b7d0f8c7a9a44934
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=b2c1f00b730c3b92e8c1ff37b7d0f8c7a9a44934
Author: Ben Pfaff <blp at nicira.com>
		
classifier: New function cls_rule_move().
		
This function will acquire its first user in an upcoming commit.

Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Ethan Jackson <ethan at nicira.com>


commit 1828ae514071007c9a0180889151ce9b00aae8fc
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=1828ae514071007c9a0180889151ce9b00aae8fc
Author: Ben Pfaff <blp at nicira.com>
		
Fix typos in a couple of OpenFlow related comments.
		
Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Ethan Jackson <ethan at nicira.com>


-----------------------------------------------------------------------

Summary of changes:
 OPENFLOW-1.1+                   |    3 -
 include/openflow/openflow-1.0.h |    2 +-
 lib/classifier.c                |   12 +-
 lib/classifier.h                |    3 +-
 lib/flow.c                      |   23 +++
 lib/flow.h                      |    2 +
 lib/learn.c                     |   15 +-
 lib/match.c                     |    9 ++
 lib/match.h                     |    3 +-
 lib/ofp-actions.h               |    2 +-
 lib/ofp-errors.h                |    3 +-
 lib/ofp-parse.c                 |   10 +-
 lib/ofp-print.c                 |   28 ++--
 lib/ofp-util.c                  |  145 +++++++++++++----
 lib/ofp-util.h                  |   14 +-
 ofproto/ofproto-dpif-xlate.c    |   24 +--
 ofproto/ofproto-dpif.c          |    9 +-
 ofproto/ofproto-provider.h      |   50 +++---
 ofproto/ofproto.c               |  326 +++++++++++++++++++++++----------------
 utilities/ovs-ofctl.c           |    3 +-
 20 files changed, 441 insertions(+), 245 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list