[ovs-dev] [PATCH] datapath: stt compatibility for RHEL7

2015-05-03 Thread Pravin B Shelar
RHEL7 backported nf_hookfn from newer kernel. Handle compatibility
by checking nf_hookfn declaration.

Signed-off-by: Pravin B Shelar 
---
 acinclude.m4|2 ++
 datapath/linux/compat/stt.c |2 +-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 51cc969..e9d0ed9 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -325,6 +325,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [can_checksum_protocol])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_features_t])
   OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [pcpu_sw_netstats])
+  OVS_GREP_IFELSE([$KSRC/include/linux/netfilter.h], [nf_hookfn.*nf_hook_ops],
+  [OVS_DEFINE([HAVE_NF_HOOKFN_ARG_OPS])])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32])
 
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c
index d68d10e..b44f470 100644
--- a/datapath/linux/compat/stt.c
+++ b/datapath/linux/compat/stt.c
@@ -1318,7 +1318,7 @@ static void clean_percpu(struct work_struct *work)
schedule_clean_percpu();
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0)
+#ifdef HAVE_NF_HOOKFN_ARG_OPS
 #define FIRST_PARAM const struct nf_hook_ops *ops,
 #else
 #define FIRST_PARAM unsigned int hooknum,
-- 
1.7.1

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


[ovs-dev] [PATCH] ovs-ofctl: replace-flows and diff-flows support for multiple tables

2015-05-03 Thread shashank . shanbhag
From: Shashank Shanbhag 

Fix replace-flows and diff-flows to modify/diff flows in multiple tables.
Add a --tables option that allows the user to specify a comma-separated
list of table indexes to replace/diff.

Signed-off-by: Shashank Shanbhag 
Acked-by: Romain Lenglet 
---
 AUTHORS  |   1 +
 NEWS |   5 +-
 tests/ovs-ofctl.at   |  69 +++-
 utilities/ovs-ofctl.8.in |  20 ++-
 utilities/ovs-ofctl.c| 414 ---
 5 files changed, 437 insertions(+), 72 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 16e76b4..54705a1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -153,6 +153,7 @@ Scott Lowe  scott.l...@scottlowe.org
 Scott Mann  sdm...@gmail.com
 Selvamuthukumar smku...@merunetworks.com
 Shan Weidavids...@tencent.com
+Shashank Shanbhag   shashank.shanb...@gmail.com
 Shih-Hao Li s...@nicira.com
 Shu Shenshu.s...@radisys.com
 Simon Hormanho...@verge.net.au
diff --git a/NEWS b/NEWS
index 882a381..9d3c46b 100644
--- a/NEWS
+++ b/NEWS
@@ -81,7 +81,10 @@ Post-v2.3.0
  openvswitch.ko but built and loaded automatically as individual kernel
  modules (vport-*.ko).
- Support for STT tunneling.
-
+   - ovs-ofctl: replace-flows and diff-flows now operate on multiple tables.
+   - ovs-ofctl: --tables option added to replace-flows and diff-flows to allow
+ specific tables to be replaced or diffed.
+   - ovs-ofctl works for OF version 1.3 and above.
 
 v2.3.0 - 14 Aug 2014
 -
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 42be8f0..ec680bb 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -2789,27 +2789,82 @@ AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sed 
'/ST_FLOW reply/d' | sort
 OVS_VSWITCHD_STOP
 AT_CLEANUP
 
-
 dnl Importance parameter added in OF1.4.
 dnl This validates whether flows with importance
 dnl parameter are getting replaced with "replace-flows" or
 dnl not by validating dump-flows output after replace with the expected output.
+dnl MOD_FLOW does not modify importance field - ONF EXT-496.
 
 AT_SETUP([ovs-ofctl replace-flows with importance])
 OVS_VSWITCHD_START
 
 dnl Add flows to br0 with importance via OF1.4+. For more details refer 
"ovs-ofctl rule with importance" test case.
-for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i,actions=drop"; 
done > add-flows.txt
+for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i actions=drop"; 
done | sort > add-flows.txt
 AT_CHECK([ovs-ofctl -O OpenFlow14 add-flows br0 add-flows.txt])
 
-dnl Replace some flows in the bridge.
-for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10`,actions=drop"; 
done > replace-flows.txt
+dnl Modify odd numbered flows. Leave even numbered ones alone.
+for i in 1 2 3 4 5 6 7 8; do if [[ `expr $i % 2` -eq 1 ]]; then 
importance=`expr $i + 10`; else importance=$i; fi; echo " 
importance=$importance, dl_vlan=$i actions=drop"; done | sort > 
replace-flows.txt
+AT_CHECK([ovs-ofctl -O OpenFlow14 replace-flows br0 replace-flows.txt])
+
+dnl Dump the flows and compare them against expected output.
+
+for i in 1 2 3 4 5 6 7 8; do echo " importance=$i, dl_vlan=$i actions=drop"; 
done | sort > expout
+AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed 
'/OFPST_FLOW/d' | sort], [0], [expout])
+
+dnl Replace some flows in the bridge. Delete flows that are not present in 
replace-flows.txt
+dnl for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10` 
actions=drop"; done | sort > replace-flows.txt
+
+for i in 1 3 5 7; do echo "dl_vlan=$i,importance=$i actions=drop"; done | sort 
> replace-flows.txt
 AT_CHECK([ovs-ofctl -O OpenFlow14 replace-flows br0 replace-flows.txt])
 
 dnl Dump them and compare the dump flows output against the expected output.
-for i in 1 2 3 4 5 6 7 8; do if [[ `expr $i % 2` -eq 1 ]]; then 
importance=`expr $i + 10`; else importance=$i; fi; echo " 
importance=$importance, dl_vlan=$i actions=drop"; done | sort > expout
-AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed 
'/OFPST_FLOW/d' | sort],
-  [0], [expout])
+for i in 1 3 5 7; do echo " importance=$i, dl_vlan=$i actions=drop"; done | 
sort > expout
+AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed 
'/OFPST_FLOW/d' | sort], [0], [expout])
+
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+dnl --tables option added to ovs-ofctl "replace-flows" and "diff-flows".
+dnl This validates whether flows in table IDs specified with --tables
+dnl are getting replaced with "replace-flows" or not by validating
+dnl dump-flows output after replace with the expected output.
+
+AT_SETUP([ovs-ofctl replace-flows with --tables])
+OVS_VSWITCHD_START
+
+dnl Add flows to br0 for tables 1 to 8.
+for i in 1 2 3 4 5 6 7 8; do echo "table=$i,dl_vlan=$i,actions=drop"; done > 
add-flows.txt
+AT_CHECK([ovs-ofctl -O OpenFlow14 add-flows br0 add-flows.txt])
+
+dnl Replace flows from tables 1,3,5,7

Re: [ovs-dev] [PATCH ovn v6 2/9] ovn-controller: Implement translation of OVN flows into OpenFlow.

2015-05-03 Thread Ben Pfaff
On Fri, May 01, 2015 at 04:17:27PM -0700, Ben Pfaff wrote:
> Signed-off-by: Ben Pfaff 

I introduced a bug while applying Justin's comments and didn't take the
time to retest, but Guru pointed out the bug.  Here's an incremental
that should fix it.  I'll also update the "ovn" branch in my ovs-reviews
repository.

diff --git a/ovn/controller/pipeline.c b/ovn/controller/pipeline.c
index f124354..1d2306c 100644
--- a/ovn/controller/pipeline.c
+++ b/ovn/controller/pipeline.c
@@ -290,7 +290,7 @@ pipeline_run(struct controller_ctx *ctx)
 
 ofpbuf_use_stub(&ofpacts, ofpacts_stub, sizeof ofpacts_stub);
 error = actions_parse_string(pipeline->actions, &symtab, &ldp->ports,
- pipeline->table_id + 16,
+ pipeline->table_id + 17,
  &ofpacts, &prereqs);
 if (error) {
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 1);
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Interested in contibuting to openvswitch

2015-05-03 Thread sandesh shrestha
Hello All,

I want to contribute to openvswitch. I came across this missing feature in
FAQ and want to implement this feature.

*"Q: It looks like each of the interfaces in my bonded port shows up as an
individual OpenFlow port. Is that right?"*

How can I start working on this ?

I have good understanding of working of openvswitch and a good knowledge on
C programming. However, I have limited understanding of linux kernel which
I think is also required for development.

Could anyone guide me on this  ?

-- 
Sandesh Shrestha
Internetworking Student at U of Alberta
www.sandeshshrestha.net
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] xenserver: Use kernel uname version for XenServer 6.5

2015-05-03 Thread GosenChien
Hi all,
Sorry for late reply.
Currently we're focus our internal project  so that we might not have enough 
resources in short period.

However, we'll test the fix ASAP once we have extra machines .
Thanks for your help.

Best Regards,
Gosen Chien
*
CCU CS Project assistant
No.168, Sec. 1, University Rd., Min-Hsiung Township, Chia-yi County 62102, 
Taiwan
TEL: (05)272-0411#23134
E-mail:astgo...@ccu.edu.tw 
   astgo...@novatw.info 

On Fri, 五月 1, 2015 01:11, Alex Wang wrote:
>> Yeah, I forgot, will update the INSTALL.Xenserver.md, and repost,
>>
>>
>> On Thu, Apr 30, 2015 at 10:08 AM, Ben Pfaff  wrote:
>>
>>
>>> Yes, but should we update the documentation to mention the new
>>> variable?
>>>
>>> On Thu, Apr 30, 2015 at 09:32:17AM -0700, Alex Wang wrote:
>>>
 Have not heard from GosenChien.~


 Edwin has tested the fix.  So, should we apply this first~?


 Thanks,
 Alex Wang,


 On Wed, Apr 29, 2015 at 7:34 AM, Ben Pfaff  wrote:


> It seems that GosenChien (CCed) deserves credit for reporting this
> problem; he has been discussing it on the list for a while.
>
> GosenChien, will you test that this fixes the problem you see?
>
>
> Thanks,
>
>
> Ben.
>
>
> On Tue, Apr 28, 2015 at 03:34:26PM -0700, Alex Wang wrote:
>
>> From: Edwin Chiu 
>>
>>
>> In XenServer 6.5, multiple kernel packages with different
>> rpm versions can have the same uname.  So, it is not necessary for
>> openvswitch kernel module to require the exact rpm version.
>> Instead, the kernel module package
>> should check the uname version.
>>
>> This commit will add a new variable %{kernel_uname} to
>> specify whether to use kernel uname version or kernel rpm version
>> as requirement.
>>
>> When %{kernel_name} is used, openvswitch-module will have
>> "Requires: kernel-uname-r = " set instead of
>> "Requires: kernel = ".
>>
>>
>> Signed-off-by: Edwin Chiu 
>> Signed-off-by: Alex Wang 
>> ---
>> xenserver/openvswitch-xen.spec.in |   20 ++-- 1
>> file changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/xenserver/openvswitch-xen.spec.in b/xenserver/
> openvswitch-xen.spec.in
>> index 2902372..7a0c30f 100644 ---
>> a/xenserver/openvswitch-xen.spec.in +++
>> b/xenserver/openvswitch-xen.spec.in @@ -18,14 +18,12 @@
>> #  -D "kernel_flavor xen"
>> #  -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
>> #
>> -# For XenServer version >= 6.5, replace kernel_flavor with
>>
>>> xen_version
> which
>> -# should be the `uname -r` output.
>> +# For XenServer version >= 6.5, use kernel_uname which should be
>> +# the `uname -r` output.
>> # for example:
>> #
>> #rpmbuild -D "openvswitch_version 2.3.0+build123"
>> -#  -D "kernel_name  NAME-xen"
>> -#  -D "kernel_version 3.10.41-323.380416"
>> -#  -D "xen_version 3.10.0+2"
>> +#  -D "kernel_uname  3.10.0+2"
>> #  -bb /usr/src/redhat/SPECS/openvswitch-xen.spec
>> #
>> # If tests have to be skipped while building, specify the
>> '--without
>>
> check'
>> @@ -36,6 +34,11 @@
>> %define openvswitch_version @VERSION@
>> %endif
>>
>>
>> +%if %{?kernel_uname:1}%{!?kernel_uname:0}
>> +%define kernel_name kernel
>> +%define kernel_version %{kernel_uname}
>> +%endif
>> +
>> %if %{?kernel_name:0}%{!?kernel_name:1}
>> %define kernel %(rpm -qa 'kernel*xen-devel' | head -1)
>> %define kernel_name %(rpm -q --queryformat "%%{Name}" %{kernel} |
>>
>>> sed
> 's/-devel//' | sed 's/kernel-//')
>
>> @@ -44,7 +47,7 @@
>> %endif
>>
>>
>> %if %{?xen_version:0}%{!?xen_version:1}
>> -%define xen_version %{kernel_version}%{kernel_flavor}
>> +%define xen_version
>>
>>> %{kernel_version}%{?kernel_flavor:%{kernel_flavor}}
>>>
>> %endif
>>
>>
>> # bump this when breaking compatibility with userspace
>> @@ -78,7 +81,12 @@ Summary: Open vSwitch kernel module
>> Group: System Environment/Kernel
>> License: GPLv2
>> Provides: %{name}-modules%{?kernel_flavor:-%{kernel_flavor}} =
>>
> %{kernel_version}, openvswitch.ko.%{module_abi_version}
>
>> +%if %{?kernel_uname:0}%{!?kernel_uname:1}
>> Requires: kernel%{?kernel_flavor:-%{kernel_flavor}} =
>>
>>> %{kernel_version}
>>>
>> +%endif
>> +%if %{?kernel_uname:1}%{!?kernel_uname:0}
>> +Requires: kernel-uname-r = %{kernel_version}
>> +%endif
>>
>>
>> %description %{module_package}
>> Open vSwitch Linux kernel module compiled against kernel version
>> --
>> 1.7.9.5
>>
>>
>> ___
>> dev mailing l