[ovs-dev] [unit-test: improve link speed 2/2] unit-test: Link 29 test programs into ovstest

2014-04-01 Thread Andy Zhou
Improve link speed by linking 29 test programs into ovstest.

On my machine, running the following command against a fully
built tree:

  $ touch lib/random.c; time make

Improve the overall build time from 7 seconds to 3.5 seconds.

Signed-off-by: Andy Zhou 
---
 tests/aes128.at  |2 +-
 tests/automake.mk|  149 ++
 tests/bundle.at  |8 +--
 tests/classifier.at  |4 +-
 tests/file_name.at   |2 +-
 tests/json.at|8 +--
 tests/jsonrpc.at |   12 ++--
 tests/library.at |   32 +-
 tests/lockfile.at|2 +-
 tests/multipath.at   |6 +-
 tests/odp.at |   26 
 tests/ofproto-dpif.at|8 +--
 tests/reconnect.at   |2 +-
 tests/stp.at |8 +--
 tests/test-aes128.c  |   11 ++--
 tests/test-atomic.c  |   10 ++--
 tests/test-bundle.c  |   11 ++--
 tests/test-byte-order.c  |9 +--
 tests/test-classifier.c  |   15 ++---
 tests/test-csum.c|   12 ++--
 tests/test-file_name.c   |   11 ++--
 tests/test-flows.c   |   10 ++--
 tests/test-hash.c|   11 ++--
 tests/test-hindex.c  |9 +--
 tests/test-hmap.c|9 +--
 tests/test-json.c|   12 ++--
 tests/test-jsonrpc.c |   10 ++--
 tests/test-list.c|9 +--
 tests/test-lockfile.c|8 ++-
 tests/test-multipath.c   |   11 ++--
 tests/test-netflow.c |   11 ++--
 tests/test-odp.c |9 ++-
 tests/test-packets.c |   11 ++--
 tests/test-random.c  |   12 ++--
 tests/test-reconnect.c   |   11 ++--
 tests/test-sflow.c   |7 ++-
 tests/test-sha1.c|9 +--
 tests/test-stp.c |9 ++-
 tests/test-unix-socket.c |   11 ++--
 tests/test-util.c|9 ++-
 tests/test-uuid.c|   11 ++--
 tests/test-vconn.c   |9 ++-
 tests/uuid.at|4 +-
 tests/vconn.at   |2 +-
 44 files changed, 263 insertions(+), 299 deletions(-)

diff --git a/tests/aes128.at b/tests/aes128.at
index 4818f5c..6876dd2 100644
--- a/tests/aes128.at
+++ b/tests/aes128.at
@@ -3,7 +3,7 @@ AT_BANNER([AES-128 unit tests])
 m4_define([AES128_CHECK], 
   [AT_SETUP([$1])
AT_KEYWORDS([aes128])
-   AT_CHECK([test-aes128 $2 $3], [0], [$4
+   AT_CHECK([ovstest test-aes128 $2 $3], [0], [$4
 ], [])
AT_CLEANUP])
 
diff --git a/tests/automake.mk b/tests/automake.mk
index 6c59c6e..bf80702 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -179,22 +179,6 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
  echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
} >'$(srcdir)/package.m4'
 
-noinst_PROGRAMS += tests/test-aes128
-tests_test_aes128_SOURCES = tests/test-aes128.c
-tests_test_aes128_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-atomic
-tests_test_atomic_SOURCES = tests/test-atomic.c
-tests_test_atomic_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-bundle
-tests_test_bundle_SOURCES = tests/test-bundle.c
-tests_test_bundle_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-classifier
-tests_test_classifier_SOURCES = tests/test-classifier.c
-tests_test_classifier_LDADD = lib/libopenvswitch.la
-
 noinst_PROGRAMS += tests/test-controller
 MAN_ROOTS += tests/test-controller.8.in
 DISTCLEANFILES += tests/test-controller.8
@@ -202,79 +186,6 @@ noinst_man_MANS += tests/test-controller.8
 tests_test_controller_SOURCES = tests/test-controller.c
 tests_test_controller_LDADD = lib/libopenvswitch.la
 
-noinst_PROGRAMS += tests/test-csum
-tests_test_csum_SOURCES = tests/test-csum.c
-tests_test_csum_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-file_name
-tests_test_file_name_SOURCES = tests/test-file_name.c
-tests_test_file_name_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-flows
-tests_test_flows_SOURCES = tests/test-flows.c
-tests_test_flows_LDADD = lib/libopenvswitch.la
-dist_check_SCRIPTS = tests/flowgen.pl
-
-noinst_PROGRAMS += tests/test-hash
-tests_test_hash_SOURCES = tests/test-hash.c
-tests_test_hash_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-hindex
-tests_test_hindex_SOURCES = tests/test-hindex.c
-tests_test_hindex_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-hmap
-tests_test_hmap_SOURCES = tests/test-hmap.c
-tests_test_hmap_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-json
-tests_test_json_SOURCES = tests/test-json.c
-tests_test_json_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-jsonrpc
-tests_test_jsonrpc_SOURCES = tests/test-jsonrpc.c
-tests_test_jsonrpc_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-list
-tests_test_list_SOURCES = tests/test-list.c
-tests_test_list_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-lockfile
-tests_test_lockfile_SOURCES = tests/test-lockfile.c
-tests_test_lockfile_LDADD = lib/libopenvswitch.la
-
-noinst_PROGRAMS += tests/test-multipath

[ovs-dev] [ovstest v2 1/2] unit-test: Add ovstest

2014-04-01 Thread Andy Zhou
Changing one of the files in the Open vSwitch ``lib'' directory
causes 43 binaries to be relinked, which takes a lot of time even with
parallel ``make''.  31 of those binaries are in the ``tests''
directory.  ovs-test attemps to combine most of those binaries into a
single test program that just takes a subcommand name as its first
command-line argument.

The following patch makes use of this infrastructure.

Signed-off-by: Andy Zhou 

--
v1->v2  no change
---
 tests/automake.mk |6 +++
 tests/ovstest.c   |  110 +
 tests/ovstest.h   |   85 +
 3 files changed, 201 insertions(+)
 create mode 100644 tests/ovstest.c
 create mode 100644 tests/ovstest.h

diff --git a/tests/automake.mk b/tests/automake.mk
index 739d79e..fc584d6 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -94,6 +94,7 @@ check-pycov: all tests/atconfig tests/atlocal $(TESTSUITE) 
clean-pycov
 valgrind_wrappers = \
tests/valgrind/ovs-appctl \
tests/valgrind/ovs-ofctl \
+   tests/valgrind/ovstest \
tests/valgrind/ovs-vsctl \
tests/valgrind/ovs-vswitchd \
tests/valgrind/ovsdb-client \
@@ -297,6 +298,11 @@ tests/idltest.ovsidl: $(IDLTEST_IDL_FILES)
 
 tests/idltest.c: tests/idltest.h
 
+noinst_PROGRAMS += tests/ovstest
+tests_ovstest_SOURCES = tests/ovstest.c \
+tests/ovstest.h
+tests_ovstest_LDADD = lib/libopenvswitch.la
+
 noinst_PROGRAMS += tests/test-reconnect
 tests_test_reconnect_SOURCES = tests/test-reconnect.c
 tests_test_reconnect_LDADD = lib/libopenvswitch.la
diff --git a/tests/ovstest.c b/tests/ovstest.c
new file mode 100644
index 000..b8f5bfa
--- /dev/null
+++ b/tests/ovstest.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014 Nicira, Inc.
+ *
+ * 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.
+ */
+
+/* The mother of all test programs that links with libopevswitch.la */
+
+#include 
+#include 
+#include 
+#include 
+#include "command-line.h"
+#include "ovstest.h"
+#include "util.h"
+
+static struct command *commands = NULL;
+static size_t n_commands = 0;
+static size_t allocated_commands = 0;
+
+static void
+add_command(struct command *cmd)
+{
+const struct command nil = {NULL, 0, 0, NULL};
+
+while (n_commands + 1 >= allocated_commands) {
+commands = x2nrealloc(commands, &allocated_commands,
+  sizeof *cmd);
+}
+
+commands[n_commands] = *cmd;
+commands[n_commands + 1] = nil;
+n_commands++;
+}
+
+static void
+list(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+{
+const struct command *p;
+
+for(p = commands; p->name != NULL; p++) {
+printf("%s, %d, %d\n", p->name,p->min_args, p->max_args);
+}
+}
+
+static void
+add_top_level_commands(void)
+{
+struct command help_cmd = {"--help", 0, 0, list};
+
+add_command(&help_cmd);
+}
+
+void
+ovstest_register(const char *test_name, ovstest_func f,
+  const struct command *sub_commands)
+{
+struct command test_cmd;
+int max_args = 0;
+
+if (sub_commands) {
+const struct command *p;
+
+for(p = sub_commands; p->name != NULL; p++) {
+if (p->max_args > max_args) {
+max_args = p->max_args;
+}
+}
+}
+max_args++;  /* adding in the sub program */
+
+test_cmd.name = test_name;
+test_cmd.min_args = 1;
+test_cmd.max_args = max_args;
+test_cmd.handler = f;
+
+add_command(&test_cmd);
+}
+
+static void
+cleanup(void)
+{
+if (allocated_commands) {
+free(commands);
+}
+}
+
+int
+main(int argc, char *argv[])
+{
+set_program_name(argv[0]);
+
+add_top_level_commands();
+if (argc > 1) {
+run_command(argc - 1, argv + 1, commands);
+}
+cleanup();
+
+return 0;
+}
diff --git a/tests/ovstest.h b/tests/ovstest.h
new file mode 100644
index 000..300a0d9
--- /dev/null
+++ b/tests/ovstest.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014 Nicira, Inc.
+ *
+ * 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 

Re: [ovs-dev] [PATCH 4/5] ofproto.at: Fix races in rule eviciton tests

2014-04-01 Thread YAMAMOTO Takashi
>>  # Sleep and modify the one that expires soonest
>> -sleep 2
>> +ovs-appctl time/warp 3000
>>  AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
> 
> at this point, flow table would be:
> hard_timeout=12, in_port=1 actions=drop
> hard_timeout=11, in_port=2 actions=drop
> hard_timeout=13, in_port=3 actions=drop
> hard_timeout=15, in_port=4 actions=drop
> And according to your comment, 1s interval may not be suitable.
> 
> I would like to change (10 + in_port * 2) to (10 + in_port * 3), and warp 
> 4000.
> What do you think?

good point.  i tweaked timeouts and comments.

YAMAMOTO Takashi


commit b048a2bc1e8af76dcc4b2870a76a0b2f02876188
Author: YAMAMOTO Takashi 
Date:   Mon Mar 31 14:04:35 2014 +0900

ofproto.at: Fix races in rule eviciton tests

Bump timeout differences, because timeouts different by 1s might end up
to have the same position in the heap as rule_eviction_priority() uses
1024ms as a unit.

Also, use time/stop to avoid relying on how long an add-flow would take.

These tests were introduced by commit 6d56c1f1.
("ofproto: Update rule's priority in eviction group.")

Signed-off-by: YAMAMOTO Takashi 
Cc: Kmindg G 
Acked-by: Ben Pfaff 

diff --git a/tests/ofproto.at b/tests/ofproto.at
index e98b526..23629c0 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -1375,27 +1375,34 @@ AT_CHECK(
| ${PERL} $srcdir/uuidfilt.pl],
   [0], [<0>
 ])
+ovs-appctl time/stop
 # Add 4 flows.
 for in_port in 4 3 2 1; do
-ovs-ofctl add-flow br0 
hard_timeout=1${in_port},in_port=$in_port,actions=drop
+ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 
3)),in_port=$in_port,actions=drop
 done
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- hard_timeout=11, in_port=1 actions=drop
- hard_timeout=12, in_port=2 actions=drop
- hard_timeout=13, in_port=3 actions=drop
- hard_timeout=14, in_port=4 actions=drop
+ hard_timeout=13, in_port=1 actions=drop
+ hard_timeout=16, in_port=2 actions=drop
+ hard_timeout=19, in_port=3 actions=drop
+ hard_timeout=22, in_port=4 actions=drop
 NXST_FLOW reply:
 ])
 # Sleep and modify the one that expires soonest
-sleep 2
+ovs-appctl time/warp 4000
 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
-sleep 2
+# At this point the table would looks like:
+#  in_port   seconds to expire
+# 113
+# 211
+# 315
+# 418
+ovs-appctl time/warp 2000
 # Adding another flow will cause the one that expires soonest to be evicted.
 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- hard_timeout=11, in_port=1 actions=drop
- hard_timeout=13, in_port=3 actions=drop
- hard_timeout=14, in_port=4 actions=drop
+ hard_timeout=13, in_port=1 actions=drop
+ hard_timeout=19, in_port=3 actions=drop
+ hard_timeout=22, in_port=4 actions=drop
  in_port=5 actions=drop
 NXST_FLOW reply:
 ])
@@ -1414,26 +1421,33 @@ AT_CHECK(
 ])
 # Add 4 flows.
 for in_port in 4 3 2 1; do
-ovs-ofctl add-flow br0 
idle_timeout=1${in_port},in_port=$in_port,actions=drop
+ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 
3)),in_port=$in_port,actions=drop
 done
+ovs-appctl time/stop
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- idle_timeout=11, in_port=1 actions=drop
- idle_timeout=12, in_port=2 actions=drop
- idle_timeout=13, in_port=3 actions=drop
- idle_timeout=14, in_port=4 actions=drop
+ idle_timeout=13, in_port=1 actions=drop
+ idle_timeout=16, in_port=2 actions=drop
+ idle_timeout=19, in_port=3 actions=drop
+ idle_timeout=22, in_port=4 actions=drop
 NXST_FLOW reply:
 ])
 # Sleep and receive on the flow that expires soonest
-sleep 2
+ovs-appctl time/warp 4000
 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
-sleep 2
+# At this point the table would looks like:
+#  in_port   seconds to expire
+# 113
+# 211
+# 315
+# 418
+ovs-appctl time/warp 2000
 # Adding another flow will cause the one that expires soonest to be evicted.
 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- idle_timeout=13, in_port=3 actions=drop
- idle_timeout=14, in_port=4 actions=drop
+ idle_timeout=19, in_port=3 actions=drop
+ idle_timeout=22, in_port=4 actions=drop
  in_port=5 actions=drop
- n_packets=1, n_bytes=60, idle_timeout=11, in_port=1 actions=drop
+ n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
 NXST_FLOW reply:
 ])
 OVS_VSWITCHD_STOP
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH 4/5] ofproto.at: Fix races in rule eviciton tests

2014-04-01 Thread Kmindg G
On Tue, Apr 1, 2014 at 6:20 PM, YAMAMOTO Takashi  wrote:
>>>  # Sleep and modify the one that expires soonest
>>> -sleep 2
>>> +ovs-appctl time/warp 3000
>>>  AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
>>
>> at this point, flow table would be:
>> hard_timeout=12, in_port=1 actions=drop
>> hard_timeout=11, in_port=2 actions=drop
>> hard_timeout=13, in_port=3 actions=drop
>> hard_timeout=15, in_port=4 actions=drop
>> And according to your comment, 1s interval may not be suitable.
>>
>> I would like to change (10 + in_port * 2) to (10 + in_port * 3), and warp 
>> 4000.
>> What do you think?
>
> good point.  i tweaked timeouts and comments.
>
> YAMAMOTO Takashi
>
>
> commit b048a2bc1e8af76dcc4b2870a76a0b2f02876188
> Author: YAMAMOTO Takashi 
> Date:   Mon Mar 31 14:04:35 2014 +0900
>
> ofproto.at: Fix races in rule eviciton tests
>
> Bump timeout differences, because timeouts different by 1s might end up
> to have the same position in the heap as rule_eviction_priority() uses
> 1024ms as a unit.
>
> Also, use time/stop to avoid relying on how long an add-flow would take.
>
> These tests were introduced by commit 6d56c1f1.
> ("ofproto: Update rule's priority in eviction group.")
>
> Signed-off-by: YAMAMOTO Takashi 
> Cc: Kmindg G 
> Acked-by: Ben Pfaff 
>
> diff --git a/tests/ofproto.at b/tests/ofproto.at
> index e98b526..23629c0 100644
> --- a/tests/ofproto.at
> +++ b/tests/ofproto.at
> @@ -1375,27 +1375,34 @@ AT_CHECK(
> | ${PERL} $srcdir/uuidfilt.pl],
>[0], [<0>
>  ])
> +ovs-appctl time/stop
>  # Add 4 flows.
>  for in_port in 4 3 2 1; do
> -ovs-ofctl add-flow br0 
> hard_timeout=1${in_port},in_port=$in_port,actions=drop
> +ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 
> 3)),in_port=$in_port,actions=drop
>  done
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - hard_timeout=11, in_port=1 actions=drop
> - hard_timeout=12, in_port=2 actions=drop
> - hard_timeout=13, in_port=3 actions=drop
> - hard_timeout=14, in_port=4 actions=drop
> + hard_timeout=13, in_port=1 actions=drop
> + hard_timeout=16, in_port=2 actions=drop
> + hard_timeout=19, in_port=3 actions=drop
> + hard_timeout=22, in_port=4 actions=drop
>  NXST_FLOW reply:
>  ])
>  # Sleep and modify the one that expires soonest
> -sleep 2
> +ovs-appctl time/warp 4000
>  AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
> -sleep 2
> +# At this point the table would looks like:
> +#  in_port   seconds to expire
> +# 113
> +# 211
This seems to be 12s to expire. And I realize that I made a mistake
about warp 4000.
It should be warp 5000 or even bigger.
I'm so sorry to bother you so many times.  I probably need a rest.
Thanks for all your work.

> +# 315
> +# 418
> +ovs-appctl time/warp 2000
>  # Adding another flow will cause the one that expires soonest to be evicted.
>  AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - hard_timeout=11, in_port=1 actions=drop
> - hard_timeout=13, in_port=3 actions=drop
> - hard_timeout=14, in_port=4 actions=drop
> + hard_timeout=13, in_port=1 actions=drop
> + hard_timeout=19, in_port=3 actions=drop
> + hard_timeout=22, in_port=4 actions=drop
>   in_port=5 actions=drop
>  NXST_FLOW reply:
>  ])
> @@ -1414,26 +1421,33 @@ AT_CHECK(
>  ])
>  # Add 4 flows.
>  for in_port in 4 3 2 1; do
> -ovs-ofctl add-flow br0 
> idle_timeout=1${in_port},in_port=$in_port,actions=drop
> +ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 
> 3)),in_port=$in_port,actions=drop
>  done
> +ovs-appctl time/stop
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - idle_timeout=11, in_port=1 actions=drop
> - idle_timeout=12, in_port=2 actions=drop
> - idle_timeout=13, in_port=3 actions=drop
> - idle_timeout=14, in_port=4 actions=drop
> + idle_timeout=13, in_port=1 actions=drop
> + idle_timeout=16, in_port=2 actions=drop
> + idle_timeout=19, in_port=3 actions=drop
> + idle_timeout=22, in_port=4 actions=drop
>  NXST_FLOW reply:
>  ])
>  # Sleep and receive on the flow that expires soonest
> -sleep 2
> +ovs-appctl time/warp 4000
>  AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
> -sleep 2
> +# At this point the table would looks like:
> +#  in_port   seconds to expire
> +# 113
> +# 211
> +# 315
> +# 418
> +ovs-appctl time/warp 2000
>  # Adding another flow will cause the one that expires soonest to be evicted.
>  AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - idle_timeout=13, in_port=3 actions=drop
> - idle_timeout=14, in_port=4 actions=drop
> + idle_timeout=19, in_port=3 actions=drop
> + idle_timeout=22, in_port=4 actions=drop
>   in_port=5 actions=drop
> - n_packets=1, n_bytes=60, idle_timeout=11, in_port=1 

Re: [ovs-dev] hackathon idea list

2014-04-01 Thread Alexandru Copot
On Mar 28, 2014 11:27 PM, "Ben Pfaff"  wrote:
>
> On Fri, Mar 28, 2014 at 09:24:42PM +0200, Alexandru Copot wrote:
> > On Wed, Mar 26, 2014 at 7:11 AM, Ben Pfaff  wrote:
> >
> > > OpenFlow 1.4 Role Status Message
> > > 
> > >
> > > OpenFlow 1.4 section 7.4.4 ``Controller Role Status Message''
> > > defines a new message sent by a switch to notify the controller that
> > > its role (whether it is a master or a slave) has changed. OVS should
> > > implement this.
> >
> > The spec mentions at least 2 reasons to send this: when another controller
> > asks for a role change and when the configuration of the switch has changed.
> > For the first one I've done an implementation on the previous hackathon.
> > However, I don't see how can we change the role of a controller locally.
> > The database is updated with the OpenFlow connection state. Do we also
> > need to add an option to do this in reverse ?
>
> OVS doesn't have any configuration of the kind that the spec talks
> about, so there's nothing to do.

Good to know. That was what I was wondering about.

> The database only provide a status report, not a means for changing
> the role.
>
> Are you saying that OVS already implements this?  If so, then I'll
> delete the item from OPENFLOW-1.1+ and from my to-do list.

It seems so. I think I didn't update OPENFLOW-1.1+ because I wasn't
sure the feature was complete.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [RFC PATCH 4/4] lib/ofpbuf: Compact

2014-04-01 Thread Lori Jakab

On 3/26/14, 2:16 AM, Ben Pfaff wrote:

On Mon, Mar 24, 2014 at 10:59:06AM -0700, Jarno Rajahalme wrote:

This patch shrinks the struct ofpbuf from 104 to 48 bytes on 64-bit
systems, or from 52 to 36 bytes on 32-bit systems (counting in the
'l7' removal by the previous patch).  This may help contribute to
cache efficiency, and will speed up initializing, copying and
manipulating ofpbufs.  This is potentially important for the DPDK
datapath, but the rest of the code base may also see a little benefit.

Changes are:

- Remove 'l7' pointer (previous patch).
- Use offsets instead of layer pointers for l2_5, l3, and l4 using
   'l2' as basis.  Usually 'data' is the same as 'l2', but this is not
   always the case (e.g., when parsing or constructing a packet), so it
   can not be easily used as the offset basis.  Also, packet parsing is
   faster if we do not need to maintain the offsets each time we pull
   data from the ofpbuf.
- Use uint32_t for 'allocated' and 'size', as 2^32 is enough even for
   largest possible messages/packets.
- Use packed enum for 'source'.
- Rearrange to avoid unnecessary padding.
- Remove 'private_p', which was used only in two cases, both of which
   had the invariant ('l2' == 'data'), so we can temporarily use 'l2'
   as a private pointer.

Signed-off-by: Jarno Rajahalme 


Unfotunately I missed this patch until rebasing my layer 3 patch series 
[1] today.


Before this patch, I set the 'l2' pointer to NULL and 'l3' to the start 
of the network header to represent a layer 3 packet in a struct ofpbuf.  
The way struct ofpbuf looks after this patch makes the assumption of 
always having layer 2 headers a lot stronger.


I see two options for my patches going forward:
1) Add back 'l3' and remove 'l3_ofs' from struct ofpbuf (keeping the 
rest as is); or
2) Encode a layer 3 packet by setting 'l2' to the network header address 
and set l3_ofs to 0.


IMHO option 2 is not elegant, so I would prefer to avoid it.  Are you OK 
with option 1?  Is there a better way I didn't think about?


-Lori

[1] https://github.com/ljakab/openvswitch/tree/l3_v3
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH 4/5] ofproto.at: Fix races in rule eviciton tests

2014-04-01 Thread YAMAMOTO Takashi
>> +ovs-appctl time/warp 4000
>>  AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
>> -sleep 2
>> +# At this point the table would looks like:
>> +#  in_port   seconds to expire
>> +# 113
>> +# 211
> This seems to be 12s to expire. And I realize that I made a mistake
> about warp 4000.
> It should be warp 5000 or even bigger.
> I'm so sorry to bother you so many times.  I probably need a rest.
> Thanks for all your work.

apparently this math is too difficult for us. :-)

YAMAMOTO Takashi

commit 06f0a9e0e4da144e0bdc3a3b49d5f2572f67c626
Author: YAMAMOTO Takashi 
Date:   Mon Mar 31 14:04:35 2014 +0900

ofproto.at: Fix races in rule eviciton tests

Bump timeout differences, because timeouts different by 1s might end up
to have the same position in the heap as rule_eviction_priority() uses
1024ms as a unit.

Also, use time/stop to avoid relying on how long an add-flow would take.

These tests were introduced by commit 6d56c1f1.
("ofproto: Update rule's priority in eviction group.")

Signed-off-by: YAMAMOTO Takashi 
Cc: Kmindg G 
Acked-by: Ben Pfaff 

diff --git a/tests/ofproto.at b/tests/ofproto.at
index e98b526..de2d004 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -1375,27 +1375,34 @@ AT_CHECK(
| ${PERL} $srcdir/uuidfilt.pl],
   [0], [<0>
 ])
+ovs-appctl time/stop
 # Add 4 flows.
 for in_port in 4 3 2 1; do
-ovs-ofctl add-flow br0 
hard_timeout=1${in_port},in_port=$in_port,actions=drop
+ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 
3)),in_port=$in_port,actions=drop
 done
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- hard_timeout=11, in_port=1 actions=drop
- hard_timeout=12, in_port=2 actions=drop
- hard_timeout=13, in_port=3 actions=drop
- hard_timeout=14, in_port=4 actions=drop
+ hard_timeout=13, in_port=1 actions=drop
+ hard_timeout=16, in_port=2 actions=drop
+ hard_timeout=19, in_port=3 actions=drop
+ hard_timeout=22, in_port=4 actions=drop
 NXST_FLOW reply:
 ])
 # Sleep and modify the one that expires soonest
-sleep 2
+ovs-appctl time/warp 5000
 AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
-sleep 2
+# At this point the table would looks like:
+#  in_port   seconds to expire
+# 113
+# 211
+# 314
+# 417
+ovs-appctl time/warp 2000
 # Adding another flow will cause the one that expires soonest to be evicted.
 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- hard_timeout=11, in_port=1 actions=drop
- hard_timeout=13, in_port=3 actions=drop
- hard_timeout=14, in_port=4 actions=drop
+ hard_timeout=13, in_port=1 actions=drop
+ hard_timeout=19, in_port=3 actions=drop
+ hard_timeout=22, in_port=4 actions=drop
  in_port=5 actions=drop
 NXST_FLOW reply:
 ])
@@ -1414,26 +1421,33 @@ AT_CHECK(
 ])
 # Add 4 flows.
 for in_port in 4 3 2 1; do
-ovs-ofctl add-flow br0 
idle_timeout=1${in_port},in_port=$in_port,actions=drop
+ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 
3)),in_port=$in_port,actions=drop
 done
+ovs-appctl time/stop
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- idle_timeout=11, in_port=1 actions=drop
- idle_timeout=12, in_port=2 actions=drop
- idle_timeout=13, in_port=3 actions=drop
- idle_timeout=14, in_port=4 actions=drop
+ idle_timeout=13, in_port=1 actions=drop
+ idle_timeout=16, in_port=2 actions=drop
+ idle_timeout=19, in_port=3 actions=drop
+ idle_timeout=22, in_port=4 actions=drop
 NXST_FLOW reply:
 ])
 # Sleep and receive on the flow that expires soonest
-sleep 2
+ovs-appctl time/warp 5000
 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
-sleep 2
+# At this point the table would looks like:
+#  in_port   seconds to expire
+# 113
+# 211
+# 314
+# 417
+ovs-appctl time/warp 2000
 # Adding another flow will cause the one that expires soonest to be evicted.
 AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
- idle_timeout=13, in_port=3 actions=drop
- idle_timeout=14, in_port=4 actions=drop
+ idle_timeout=19, in_port=3 actions=drop
+ idle_timeout=22, in_port=4 actions=drop
  in_port=5 actions=drop
- n_packets=1, n_bytes=60, idle_timeout=11, in_port=1 actions=drop
+ n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
 NXST_FLOW reply:
 ])
 OVS_VSWITCHD_STOP
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH 5/5] ofproto-dpif.at: Sprinkle --overwrite-pidfile

2014-04-01 Thread YAMAMOTO Takashi
>> On Mon, Mar 31, 2014 at 03:24:31PM +0900, YAMAMOTO Takashi wrote:
>>> These tests invokes ovs-ofctl monitor twice or more.
>>> Because "ovs-appctl -t ofctl exit" does not wait for the target
>>> process exit, there are chances to see the pid file from the previous
>>> incarnation.
>>> 
>>> Signed-off-by: YAMAMOTO Takashi 
>> 
>> Good catch.
>> 
>> As an alternative, one could OVS_WAIT_UNTIL the pidfile disappears.
> 
> it sounds like a better solution.  i'll take a look.
> 
> YAMAMOTO Takashi

here's a patch.

i guess someone familiar with m4 can create
OVS_APP_EXIT_AND_WAIT(appname) macro.

YAMAMOTO Takashi

commit 7427b8bf4f2402fe132522ce8142a7d896a371c6
Author: YAMAMOTO Takashi 
Date:   Mon Mar 31 15:11:19 2014 +0900

ofproto-dpif.at: Wait for the monitor's pidfile disappears where necessary

These tests invokes ovs-ofctl monitor twice or more.
Because "ovs-appctl -t ofctl exit" does not wait for the target
process exit, there are chances to see the pid file from the previous
incarnation.

The way to wait for the completion of the previous incarnation was
suggested by Ben Pfaff.

Signed-off-by: YAMAMOTO Takashi 
Acked-by: Ben Pfaff 

diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index d2234e9..b020cf6 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -619,6 +619,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via 
action) data_len=60 (unbuffered)
@@ -682,6 +683,7 @@ for i in 1 2 3 ; do
 ovs-appctl netdev-dummy/receive p1 
'in_port(1),eth(src=10:11:11:11:11:11,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(0x010)'
 done
 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 ])
@@ -840,6 +842,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 
(unbuffered)
@@ -860,6 +863,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 
(unbuffered)
@@ -880,6 +884,7 @@ for i in 1 2 3 ; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 
(unbuffered)
@@ -900,6 +905,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) 
data_len=64 (unbuffered)
@@ -920,6 +926,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) 
data_len=64 (unbuffered)
@@ -940,6 +947,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) 
data_len=60 (unbuffered)
@@ -962,6 +970,7 @@ for i in 1 2 3; do
 done
 
 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) 
data_len=64 (unbuffered)
 
mpls,metadata=0,in_port=0,vlan_tci=0x,dl_src=40:44:44:44:44:43,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=46912
@@ -981,6 +990,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) 
data_len=64 (unbuffered)
@@ -1001,6 +1011,7 @@ for i in 1 2 3; do
 done
 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
 ovs-appctl -t ovs-ofctl exit
+OVS_WAIT_WHILE([test -e ovs-ofctl.pid])
 
 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
 NXT_PACKET_IN (

[ovs-dev] [PATCH] datapath: Add support for kernels 3.13 and 3.14

2014-04-01 Thread Kyle Mestery
Add support for building the in-tree kernel datapath for Linux kernels up to
3.14. There were some changes in the netlink area which required adding new
compatibility code for this layer. Also, some new per-cpu stats initialization
code was added.

Encompasses changes from the following upstream Linux kernel commits as well:
36d5fe6a000790f56039afe26834265db0a3ad4c: "core, nfqueue, openvswitch: Orphan
frags in skb_zerocopy and handle errors"
63862b5bef7349dd1137e4c70702c67d77565785: "net: replace macros net_random and
net_srandom with direct calls to prandom"

Signed-off-by: Kyle Mestery 
---
v4: Add support Linux 3.14 as well.
Handle a few more changes based on upstream commits.
v3: Correctly make genl_register_family backwards compatible.

v2: Address a few comments from Pravin. Some of those comments
proved challenging, please see email reply to the list.
---
 FAQ   |  2 +-
 acinclude.m4  |  4 +-
 datapath/actions.c|  2 +-
 datapath/datapath.c   | 36 +-
 datapath/datapath.h   |  2 +-
 datapath/dp_notify.c  | 11 ++-
 datapath/linux/Modules.mk |  2 +
 datapath/linux/compat/genetlink-openvswitch.c | 20 --
 datapath/linux/compat/include/linux/percpu.h  | 18 +
 datapath/linux/compat/include/linux/random.h  | 12 
 datapath/linux/compat/include/linux/skbuff.h  |  2 +-
 datapath/linux/compat/include/net/genetlink.h | 96 ++-
 datapath/linux/compat/include/net/ip.h| 12 
 datapath/linux/compat/skbuff-openvswitch.c|  6 +-
 datapath/linux/compat/utils.c | 29 
 datapath/vport-lisp.c |  7 +-
 datapath/vport-vxlan.c|  3 +-
 datapath/vport.c  |  2 +
 18 files changed, 224 insertions(+), 42 deletions(-)
 create mode 100644 datapath/linux/compat/include/linux/percpu.h
 create mode 100644 datapath/linux/compat/include/linux/random.h

diff --git a/FAQ b/FAQ
index eec2d4f..b376320 100644
--- a/FAQ
+++ b/FAQ
@@ -149,7 +149,7 @@ A: The following table lists the Linux kernel versions 
against which the
1.11.x 2.6.18 to 3.8
2.0.x  2.6.32 to 3.10
2.1.x  2.6.32 to 3.11
-   2.2.x  2.6.32 to 3.12
+   2.2.x  2.6.32 to 3.14
 
Open vSwitch userspace should also work with the Linux kernel module
built into Linux 3.3 and later.
diff --git a/acinclude.m4 b/acinclude.m4
index 1f52cf1..5630213 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -134,10 +134,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [
 AC_MSG_RESULT([$kversion])
 
 if test "$version" -ge 3; then
-   if test "$version" = 3 && test "$patchlevel" -le 12; then
+   if test "$version" = 3 && test "$patchlevel" -le 13; then
   : # Linux 3.x
else
- AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 
newer than 3.12.x is not supported])
+ AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version 
newer than 3.14.x is not supported])
fi
 else
if test "$version" -le 1 || test "$patchlevel" -le 5 || test 
"$sublevel" -le 31; then
diff --git a/datapath/actions.c b/datapath/actions.c
index 0b66e7c..59c5855 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -446,7 +446,7 @@ static int sample(struct datapath *dp, struct sk_buff *skb,
 a = nla_next(a, &rem)) {
switch (nla_type(a)) {
case OVS_SAMPLE_ATTR_PROBABILITY:
-   if (net_random() >= nla_get_u32(a))
+   if (prandom_u32() >= nla_get_u32(a))
return 0;
break;
 
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 0c77045..49402c3 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -70,14 +70,16 @@ static bool ovs_must_notify(struct genl_info *info,
const struct genl_multicast_group *grp)
 {
return info->nlhdr->nlmsg_flags & NLM_F_ECHO ||
-   netlink_has_listeners(genl_info_net(info)->genl_sock, grp->id);
+   netlink_has_listeners_ovs(genl_info_net(info)->genl_sock, grp, 
0);
 }
 
+static struct genl_family dp_packet_genl_family;
+
 static void ovs_notify(struct sk_buff *skb, struct genl_info *info,
   struct genl_multicast_group *grp)
 {
-   genl_notify(skb, genl_info_net(info), info->snd_portid,
-   grp->id, info->nlhdr, GFP_KERNEL);
+   genl_notify(&dp_packet_genl_family, skb, genl_info_net(info),
+   info->snd_portid, 0, info->nlhdr, GFP_KERNEL);
 }
 
 /**
@@ -479,7 +481,9 @@ static int queue_userspace_packet(struct datapath *dp, 
struct sk_buff *skb,
}
nla->nla_len = nla_attr_size(skb->len);
 
-   skb_zerocopy(user_skb, skb, skb->len, h

Re: [ovs-dev] [RFC PATCH 4/4] lib/ofpbuf: Compact

2014-04-01 Thread Ben Pfaff
On Tue, Apr 01, 2014 at 03:14:16PM +0300, Lori Jakab wrote:
> On 3/26/14, 2:16 AM, Ben Pfaff wrote:
> >On Mon, Mar 24, 2014 at 10:59:06AM -0700, Jarno Rajahalme wrote:
> >>This patch shrinks the struct ofpbuf from 104 to 48 bytes on 64-bit
> >>systems, or from 52 to 36 bytes on 32-bit systems (counting in the
> >>'l7' removal by the previous patch).  This may help contribute to
> >>cache efficiency, and will speed up initializing, copying and
> >>manipulating ofpbufs.  This is potentially important for the DPDK
> >>datapath, but the rest of the code base may also see a little benefit.
> >>
> >>Changes are:
> >>
> >>- Remove 'l7' pointer (previous patch).
> >>- Use offsets instead of layer pointers for l2_5, l3, and l4 using
> >>   'l2' as basis.  Usually 'data' is the same as 'l2', but this is not
> >>   always the case (e.g., when parsing or constructing a packet), so it
> >>   can not be easily used as the offset basis.  Also, packet parsing is
> >>   faster if we do not need to maintain the offsets each time we pull
> >>   data from the ofpbuf.
> >>- Use uint32_t for 'allocated' and 'size', as 2^32 is enough even for
> >>   largest possible messages/packets.
> >>- Use packed enum for 'source'.
> >>- Rearrange to avoid unnecessary padding.
> >>- Remove 'private_p', which was used only in two cases, both of which
> >>   had the invariant ('l2' == 'data'), so we can temporarily use 'l2'
> >>   as a private pointer.
> >>
> >>Signed-off-by: Jarno Rajahalme 
> 
> Unfotunately I missed this patch until rebasing my layer 3 patch
> series [1] today.
> 
> Before this patch, I set the 'l2' pointer to NULL and 'l3' to the
> start of the network header to represent a layer 3 packet in a
> struct ofpbuf.  The way struct ofpbuf looks after this patch makes
> the assumption of always having layer 2 headers a lot stronger.
> 
> I see two options for my patches going forward:
> 1) Add back 'l3' and remove 'l3_ofs' from struct ofpbuf (keeping the
> rest as is); or
> 2) Encode a layer 3 packet by setting 'l2' to the network header
> address and set l3_ofs to 0.

Can we do the following?
3) Replace 'l2' by 'l2_ofs' also?
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [RFC PATCH 4/4] lib/ofpbuf: Compact

2014-04-01 Thread Jarno Rajahalme


Sent from my iPhone

> On Apr 1, 2014, at 7:27 AM, Ben Pfaff  wrote:
> 
>> On Tue, Apr 01, 2014 at 03:14:16PM +0300, Lori Jakab wrote:
>>> On 3/26/14, 2:16 AM, Ben Pfaff wrote:
 On Mon, Mar 24, 2014 at 10:59:06AM -0700, Jarno Rajahalme wrote:
 This patch shrinks the struct ofpbuf from 104 to 48 bytes on 64-bit
 systems, or from 52 to 36 bytes on 32-bit systems (counting in the
 'l7' removal by the previous patch).  This may help contribute to
 cache efficiency, and will speed up initializing, copying and
 manipulating ofpbufs.  This is potentially important for the DPDK
 datapath, but the rest of the code base may also see a little benefit.
 
 Changes are:
 
 - Remove 'l7' pointer (previous patch).
 - Use offsets instead of layer pointers for l2_5, l3, and l4 using
  'l2' as basis.  Usually 'data' is the same as 'l2', but this is not
  always the case (e.g., when parsing or constructing a packet), so it
  can not be easily used as the offset basis.  Also, packet parsing is
  faster if we do not need to maintain the offsets each time we pull
  data from the ofpbuf.
 - Use uint32_t for 'allocated' and 'size', as 2^32 is enough even for
  largest possible messages/packets.
 - Use packed enum for 'source'.
 - Rearrange to avoid unnecessary padding.
 - Remove 'private_p', which was used only in two cases, both of which
  had the invariant ('l2' == 'data'), so we can temporarily use 'l2'
  as a private pointer.
 
 Signed-off-by: Jarno Rajahalme 
>> 
>> Unfotunately I missed this patch until rebasing my layer 3 patch
>> series [1] today.
>> 
>> Before this patch, I set the 'l2' pointer to NULL and 'l3' to the
>> start of the network header to represent a layer 3 packet in a
>> struct ofpbuf.  The way struct ofpbuf looks after this patch makes
>> the assumption of always having layer 2 headers a lot stronger.
>> 
>> I see two options for my patches going forward:
>> 1) Add back 'l3' and remove 'l3_ofs' from struct ofpbuf (keeping the
>> rest as is); or
>> 2) Encode a layer 3 packet by setting 'l2' to the network header
>> address and set l3_ofs to 0.
> 
> Can we do the following?
>3) Replace 'l2' by 'l2_ofs' also?

I'll look into this today. However, my earlier analysis was that this would 
complicate things when the offset basis ('data') is changing a lot (e.g., when 
pulling data from ofpbuf). Maybe the cleanest solution would be to have a 
pointer to the start of packet and an additional l2 offset. However, as 0 is a 
valid offset value, having a separate l2 offset seems redundant as l3_ofs 0 
would be an unambiguous way of encoding the absence of the l2 header.

  Jarno
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] rhel: Add Patch Port support to initscripts

2014-04-01 Thread Gurucharan Shetty
On Mon, Mar 31, 2014 at 4:34 PM, Jason Kölker  wrote:
> Allows setting up type=patch ports through sysconfig ifcfg-* files.
>
> Signed-off-by: Jason Kölker 
Thank you for the patch. Looks good to me.
I added you to AUTHORS and applied it on master.

> ---
>  rhel/README.RHEL  | 25 +
>  rhel/etc_sysconfig_network-scripts_ifdown-ovs |  3 +++
>  rhel/etc_sysconfig_network-scripts_ifup-ovs   |  4 
>  3 files changed, 32 insertions(+)
>
> diff --git a/rhel/README.RHEL b/rhel/README.RHEL
> index cb6ab88..2620674 100644
> --- a/rhel/README.RHEL
> +++ b/rhel/README.RHEL
> @@ -25,6 +25,8 @@ assignments.  The following OVS-specific variable names are 
> supported:
>
>  * "OVSTunnel", if  is an OVS tunnel.
>
> +* "OVSPatchPort", if  is a patch port
> +
>  - OVS_BRIDGE: If TYPE is anything other than "OVSBridge", set to
>the name of the OVS bridge to which the port should be attached.
>
> @@ -47,6 +49,9 @@ assignments.  The following OVS-specific variable names are 
> supported:
>  - OVS_TUNNEL_OPTIONS: For "OVSTunnel" interfaces, this field should be
>used to specify the tunnel options like remote_ip, key, etc.
>
> +- OVS_PATCH_PEER: For "OVSPatchPort" devices, this field specifies
> +  the patch's peer on the other bridge.
> +
>  Note
>  
>
> @@ -182,6 +187,26 @@ OVS_BRIDGE=ovsbridge0
>  OVS_TUNNEL_TYPE=gre
>  OVS_TUNNEL_OPTIONS="options:remote_ip=A.B.C.D"
>
> +
> +Patch Ports:
> +
> +==> ifcfg-patch-ovs-0 <==
> +DEVICE=patch-ovs-0
> +ONBOOT=yes
> +DEVICETYPE=ovs
> +TYPE=OVSPatchPort
> +OVS_BRIDGE=ovsbridge0
> +OVS_PATCH_PEER=patch-ovs-1
> +
> +==> ifcfg-patch-ovs-1 <==
> +DEVICE=patch-ovs-1
> +ONBOOT=yes
> +DEVICETYPE=ovs
> +TYPE=OVSPatchPort
> +OVS_BRIDGE=ovsbridge1
> +OVS_PATCH_PEER=patch-ovs-0
> +
> +
>  Reporting Bugs
>  --
>
> diff --git a/rhel/etc_sysconfig_network-scripts_ifdown-ovs 
> b/rhel/etc_sysconfig_network-scripts_ifdown-ovs
> index daa5786..6e96d62 100755
> --- a/rhel/etc_sysconfig_network-scripts_ifdown-ovs
> +++ b/rhel/etc_sysconfig_network-scripts_ifdown-ovs
> @@ -56,6 +56,9 @@ case "$TYPE" in
> retval=$?
> ovs-vsctl -t ${TIMEOUT} -- --if-exists del-port "$OVS_BRIDGE" 
> "$DEVICE"
> ;;
> +   OVSPatchPort)
> +   ovs-vsctl -t ${TIMEOUT} -- --if-exists del-port "$OVS_BRIDGE" 
> "$DEVICE"
> +   ;;
> *)
> echo $"Invalid OVS interface type $TYPE"
> exit 1
> diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs 
> b/rhel/etc_sysconfig_network-scripts_ifup-ovs
> index 0ee7b21..45143f6 100755
> --- a/rhel/etc_sysconfig_network-scripts_ifup-ovs
> +++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs
> @@ -136,6 +136,10 @@ case "$TYPE" in
> ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" 
> "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=$OVS_TUNNEL_TYPE 
> $OVS_TUNNEL_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
> ${OTHERSCRIPT} ${CONFIG} ${2}
> ;;
> +   OVSPatchPort)
> +   ifup_ovs_bridge
> +   ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" 
> "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=patch 
> options:peer=${OVS_PATCH_PEER} ${OVS_EXTRA+-- $OVS_EXTRA}
> +   ;;
> *)
> echo $"Invalid OVS interface type $TYPE"
> exit 1
> --
> 1.9.0
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] VMware User Community

2014-04-01 Thread Kathleen MacLeod
Hi,

 

As a leading database provider, I was inquisitive to check if you would be
interested in owning a list of companies using VMware that can be used for
your marketing campaigns? These lists can be customized based on
application, geography, titles and more.

 

Some of the other Virtualization users include:

 

. Virtual Bridges users

. Citrix users 

. MS Hyper V users

. Redhat

. Oracle Solaris users

. IBM

. Parallels

. Amazon EC2 and many more

 

We have some authentic data of other CRM, PLM, BI software users too; we can
help you if you have a similar niche market to target.  Let me know if you
would be interested in seeing a sample and getting more info on our
authentic lists. 

 

Do you need anything custom to reach your prospects? We can help you
virtually with anything on the data front, be it industry specific, title
specific and any such parameters.  Reach out with your specific requirement
and get a set of free samples.

 

If you are not the right person to discuss this please forward this email to
the right person in your organization. 

 

I look forward to hearing from you.

 

Kind Regards,

 

Kathleen MacLeod 

Data Consultant

HDS-DB 
75 Federal Street, 14th Floor
Boston, MA 02110

 

  _  

We respect your privacy. If you don't wish to receive an email from us,
please send a reply with an email subject line as "Leave out".

 

 

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [bond megaflow v4 4/4 rebased] ofproto/bond: Implement bond megaflow using recirculation

2014-04-01 Thread Andy Zhou
On Mon, Mar 31, 2014 at 9:11 PM, Simon Horman  wrote:
> On Tue, Mar 25, 2014 at 01:48:39PM -0700, Andy Zhou wrote:
>> Infrastructure to enable megaflow support for bond ports using
>> recirculation. This patch adds the following features:
>> * Generate RECIRC action when bond can benefit from recirculation.
>> * Populate post recirculation rules in a hidden table. Currently table 254.
>> * Uses post recirculation rules for bond rebalancing
>> * A recirculation implementation in dpif-netdev.
>>
>> Signed-off-by: Andy Zhou 
>
> Hi Andy,
>
> it appears that this does not apply cleanly,
> Would you care to rebase it (again)?
Yes. master moves fast these days. I will rebase and post v5 soon.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v2] bridge: don't bring up internal ports by default.

2014-04-01 Thread Flavio Leitner
On Mon, Mar 31, 2014 at 01:19:39PM -0700, Ben Pfaff wrote:
> On Tue, Mar 25, 2014 at 02:50:17PM -0300, Flavio Leitner wrote:
> > It should be an administrator task to bring up devices as they
> > are configured properly.
> > 
> > Currently, Fedora is deleting the bridges when the interface is
> > brought down. Therefore, there is no bridge on the next boot and
> > the initscripts can apply the networking configuration properly
> > for a new bridge.
> > 
> > However, if the system didn't execute ifdown for some reason, the
> > bridge is left in the ovsdb and since internal ports are brought
> > up by default, there is no way for initscripts to known if the
> > adminitrator has configured it or not already.
> > 
> > This patch partially reverts the commit
> > bef071a5fdf8e2dd87677b04b3cf7a8f5094edcb
> > 
> > Signed-off-by: Flavio Leitner 
> 
> I think you're right, that this is correct, but let's put the NEWS
> item at the top and give a little more explanation, something like
> this:
> 
>- Internal ports are no longer brought up by default, because it should be
>  an administrator task to bring up devices as they are configured 
> properly.
> 
> This is almost certain to break some people's setups, but I guess it's
> better than what we do now.
> 
> Please give a title when referring to a commit in a log message, e.g.:
> 
>  This patch partially reverts the commit
> bef071a5fdf8e2dd87677b04b3cf7a8f5094edcb (bridge: Always "up" internal
> devices.).
> 
> Finally, I would have just fixed all of the above and pushed it,
> except that it also breaks half a dozen tests in the testsuite.
> Please fix those and submit a v3.

Sure, I will fix the patch with your suggestions and post a v3.

Thank for reviewing it.
fbl
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] openvswitch 2.1 on openSUSE13.1 - ovsbd-server enters infinite loop

2014-04-01 Thread Karol Mroz
Hello,

I'm experiencing a problem starting openvswitch 2.1 on an openSUSE13.1
(kernel version 3.11.10) system. Specifically, ovsdb-server enters an
infinite loop during logging bringup.

When setting up logging levels for the various vlog_modules (please
see lib/vlog.c:set_facility_level() and lib/vlog.c:vlog_set_log_file())
the lib/list.h:LIST_FOR_EACH macro iterates over a doubly linked
list which in our case enters a final condition where prev==next and never
terminates.

>From gdb, the structure in this condition looks like the following:

(gdb) p *mp
$7 = {list = {prev = 0x6085a0 ,
   next = 0x6085a0 }, name = 0x406699 "ovsdb_server",
   levels = {4, 1, 4}, min_level = 4, honor_rate_limits = true}

Since mp->list.next never hits NULL, LIST_FOR_EACH never terminates.

ovsdb-server is brought up in the following manner:

ovsdb-server /etc/openvswitch/conf.db -vconsole:emer -vsyslog:err
-vfile:info --remote=punix:/var/run/openvswitch/db.sock
--private-key=db:Open_vSwitch,SSL,private_key
--certificate=db:Open_vSwitch,SSL,certificate
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --no-chdir
--log-file=/var/log/openvswitch/ovsdb-server.log
--pidfile=/var/run/openvswitch/ovsdb-server.pid --detach --monitor

To work around the problem, I cooked up this quick macro and have
successfully brought up the openvswitch service, added a bridge and port.

I'm curious if anyone has hit this kind of problem? Also, any input on this
workaround from someone here who is familiar with this code path would
be very helpful.

Thanks,
-Karol

Index: lib/vlog.c
===
--- lib/vlog.c.orig
+++ lib/vlog.c
@@ -227,7 +227,7 @@ set_facility_level(enum vlog_facility fa
 ovs_mutex_lock(&log_file_mutex);
 if (!module) {
 struct vlog_module *mp;
-LIST_FOR_EACH (mp, list, &vlog_modules) {
+LIST_FOR_EACH_CHECK (mp, list, &vlog_modules) {
 mp->levels[facility] = level;
 update_min_level(mp);
 }
@@ -347,7 +347,7 @@ vlog_set_log_file(const char *file_name)
 log_writer = async_append_create(new_log_fd);
 }
 
-LIST_FOR_EACH (mp, list, &vlog_modules) {
+LIST_FOR_EACH_CHECK (mp, list, &vlog_modules) {
 update_min_level(mp);
 }
 ovs_mutex_unlock(&log_file_mutex);
Index: lib/list.h
===
--- lib/list.h.orig
+++ lib/list.h
@@ -79,5 +79,9 @@ bool list_is_short(const struct list *);
   ? ASSIGN_CONTAINER(NEXT, (ITER)->MEMBER.next, MEMBER), 1 \
   : 0);\
  (ITER) = (NEXT))
+#define LIST_FOR_EACH_CHECK(ITER, MEMBER, LIST)  \
+for (ASSIGN_CONTAINER(ITER, (LIST)->next, MEMBER);   \
+ &(ITER)->MEMBER != (LIST) && (ITER)->MEMBER.next != (ITER)->MEMBER.prev;\
+ ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.next, MEMBER))
 
 #endif /* list.h */
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] openvswitch: supply a dummy err_handler of gre_cisco_protocol to prevent kernel crash

2014-04-01 Thread Jesse Gross
On Tue, Apr 1, 2014 at 8:24 AM, wei zhang  wrote:
> At 2014-04-01 08:49:53,"Jesse Gross"  wrote:
>>On Sun, Mar 30, 2014 at 5:12 AM, wei zhang  wrote:
>>> At 2014-03-29 06:02:25,"Jesse Gross"  wrote:
>
>>> Maybe I misunderstand something? I think if we discard all packet pass to us
>>> when we use gre vport, new gre_cisco_protocol which has lower priority could
>>> not see the packet intended to it.
>>
>>That's true but in this case it would also not see any data packets,
>>so I don't think that situation would work well anyways.
>>
>>> I checked the implementation of the ipgre_err(), which has be called before
>>> the err_handler of gre vport. It use the the (local address, remote 
>>> address, key)
>>> to distinguish the packet which is realy intended to it, although it could 
>>> not
>>> always get the key from the icmp packet. Should we do as the same as it?
>>> I'm not sure this is feasible, any advice is appreciate.
>>
>>OVS does flow based matching rather than using a static set of
>>configuration parameters, so everything "matches" in some way
>>(although the result might be to drop).
>
> So the flow based match could dynamically determine by the ovs daemon, we 
> could
> not find out the belonging of the packet as far as we call ovs_dp_upcall(), 
> isn't it?

That's right - and since the OVS flow table always has a default
behavior (even if it is drop or send to controller) there's never a
packet that isn't considered to be destined to OVS once it is
received.

If this makes sense to you, would you mind submitting the patch you
had earlier formally with a commit message and signed off by line?
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] datapath/linux/compat question

2014-04-01 Thread Zoltan Kiss

Hi,

I have a recent patch on net-next which affects OVS as well:

http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=36d5fe6a000790f56039afe26834265db0a3ad4c

I guess the changes for datapatch.c will turn up automagically sometime 
during a merge, is that correct?
But there is a change in the core skbuff API which need to be included 
in datapath/linux/compat/skbuff-openvswitch.c, otherwise upstream OVS 
won't build on older kernels. How does this process works? Is there any 
guarantee that even if it's forgotten during the merge, a build system 
somewhere will try to compile upstream OVS with older kernel, and sends 
a message when it fails?


Regards,

Zoli
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] datapath/linux/compat question

2014-04-01 Thread Kyle Mestery
On Tue, Apr 1, 2014 at 1:27 PM, Zoltan Kiss  wrote:
> Hi,
>
> I have a recent patch on net-next which affects OVS as well:
>
> http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=36d5fe6a000790f56039afe26834265db0a3ad4c
>
> I guess the changes for datapatch.c will turn up automagically sometime
> during a merge, is that correct?
> But there is a change in the core skbuff API which need to be included in
> datapath/linux/compat/skbuff-openvswitch.c, otherwise upstream OVS won't
> build on older kernels. How does this process works? Is there any guarantee
> that even if it's forgotten during the merge, a build system somewhere will
> try to compile upstream OVS with older kernel, and sends a message when it
> fails?

Hi Zoltan:

I just proposed a patch to support Linux 3.13 and 3.14, and this
includes your patch
folded in. The mailing lists server appears to be down now, otherwise
I would have
included a link. But I've taken care of the skbuff API change as well.
Feedback on
this patch is appreciated!

Thanks,
Kyle


>
> Regards,
>
> Zoli
> ___


> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] curveball

2014-04-01 Thread Maile Coolbaugh
d begun to hate her--yes, to _hat


 you every man should be content with three wives. More than this verges upon 
polygamy. But blessed is he who finds the three in one! Mrs. Denham. Indeed. 
Have you found that in Gyp? Denham. No, not directly; though Gyp fills me with 
thoughts that do often lie too deep for tears. Her cynicism is always 
illuminating. Mrs. Denham. I wish I could say the same of yours. But why three, 
and not a dozen? Denham. There are only three possible women in the world, the 
Divine Mistress-- Mrs. Denham. And the "Divine Matron"--I have heard this 
sickening cant before. Denham. Cant? Philosophy! But don't forget the third, 
The Divine Virgin--Womanhood fashioning itself independently after its own 
ideal. She has driven us, naked and ashamed, into the desert of disillusion. 
Mrs. Denham. Truth, truth--let me have truth, though it kill me! Men are 
cowards; they dare not face the naked facts of life. Denham. Men are poets. 
Facts are but the crude stuff of life. Imagination is all. Mrs. Denham. Oh, if 
you want romance, had you not better go and look for your Divine Mistress? 
Perhaps you may find some ugly truths in her too. Denham (_laughing_) One woman 
is surely enough for the purposes of disillusion. It is too late to begin 
sowing one's wild oats. There are no dangerous women about. If there were one 
healthy women in the world--(_Crosses to picture_) Mrs. Denham. Well? Denham. 
You might have some cause for jealousy. Mrs. Denham. You would quit the wreck? 
Denham. If it were really a wreck--perhaps. But why should it be? (_He takes 
her in his arms, and kisses her._) For Heaven's sake, cease to wallow in the 
mud of pessimism! Have faith in yourself and Nature--or at least Human-nature. 
Mrs. Denham. Oh, if I could, if I could! (_A knock at the door._) Denham. Come 
in. (_Enter Jane with a telegram, which she hands to Mrs. Denham._) Jane. 
Please, m'm, a telegram; the boy's waiting! (_Mrs. Denham tears open the 
telegram._) Mrs. Denham. (_pointing to spilt water_) Just wipe up that water, 
Jane, and push back this table. (_Jane wipes up water, moves table against R, 
wall, and takes away Undine's slate and book._) Mrs. Denham. (_reads_) "In 
town; will call this afternoon." Jane. Is there any answer, m'm? Mrs. Denham. 
No answer. (_Exit Jane_) Arthur! this is from Blanche Tremaine. She is in town, 
and comes here to-day. Let me see; it must be more than ten years since we'v<>___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] datapath/linux/compat question

2014-04-01 Thread Jesse Gross
On Tue, Apr 1, 2014 at 11:41 AM, Kyle Mestery  wrote:
> On Tue, Apr 1, 2014 at 1:27 PM, Zoltan Kiss  wrote:
>> Hi,
>>
>> I have a recent patch on net-next which affects OVS as well:
>>
>> http://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=36d5fe6a000790f56039afe26834265db0a3ad4c
>>
>> I guess the changes for datapatch.c will turn up automagically sometime
>> during a merge, is that correct?
>> But there is a change in the core skbuff API which need to be included in
>> datapath/linux/compat/skbuff-openvswitch.c, otherwise upstream OVS won't
>> build on older kernels. How does this process works? Is there any guarantee
>> that even if it's forgotten during the merge, a build system somewhere will
>> try to compile upstream OVS with older kernel, and sends a message when it
>> fails?
>
> Hi Zoltan:
>
> I just proposed a patch to support Linux 3.13 and 3.14, and this
> includes your patch
> folded in. The mailing lists server appears to be down now, otherwise
> I would have
> included a link. But I've taken care of the skbuff API change as well.
> Feedback on
> this patch is appreciated!

To answer the more general question, there's unfortunately nothing
automatic about it. In many cases, changes will cause compilation to
fail on older kernels if an upstream patch is missed when adding
support for a newer kernel but that's not always the case (including
this one I believe). The best thing is if authors submit their changes
to both repositories (with backports if necessary), otherwise it falls
to somebody to do it like Kyle has done here.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] WARNING: CPU: 0 PID: 3630 at net/core/dev.c:2218 skb_warn_bad_offload+0xcd/0xda()

2014-04-01 Thread Michele Baldessari
Hi all,

in Fedora we've received a couple of reports of the above warning
(https://bugzilla.redhat.com/show_bug.cgi?id=1047693).

The trace looks as follows:
reporter:   libreport-2.1.10
WARNING: CPU: 0 PID: 3630 at net/core/dev.c:2218 
skb_warn_bad_offload+0xcd/0xda()
: caps=(0x0008801948c9, 0x) len=1898 data_len=1832
gso_size=1448 gso_type=5 ip_summed=0
Modules linked in: vhost_net vhost macvtap macvlan tun fuse
nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE bnep
bluetooth ip6t_REJECT xt_conntrack cfg80211 rfkill openvswitch vxlan
ip_tunnel gre libcrc32c ebtable_nat ebtable_broute bridge stp llc
ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6
nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw
ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4
nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security
iptable_raw snd_hda_codec_hdmi snd_hda_codec_realtek iTCO_wdt
iTCO_vendor_support x86_pkg_temp_thermal coretemp kvm_intel kvm
crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel joydev
hid_logitech_dj snd_hda_intel microcode snd_hda_codec snd_hwdep i2c_i801
snd_seq snd_seq_device snd_pcm snd_page_alloc snd_timer lpc_ich mfd_core
snd soundcore shpchp e1000e ptp pps_core mei_me mei tpm_tis tpm tpm_bios
nfsd auth_rpcgss nfs_acl lockd sunrpc raid1 i915 i2c_algo_bit
drm_kms_helper drm i2c_core video
CPU: 0 PID: 3630 Comm: vhost-3613 Not tainted 3.12.5-302.fc20.x86_64 #1
Hardware name:  /DQ77KB, BIOS
KBQ7710H.86A.0052.2013.0708.1336 07/08/2013
 0009 88041e203a10 81662d11 88041e203a58
 88041e203a48 810691dd 8803f39d6c00 8803cf1b8000
 0005  8803f39d6c00 88041e203aa8
Call Trace:
   [] dump_stack+0x45/0x56
 [] warn_slowpath_common+0x7d/0xa0
 [] warn_slowpath_fmt+0x4c/0x50
 [] ? ___ratelimit+0x93/0x100
 [] skb_warn_bad_offload+0xcd/0xda
 [] __skb_gso_segment+0x71/0xc0
 [] dev_hard_start_xmit+0x18a/0x570
 [] sch_direct_xmit+0xe0/0x1c0
 [] dev_queue_xmit+0x1f9/0x4a0
 [] netdev_send+0x4b/0xc0 [openvswitch]
 [] ? ovs_masked_flow_lookup+0x122/0x260 [openvswitch]
 [] ovs_vport_send+0x1d/0x80 [openvswitch]
 [] do_output+0x2a/0x50 [openvswitch]
 [] do_execute_actions+0x2e3/0xb20 [openvswitch]
 [] ? enqueue_task_fair+0x412/0x660
 [] ovs_execute_actions+0x2b/0x30 [openvswitch]
 [] ovs_dp_process_received_packet+0x88/0x100 [openvswitch]
 [] ? try_to_wake_up+0xe7/0x290
 [] ovs_vport_receive+0x2a/0x30 [openvswitch]
 [] netdev_frame_hook+0xc1/0x120 [openvswitch]
 [] __netif_receive_skb_core+0x252/0x820
 [] __netif_receive_skb+0x18/0x60
 [] process_backlog+0xae/0x180
 [] net_rx_action+0x149/0x240
 [] __do_softirq+0xf7/0x240
 [] call_softirq+0x1c/0x30
   [] do_softirq+0x55/0x90
 [] netif_rx_ni+0x28/0x30
 [] tun_get_user+0x401/0x820 [tun]
 [] tun_sendmsg+0x5a/0x80 [tun]
 [] handle_tx+0x1bc/0x530 [vhost_net]
 [] handle_tx_kick+0x15/0x20 [vhost_net]
 [] vhost_worker+0xf2/0x190 [vhost]
 [] ? vhost_dev_reset_owner+0x30/0x30 [vhost]
 [] kthread+0xc0/0xd0
 [] ? insert_kthread_work+0x40/0x40
 [] ret_from_fork+0x7c/0xb0
 [] ? insert_kthread_work+0x40/0x40

This has been reported also against 3.13 and 3.14 rc2 (I did not see any
commits after that which could address this, hence this mail).

In the above trace the two NICs of the system were:
# ethtool -i em1
driver: e1000e
version: 2.3.2-k
firmware-version: 2.1-3
bus-info: :02:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
# ethtool -i em2
driver: e1000e
version: 2.3.2-k
firmware-version: 0.13-4
bus-info: :00:19.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no

# ethtool -k em1
Features for em1:
rx-checksumming: on
tx-checksumming: on
tx-checksum-ipv4: off [fixed]
tx-checksum-ip-generic: on
tx-checksum-ipv6: off [fixed]
tx-checksum-fcoe-crc: off [fixed]
tx-checksum-sctp: off [fixed]
scatter-gather: on
tx-scatter-gather: on
tx-scatter-gather-fraglist: off [fixed]
tcp-segmentation-offload: on
tx-tcp-segmentation: on
tx-tcp-ecn-segmentation: off [fixed]
tx-tcp6-segmentation: on
udp-fragmentation-offload: off [fixed]
generic-segmentation-offload: on
generic-receive-offload: on
large-receive-offload: off [fixed]
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off [fixed]
receive-hashing: on
highdma: on [fixed]
rx-vlan-filter: on [fixed]
vlan-challenged: off [fixed]
tx-lockless: off [fixed]
netns-local: off [fixed]
tx-gso-robust: off [fixed]
tx-fcoe-segmentation: off [fixed]
tx-gre-segmentation: off [fixed]
tx-udp_tnl-segmentation: off [fixed]
tx-mpls-segmentation: off [fixed]
fcoe-mtu: off [fixed]
tx-nocache-copy: on
loopback: off [fixed]
rx-fcs: off
rx-all: off
tx-vlan-stag-hw-insert: off [fixed]
rx-vlan-stag-hw-parse: off [fixed]
rx-vlan-stag-

Re: [ovs-dev] [RFC PATCH 4/4] lib/ofpbuf: Compact

2014-04-01 Thread Lori Jakab

On 4/1/14, 5:43 PM, Jarno Rajahalme wrote:


Sent from my iPhone


On Apr 1, 2014, at 7:27 AM, Ben Pfaff  wrote:


On Tue, Apr 01, 2014 at 03:14:16PM +0300, Lori Jakab wrote:

On 3/26/14, 2:16 AM, Ben Pfaff wrote:

On Mon, Mar 24, 2014 at 10:59:06AM -0700, Jarno Rajahalme wrote:
This patch shrinks the struct ofpbuf from 104 to 48 bytes on 64-bit
systems, or from 52 to 36 bytes on 32-bit systems (counting in the
'l7' removal by the previous patch).  This may help contribute to
cache efficiency, and will speed up initializing, copying and
manipulating ofpbufs.  This is potentially important for the DPDK
datapath, but the rest of the code base may also see a little benefit.

Changes are:

- Remove 'l7' pointer (previous patch).
- Use offsets instead of layer pointers for l2_5, l3, and l4 using
  'l2' as basis.  Usually 'data' is the same as 'l2', but this is not
  always the case (e.g., when parsing or constructing a packet), so it
  can not be easily used as the offset basis.  Also, packet parsing is
  faster if we do not need to maintain the offsets each time we pull
  data from the ofpbuf.
- Use uint32_t for 'allocated' and 'size', as 2^32 is enough even for
  largest possible messages/packets.
- Use packed enum for 'source'.
- Rearrange to avoid unnecessary padding.
- Remove 'private_p', which was used only in two cases, both of which
  had the invariant ('l2' == 'data'), so we can temporarily use 'l2'
  as a private pointer.

Signed-off-by: Jarno Rajahalme 

Unfotunately I missed this patch until rebasing my layer 3 patch
series [1] today.

Before this patch, I set the 'l2' pointer to NULL and 'l3' to the
start of the network header to represent a layer 3 packet in a
struct ofpbuf.  The way struct ofpbuf looks after this patch makes
the assumption of always having layer 2 headers a lot stronger.

I see two options for my patches going forward:
1) Add back 'l3' and remove 'l3_ofs' from struct ofpbuf (keeping the
rest as is); or
2) Encode a layer 3 packet by setting 'l2' to the network header
address and set l3_ofs to 0.

Can we do the following?
3) Replace 'l2' by 'l2_ofs' also?

I'll look into this today. However, my earlier analysis was that this would 
complicate things when the offset basis ('data') is changing a lot (e.g., when 
pulling data from ofpbuf). Maybe the cleanest solution would be to have a 
pointer to the start of packet and an additional l2 offset.


Yes, that's the most elegant solution IMHO.


However, as 0 is a valid offset value, having a separate l2 offset seems 
redundant as l3_ofs 0 would be an unambiguous way of encoding the absence of 
the l2 header.


I think having 'l2' set to a value other then NULL for layer 3 packets 
can be confusing, even if l3_ofs is set to 0, but I don't mind 
implementing L3 support that way.


I like Ben's proposal 3) better than 2), but I understand the concerns 
about the basis changing a lot.


-Lori
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH v3] bridge: don't bring up internal ports by default.

2014-04-01 Thread Flavio Leitner
It should be an administrator task to bring up devices as they
are configured properly.

Currently, Fedora is deleting the bridges when the interface is
brought down. Therefore, there is no bridge on the next boot and
the initscripts can apply the networking configuration properly
for a new bridge.

However, if the system didn't execute ifdown for some reason, the
bridge is left in the ovsdb and since internal ports are brought
up by default, there is no way for initscripts to known if the
adminitrator has already configured it or not.

This patch reverts commit bef071a5fdf8e2dd87677b04b3cf7a8f5094edcb
(bridge: Always "up" internal devices.).

Signed-off-by: Flavio Leitner 
---
 NEWS  |  3 +++
 tests/ofproto-dpif.at |  4 ++--
 tests/ofproto.at  | 16 
 vswitchd/bridge.c |  3 +--
 4 files changed, 14 insertions(+), 12 deletions(-)

Changelog:
v3 - Moved NEWS entry to the top
 Used a more verbose explanation
 Fixed unit-tests

v2 - added a comment in the NEWS file

Extra info about status change:
http://www.sflow.org/sflow_version_5.txt
[...]
unsigned int ifStatus; /* bit field with the following bits assigned
bit 0 = ifAdminStatus (0 = down, 1 = up)
bit 1 = ifOperStatus (0 = down, 1 = up) */

diff --git a/NEWS b/NEWS
index 4f88e3b..9255778 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 Post-v2.1.0
 -
+   - Internal ports are no longer brought up by default, because it
+ should be an administrator task to bring up devices as they are
+ configured properly.
- ovs-vsctl now reports when ovs-vswitchd fails to create a new port or
  bridge.
- The "ovsdbmonitor" graphical tool has been removed, because it was
diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at
index af5fd8f..409ede6 100644
--- a/tests/ofproto-dpif.at
+++ b/tests/ofproto-dpif.at
@@ -2950,7 +2950,7 @@ IFCOUNTERS
type=6
ifspeed=1
direction=0
-   status=3
+   status=0
in_octets=0
in_unicasts=0
in_multicasts=0
@@ -3019,7 +3019,7 @@ IFCOUNTERS
type=6
ifspeed=1
direction=0
-   status=3
+   status=0
in_octets=0
in_unicasts=0
in_multicasts=0
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 8656d98..63f7003 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -38,8 +38,8 @@ n_tables:254, n_buffers:256
 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP
 actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST 
SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_TP_DST ENQUEUE
  LOCAL(br0): addr:aa:55:aa:55:00:00
- config: 0
- state:  0
+ config: PORT_DOWN
+ state:  LINK_DOWN
  speed: 0 Mbps now, 0 Mbps max
 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
 ])
@@ -68,8 +68,8 @@ actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN 
SET_DL_SRC SET_DL_DST SET_N
  state:  LINK_DOWN
  speed: 0 Mbps now, 0 Mbps max
  LOCAL(br0): addr:aa:55:aa:55:00:0x
- config: 0
- state:  0
+ config: PORT_DOWN
+ state:  LINK_DOWN
  speed: 0 Mbps now, 0 Mbps max
 OFPT_GET_CONFIG_REPLY: frags=normal miss_send_len=0
 ])
@@ -109,8 +109,8 @@ AT_CHECK([ovs-ofctl -vwarn dump-ports-desc br0], [0], 
[stdout])
 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
 OFPST_PORT_DESC reply:
  LOCAL(br0): addr:aa:55:aa:55:00:00
- config: 0
- state:  0
+ config: PORT_DOWN
+ state:  LINK_DOWN
  speed: 0 Mbps now, 0 Mbps max
 ])
 OVS_VSWITCHD_STOP
@@ -124,8 +124,8 @@ AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-ports-desc 
br0], [0], [stdout])
 AT_CHECK([STRIP_XIDS stdout], [0], [dnl
 OFPST_PORT_DESC reply (OF1.2):
  LOCAL(br0): addr:aa:55:aa:55:00:00
- config: 0
- state:  0
+ config: PORT_DOWN
+ state:  LINK_DOWN
  speed: 0 Mbps now, 0 Mbps max
 ])
 OVS_VSWITCHD_STOP
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index db85856..b2a81a7 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1446,8 +1446,7 @@ iface_do_create(const struct bridge *br,
 VLOG_INFO("bridge %s: added interface %s on port %d",
   br->name, iface_cfg->name, *ofp_portp);
 
-if ((port_cfg->vlan_mode && !strcmp(port_cfg->vlan_mode, "splinter"))
-|| iface_is_internal(iface_cfg, br->cfg)) {
+if (port_cfg->vlan_mode && !strcmp(port_cfg->vlan_mode, "splinter")) {
 netdev_turn_flags_on(netdev, NETDEV_UP, NULL);
 }
 
-- 
1.8.5.3

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] vtep: add IP address configuration for bfd

2014-04-01 Thread Bruce Davie
The OVS implementation of BFD allows configuration of the source and
destination IP addresses of BFD packets. This patch adds the same
configuration option to the VTEP schema.

Signed-off-by: Bruce Davie 
---
 vtep/vtep.xml | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/vtep/vtep.xml b/vtep/vtep.xml
index 39cbba1..8ae6af7 100644
--- a/vtep/vtep.xml
+++ b/vtep/vtep.xml
@@ -842,6 +842,16 @@
   expected as destination for received BFD packets.  The default is
   00:23:20:00:00:01.
 
+
+   
+  Set to an IPv4 address to set the IP address used as source for
+  transmitted BFD packets.  The default is 169.254.1.0.
+   
+
+   
+  Set to an IPv4 address to set the IP address used as destination
+  for transmitted BFD packets.  The default is 
169.254.1.1.
+   
   
 
   
-- 
1.8.0.2

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v6 1/6] datapath: Fix typo.

2014-04-01 Thread Pravin Shelar
On Mon, Mar 31, 2014 at 11:18 AM, Jarno Rajahalme  wrote:
> Incorrect struct name was confusing, even though otherwise
> inconsequental.
>
> Signed-off-by: Jarno Rajahalme 
LGTM

Acked-by: Pravin B Shelar 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v6 2/6] datapath/flow: Fix ovs_flow_stats_get/clear RCU dereference.

2014-04-01 Thread Pravin Shelar
On Mon, Mar 31, 2014 at 11:18 AM, Jarno Rajahalme  wrote:
> For ovs_flow_stats_get() using ovsl_dereference() was wrong, since
> flow dumps call this with RCU read lock.
>
> ovs_flow_stats_clear() is always called with ovs_mutex, so can use
> ovsl_dereference().
>
> Also, make the ovs_flow_stats_get() 'flow' argument const to make
> later patches cleaner.
>
> Signed-off-by: Jarno Rajahalme 

Acked-by: Pravin B Shelar 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v6 5/6] datapath: Split ovs_flow_cmd_new_or_set().

2014-04-01 Thread Pravin Shelar
On Mon, Mar 31, 2014 at 11:18 AM, Jarno Rajahalme  wrote:
> Following patch will be easier to reason about with separate
> ovs_flow_cmd_new() and ovs_flow_cmd_set() functions.
>
> Signed-off-by: Jarno Rajahalme 


LGTM

Acked-by: Pravin B Shelar 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v6 3/6] datapath: Reduce locking requirements.

2014-04-01 Thread Pravin Shelar
On Mon, Mar 31, 2014 at 11:18 AM, Jarno Rajahalme  wrote:
> Reduce and clarify locking requirements for ovs_flow_cmd_alloc_info(),
> ovs_flow_cmd_fill_info() and ovs_flow_cmd_build_info().
>
> A datapath pointer is available only when holding a lock.  Change
> ovs_flow_cmd_fill_info() and ovs_flow_cmd_build_info() to take a
> dp_ifindex directly, rather than a datapath pointer that is then
> (only) used to get the dp_ifindex.  This is useful, since the
> dp_ifindex is available even when the datapath pointer is not, both
> before and after taking a lock, which makes further critical section
> reduction possible.
>
> Make ovs_flow_cmd_alloc_info() take an 'acts' argument instead a
> 'flow' pointer.  This allows some future patches to do the allocation
> before acquiring the flow pointer.
>
> The locking requirements after this patch are:
>
> ovs_flow_cmd_alloc_info(): May be called without locking, must not be
>   called while holding the RCU read lock (due to memory allocation).
>   If 'acts' belong to a flow in the flow table, however, then the
>   caller must hold ovs_mutex.
>
> ovs_flow_cmd_fill_info(): Either ovs_mutex or RCU read lock must be held.
>
> ovs_flow_cmd_build_info(): This calls both of the above, so the caller
>   must hold ovs_mutex.
>
> Signed-off-by: Jarno Rajahalme 

LGTM

Acked-by: Pravin B Shelar 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v6 4/6] datapath: Minimize ovs_flow_cmd_del critical section.

2014-04-01 Thread Pravin Shelar
On Mon, Mar 31, 2014 at 11:18 AM, Jarno Rajahalme  wrote:
> ovs_flow_cmd_del() now allocates reply (if needed) after the flow has
> already been removed from the flow table.  If the reply allocation
> fails, a netlink error is signaled with netlink_set_err(), as is
> already done in ovs_flow_cmd_new_or_set() in the similar situation.
>
> Signed-off-by: Jarno Rajahalme 

LGTM

Acked-by: Pravin B Shelar 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v6 6/6] datapath: Minimize ovs_flow_cmd_new|set critical sections.

2014-04-01 Thread Pravin Shelar
On Mon, Mar 31, 2014 at 11:18 AM, Jarno Rajahalme  wrote:
> Signed-off-by: Jarno Rajahalme 

> ---
> v6: Use key fields of the newly allocated flow directly in ovs_flow_cmd_new().
> Correctly handle the case of no acts in ovs_flow_cmd_set().
>
>  datapath/datapath.c |  193 
> ++-
>  1 file changed, 115 insertions(+), 78 deletions(-)
>
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index f88147e..52c76b4 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -798,8 +798,7 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct 
> genl_info *info)
>  {
> struct nlattr **a = info->attrs;
> struct ovs_header *ovs_header = info->userhdr;
> -   struct sw_flow_key key, masked_key;
> -   struct sw_flow *flow;
> +   struct sw_flow *flow, *new_flow;
> struct sw_flow_mask mask;
> struct sk_buff *reply;
> struct datapath *dp;
> @@ -807,61 +806,76 @@ static int ovs_flow_cmd_new(struct sk_buff *skb, struct 
> genl_info *info)
> struct sw_flow_match match;
> int error;
>
> -   /* Extract key. */
> +   /* Must have key and actions. */
> error = -EINVAL;
> if (!a[OVS_FLOW_ATTR_KEY])
> goto error;
> +   if (!a[OVS_FLOW_ATTR_ACTIONS])
> +   goto error;
>
> -   ovs_match_init(&match, &key, &mask);
> +   /* Most of the time we need to allocate a new flow, do it before
> +* locking. */
> +   new_flow = ovs_flow_alloc();
> +   if (IS_ERR(new_flow)) {
> +   error = PTR_ERR(new_flow);
> +   goto error;
> +   }
> +
> +   /* Extract key. */
> +   ovs_match_init(&match, &new_flow->unmasked_key, &mask);
> error = ovs_nla_get_match(&match,
>   a[OVS_FLOW_ATTR_KEY], 
> a[OVS_FLOW_ATTR_MASK]);
> if (error)
> -   goto error;
> +   goto err_kfree_flow;
>
> -   /* Validate actions. */
> -   error = -EINVAL;
> -   if (!a[OVS_FLOW_ATTR_ACTIONS])
> -   goto error;
> +   ovs_flow_mask_key(&new_flow->key, &new_flow->unmasked_key, &mask);
>
> +   /* Validate actions. */
> acts = ovs_nla_alloc_flow_actions(nla_len(a[OVS_FLOW_ATTR_ACTIONS]));
> error = PTR_ERR(acts);
> if (IS_ERR(acts))
> -   goto error;
> +   goto err_kfree_flow;
>
> -   ovs_flow_mask_key(&masked_key, &key, &mask);
> -   error = ovs_nla_copy_actions(a[OVS_FLOW_ATTR_ACTIONS],
> -&masked_key, 0, &acts);
> +   error = ovs_nla_copy_actions(a[OVS_FLOW_ATTR_ACTIONS], &new_flow->key,
> +0, &acts);
> if (error) {
> OVS_NLERR("Flow actions may not be safe on all matching 
> packets.\n");
> -   goto err_kfree;
> +   goto err_kfree_acts;
> +   }
> +
> +   reply = ovs_flow_cmd_alloc_info(acts, info, false);
> +   if (IS_ERR(reply)) {
> +   error = PTR_ERR(reply);
> +   goto err_kfree_acts;
> }
>
> ovs_lock();
> dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex);
> -   error = -ENODEV;
> -   if (!dp)
> +   if (unlikely(!dp)) {
> +   error = -ENODEV;
> goto err_unlock_ovs;
> -
> +   }
> /* Check if this is a duplicate flow */
> -   flow = ovs_flow_tbl_lookup(&dp->table, &key);
> -   if (!flow) {
> -   /* Allocate flow. */
> -   flow = ovs_flow_alloc();
> -   if (IS_ERR(flow)) {
> -   error = PTR_ERR(flow);
> -   goto err_unlock_ovs;
> -   }
> -
> -   flow->key = masked_key;
> -   flow->unmasked_key = key;
> -   rcu_assign_pointer(flow->sf_acts, acts);
> +   flow = ovs_flow_tbl_lookup(&dp->table, &new_flow->unmasked_key);
> +   if (likely(!flow)) {
> +   rcu_assign_pointer(new_flow->sf_acts, acts);
>
> /* Put flow in bucket. */
> -   error = ovs_flow_tbl_insert(&dp->table, flow, &mask);
> -   if (error) {
> +   error = ovs_flow_tbl_insert(&dp->table, new_flow, &mask);
> +   if (unlikely(error)) {
> acts = NULL;
> -   goto err_flow_free;
> +   goto err_unlock_ovs;
> }
> +
> +   if (unlikely(reply)) {
> +   error = ovs_flow_cmd_fill_info(new_flow,
> +  ovs_header->dp_ifindex,
> +  reply, 
> info->snd_portid,
> +  info->snd_seq, 0,
> +  OVS_FLOW_CMD_NEW);
> +   BUG_ON(error < 0);
> +   }
> 

Re: [ovs-dev] [bond megaflow v4 4/4 rebased] ofproto/bond: Implement bond megaflow using recirculation

2014-04-01 Thread Simon Horman
On Tue, Apr 01, 2014 at 10:16:05AM -0700, Andy Zhou wrote:
> On Mon, Mar 31, 2014 at 9:11 PM, Simon Horman  wrote:
> > On Tue, Mar 25, 2014 at 01:48:39PM -0700, Andy Zhou wrote:
> >> Infrastructure to enable megaflow support for bond ports using
> >> recirculation. This patch adds the following features:
> >> * Generate RECIRC action when bond can benefit from recirculation.
> >> * Populate post recirculation rules in a hidden table. Currently table 254.
> >> * Uses post recirculation rules for bond rebalancing
> >> * A recirculation implementation in dpif-netdev.
> >>
> >> Signed-off-by: Andy Zhou 
> >
> > Hi Andy,
> >
> > it appears that this does not apply cleanly,
> > Would you care to rebase it (again)?
> Yes. master moves fast these days. I will rebase and post v5 soon.

Thanks
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH 4/5] ofproto.at: Fix races in rule eviciton tests

2014-04-01 Thread Kmindg G
On Tue, Apr 1, 2014 at 8:38 PM, YAMAMOTO Takashi  wrote:
>>> +ovs-appctl time/warp 4000
>>>  AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
>>> -sleep 2
>>> +# At this point the table would looks like:
>>> +#  in_port   seconds to expire
>>> +# 113
>>> +# 211
>> This seems to be 12s to expire. And I realize that I made a mistake
>> about warp 4000.
>> It should be warp 5000 or even bigger.
>> I'm so sorry to bother you so many times.  I probably need a rest.
>> Thanks for all your work.
>
> apparently this math is too difficult for us. :-)
>
> YAMAMOTO Takashi
>
> commit 06f0a9e0e4da144e0bdc3a3b49d5f2572f67c626
> Author: YAMAMOTO Takashi 
> Date:   Mon Mar 31 14:04:35 2014 +0900
>
> ofproto.at: Fix races in rule eviciton tests
>
> Bump timeout differences, because timeouts different by 1s might end up
> to have the same position in the heap as rule_eviction_priority() uses
> 1024ms as a unit.
>
> Also, use time/stop to avoid relying on how long an add-flow would take.
>
> These tests were introduced by commit 6d56c1f1.
> ("ofproto: Update rule's priority in eviction group.")
>
> Signed-off-by: YAMAMOTO Takashi 
> Cc: Kmindg G 
> Acked-by: Ben Pfaff 
>
> diff --git a/tests/ofproto.at b/tests/ofproto.at
> index e98b526..de2d004 100644
> --- a/tests/ofproto.at
> +++ b/tests/ofproto.at
> @@ -1375,27 +1375,34 @@ AT_CHECK(
> | ${PERL} $srcdir/uuidfilt.pl],
>[0], [<0>
>  ])
> +ovs-appctl time/stop
>  # Add 4 flows.
>  for in_port in 4 3 2 1; do
> -ovs-ofctl add-flow br0 
> hard_timeout=1${in_port},in_port=$in_port,actions=drop
> +ovs-ofctl add-flow br0 hard_timeout=$((10 + in_port * 
> 3)),in_port=$in_port,actions=drop
>  done
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - hard_timeout=11, in_port=1 actions=drop
> - hard_timeout=12, in_port=2 actions=drop
> - hard_timeout=13, in_port=3 actions=drop
> - hard_timeout=14, in_port=4 actions=drop
> + hard_timeout=13, in_port=1 actions=drop
> + hard_timeout=16, in_port=2 actions=drop
> + hard_timeout=19, in_port=3 actions=drop
> + hard_timeout=22, in_port=4 actions=drop
>  NXST_FLOW reply:
>  ])
>  # Sleep and modify the one that expires soonest
> -sleep 2
> +ovs-appctl time/warp 5000
>  AT_CHECK([ovs-ofctl mod-flows br0 in_port=1,actions=drop])
> -sleep 2
> +# At this point the table would looks like:
> +#  in_port   seconds to expire
> +# 113
> +# 211
> +# 314
> +# 417
> +ovs-appctl time/warp 2000
>  # Adding another flow will cause the one that expires soonest to be evicted.
>  AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - hard_timeout=11, in_port=1 actions=drop
> - hard_timeout=13, in_port=3 actions=drop
> - hard_timeout=14, in_port=4 actions=drop
> + hard_timeout=13, in_port=1 actions=drop
> + hard_timeout=19, in_port=3 actions=drop
> + hard_timeout=22, in_port=4 actions=drop
>   in_port=5 actions=drop
>  NXST_FLOW reply:
>  ])
> @@ -1414,26 +1421,33 @@ AT_CHECK(
>  ])
>  # Add 4 flows.
>  for in_port in 4 3 2 1; do
> -ovs-ofctl add-flow br0 
> idle_timeout=1${in_port},in_port=$in_port,actions=drop
> +ovs-ofctl add-flow br0 idle_timeout=$((10 + in_port * 
> 3)),in_port=$in_port,actions=drop
>  done
> +ovs-appctl time/stop
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - idle_timeout=11, in_port=1 actions=drop
> - idle_timeout=12, in_port=2 actions=drop
> - idle_timeout=13, in_port=3 actions=drop
> - idle_timeout=14, in_port=4 actions=drop
> + idle_timeout=13, in_port=1 actions=drop
> + idle_timeout=16, in_port=2 actions=drop
> + idle_timeout=19, in_port=3 actions=drop
> + idle_timeout=22, in_port=4 actions=drop
>  NXST_FLOW reply:
>  ])
>  # Sleep and receive on the flow that expires soonest
> -sleep 2
> +ovs-appctl time/warp 5000
>  AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1)'])
> -sleep 2
> +# At this point the table would looks like:
> +#  in_port   seconds to expire
> +# 113
> +# 211
> +# 314
> +# 417
> +ovs-appctl time/warp 2000
>  # Adding another flow will cause the one that expires soonest to be evicted.
>  AT_CHECK([ovs-ofctl add-flow br0 in_port=5,actions=drop])
>  AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
> - idle_timeout=13, in_port=3 actions=drop
> - idle_timeout=14, in_port=4 actions=drop
> + idle_timeout=19, in_port=3 actions=drop
> + idle_timeout=22, in_port=4 actions=drop
>   in_port=5 actions=drop
> - n_packets=1, n_bytes=60, idle_timeout=11, in_port=1 actions=drop
> + n_packets=1, n_bytes=60, idle_timeout=13, in_port=1 actions=drop
>  NXST_FLOW reply:
>  ])
>  OVS_VSWITCHD_STOP

Acked-by: Kmindg G 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ofproto-dpif-upcall: Expire netflow flow when revalidate_ukey failed

2014-04-01 Thread YAMAMOTO Takashi
This fixes missing netflow flows in
"ofproto-dpif - NetFlow flow expiration" tests.

Signed-off-by: YAMAMOTO Takashi 
---
 ofproto/ofproto-dpif-upcall.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c
index 5b5fb6e..8639f5c 100644
--- a/ofproto/ofproto-dpif-upcall.c
+++ b/ofproto/ofproto-dpif-upcall.c
@@ -1332,6 +1332,7 @@ revalidate_ukey(struct udpif *udpif, struct 
udpif_flow_dump *udump,
 struct ofpbuf xout_actions, *actions;
 uint64_t slow_path_buf[128 / 8];
 struct xlate_out xout, *xoutp;
+struct netflow *netflow;
 struct flow flow, udump_mask;
 struct ofproto_dpif *ofproto;
 struct dpif_flow_stats push;
@@ -1345,6 +1346,7 @@ revalidate_ukey(struct udpif *udpif, struct 
udpif_flow_dump *udump,
 ok = false;
 xoutp = NULL;
 actions = NULL;
+netflow = NULL;
 
 /* If we don't need to revalidate, we can simply push the stats contained
  * in the udump, otherwise we'll have to get the actions so we can check
@@ -1372,7 +1374,7 @@ revalidate_ukey(struct udpif *udpif, struct 
udpif_flow_dump *udump,
 }
 
 error = xlate_receive(udpif->backer, NULL, ukey->key, ukey->key_len, &flow,
-  &ofproto, NULL, NULL, NULL, &odp_in_port);
+  &ofproto, NULL, NULL, &netflow, &odp_in_port);
 if (error) {
 goto exit;
 }
@@ -1421,6 +1423,13 @@ revalidate_ukey(struct udpif *udpif, struct 
udpif_flow_dump *udump,
 ok = true;
 
 exit:
+if (netflow) {
+if (!ok) {
+netflow_expire(netflow, &flow);
+netflow_flow_clear(netflow, &flow);
+}
+netflow_unref(netflow);
+}
 ofpbuf_delete(actions);
 xlate_out_uninit(xoutp);
 return ok;
-- 
1.8.3.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ofproto-macros.at: Make OVS_VSWITCHD_START wait for daemons start

2014-04-01 Thread YAMAMOTO Takashi
Without this change, I observed that
"ofproto-dpif - ofproto-dpif-monitor 2" test,
which merely accesses ovsdb, failed in OVS_VSWITCHD_STOP's
"ovs-appctl -t ovs-vswitchd exit".

Signed-off-by: YAMAMOTO Takashi 
---
 tests/ofproto-macros.at | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
index a82a9b1..076bf07 100644
--- a/tests/ofproto-macros.at
+++ b/tests/ofproto-macros.at
@@ -64,6 +64,7 @@ m4_define([OVS_VSWITCHD_START],
 
dnl Start ovsdb-server.
AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file 
--remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
+   OVS_WAIT_UNTIL([test -e ovsdb-server.pid])
AT_CHECK([[sed < stderr '
 /vlog|INFO|opened log file/d
 /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
@@ -75,6 +76,7 @@ m4_define([OVS_VSWITCHD_START],
dnl Start ovs-vswitchd.
AT_CHECK([ovs-vswitchd --detach --no-chdir --pidfile --enable-dummy$3 
--disable-system --log-file -vvconn -vofproto_dpif], [0], [], [stderr])
AT_CAPTURE_FILE([ovs-vswitchd.log])
+   OVS_WAIT_UNTIL([test -e ovs-vswitchd.pid])
AT_CHECK([[sed < stderr '
 /vlog|INFO|opened log file/d
 /vswitchd|INFO|ovs-vswitchd (Open vSwitch)/d
-- 
1.8.3.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev