cascardo/ovs.git
9 years agoSet release dates for 2.1.2. v2.1.2
Justin Pettit [Wed, 30 Apr 2014 21:51:00 +0000 (14:51 -0700)]
Set release dates for 2.1.2.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif: Close race between processing packet_ins and checking seqno.
Ben Pfaff [Wed, 30 Apr 2014 18:07:46 +0000 (11:07 -0700)]
ofproto-dpif: Close race between processing packet_ins and checking seqno.

If a packet-in were to be queued, and the sequence number changed, after
grabbing the list of packet-ins, then the existing code could have gone to
sleep until something happened.  By grabbing the sequence number before
the list of packet-ins, we avoid this race.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
9 years agoofproto-dpif: Use sequence number to wake up main thread for
Alex Wang [Thu, 17 Apr 2014 19:24:45 +0000 (12:24 -0700)]
ofproto-dpif: Use sequence number to wake up main thread for
packet-in I/O.

This commit adds per 'struct ofproto_dpif' sequence number for
packet-in I/O.  Whenever ofproto_dpif_send_packet_in() is called,
the calling thread will change the sequence number to wake up the
main thread.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
9 years agoPrepare for 2.1.2.
Justin Pettit [Mon, 28 Apr 2014 21:53:11 +0000 (14:53 -0700)]
Prepare for 2.1.2.

We now increment the version immediately after a release.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
9 years agoRevert "Prepare for 2.1.2."
Justin Pettit [Tue, 29 Apr 2014 05:36:33 +0000 (22:36 -0700)]
Revert "Prepare for 2.1.2."

This reverts commit 82e413df because bug fix bf52ed4 (datapath: Check for
backported skb_orphan_frags().) was required.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
9 years agodatapath: Check for backported skb_orphan_frags(). v2.1.1
Joe Stringer [Mon, 28 Apr 2014 01:59:25 +0000 (13:59 +1200)]
datapath: Check for backported skb_orphan_frags().

This was causing build failures on debian wheezy. Check for the feature
rather than the version.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
9 years agoPrepare for 2.1.2.
Justin Pettit [Mon, 28 Apr 2014 21:53:11 +0000 (14:53 -0700)]
Prepare for 2.1.2.

We now increment the version immediately after a release.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
9 years agoPrepare 2.1.1 release.
Justin Pettit [Mon, 28 Apr 2014 21:51:34 +0000 (14:51 -0700)]
Prepare 2.1.1 release.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
10 years agobridge: When ports disappear from a datapath, add them back.
Ben Pfaff [Thu, 24 Apr 2014 01:33:36 +0000 (18:33 -0700)]
bridge: When ports disappear from a datapath, add them back.

Before commit 2a73b1d73d4bdb (bridge: Reconfigure in single pass.), if a
port disappeared, for one reason or another, from a datapath, the next
bridge reconfiguration pass would notice and, if the port was still
configured in the database, add the port back to the datapath.  That
commit, however, removed the logic from bridge_refresh_ofp_port() that
did that and failed to add the same logic to the replacement function
bridge_delete_or_reconfigure_ports().  This commit fixes the problem.

To see this problem on a Linux kernel system:

ovs-vsctl add-br br0                             # 1
tunctl -t tap                                    # 2
ovs-vsctl add-port br0 tap                       # 3
ovs-dpctl show                                   # 4
tunctl -d tap                                    # 5
ovs-dpctl show                                   # 6
tunctl -t tap                                    # 7
ovs-vsctl del-port tap -- add-port br0 tap       # 8
ovs-dpctl show                                   # 9

Steps 1-4 create a bridge and a tap and add it to the bridge and
demonstrate that the tap is part of the datapath.  Step 5 and 6 delete
the tap and demonstrate that it has therefore disappeared from the
datapath.  Step 7 recreates a tap with the same name, and step 8
forces ovs-vswitchd to reconfigure.  Step 9 shows the effect of the
fix: without the fix, the new tap is not added back to the datapath;
with this fix, it is.

Special thanks to Gurucharan Shetty <gshetty@nicira.com> for finding a
simple reproduction case and then bisecting to find the commit that
introduced the problem.

Bug #1238467.
Reported-by: Ronald Lee <ronaldlee@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agorevalidator: Prevent handling the same flow twice.
Joe Stringer [Wed, 23 Apr 2014 03:31:17 +0000 (15:31 +1200)]
revalidator: Prevent handling the same flow twice.

When the datapath flow table is modified while a flow dump operation is
in progress, it is possible for the same flow to be dumped twice. In
such cases, revalidators may perform redundant work, or attempt to
delete the same flow twice.

This was causing intermittent testsuite failures for test #670 -
"ofproto-dpif, active-backup bonding" where a flow (that had not
previously been dumped) was dumped, revalidated and deleted twice.

The logs show errors such as:
"failed to flow_get (No such file or directory) skb_priority(0),..."
"failed to flow_del (No such file or directory) skb_priority(0),..."

This patch adds a 'flow_exists' field to 'struct udpif_key' to track
whether the flow is (in progress) to be deleted. After doing a ukey
lookup, we check whether ukey->mark or ukey->flow indicates that the
flow has already been handled. If it has already been handled, we skip
handling the flow again.

We also defer ukey cleanup for flows that fail revalidation, so that the
ukey will still exist if the same flow is dumped twice. This allows the
above logic to work in this case.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agodatapath: Orphan frags in skb_zerocopy and handle errors
Zoltan Kiss [Fri, 11 Apr 2014 16:16:48 +0000 (17:16 +0100)]
datapath: Orphan frags in skb_zerocopy and handle errors

This is the ported version of commit 36d5fe6a with the same name from net-next.
Apart from the small datapath.c changes it adjust the compat layer files as
well. This is the original commit message:

"skb_zerocopy can copy elements of the frags array between skbs, but it doesn't
orphan them. Also, it doesn't handle errors, so this patch takes care of that
as well, and modify the callers accordingly. skb_tx_error() is also added to
the callers so they will signal the failed delivery towards the creator of the
skb."

Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodebian: Better document how to get a kernel module in README.Debian.
Ben Pfaff [Fri, 11 Apr 2014 17:39:20 +0000 (10:39 -0700)]
debian: Better document how to get a kernel module in README.Debian.

This moves existing text from INSTALL.Debian into the README.Debian
installed as part of the openvswitch-switch package, and adds a reference
from the former to the latter.

Reported-by: Brian Candler <b.candler@pobox.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agoovsdbmonitor: Remove.
Ben Pfaff [Fri, 10 Jan 2014 23:25:40 +0000 (15:25 -0800)]
ovsdbmonitor: Remove.

ovsdbmonitor was poorly maintained and not widely used.

Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agonetflow: Correctly track flow creation time.
Ben Pfaff [Thu, 10 Apr 2014 17:11:49 +0000 (10:11 -0700)]
netflow: Correctly track flow creation time.

'created' is supposed to be the time the flow was created, but it was
getting reset to zero on every expiration, causing the flow start time to
be wonky after the first active expiration on a flow.

Reported-by: Lior Neudorfer <lior@guardicore.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agovlandev: Fix an obvious predicate logic crash bug.
ZhengLingyun [Thu, 10 Apr 2014 15:07:05 +0000 (08:07 -0700)]
vlandev: Fix an obvious predicate logic crash bug.

Signed-off-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto/xlate: Fix set field unwildcarding.
Jarno Rajahalme [Wed, 9 Apr 2014 18:13:57 +0000 (11:13 -0700)]
ofproto/xlate: Fix set field unwildcarding.

If the field does not exist, nothing is set.  However, we must
unwildcard the bits we used to make the decision, and we need not
unwildcard the field and it's prerequisities, if nothing is set.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Correct check for MPLS LSE
Simon Horman [Tue, 7 Jan 2014 04:48:08 +0000 (13:48 +0900)]
ofproto-dpif-xlate: Correct check for MPLS LSE

zero is a valid MPLS LSE so it is not valid check against
that value for MPLS LSE presence. Instead, check against
the flow's dl_type which should be an MPLS type if an LSE is present.

This problem appears to have been introduced by
b2dd70be133bf86c ("Native Set-Field action.").

Cc: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agolib/ofp-actions: Silently discard set ip ecn/ttl actions on OpenFlow10.
Jarno Rajahalme [Wed, 9 Apr 2014 18:13:57 +0000 (11:13 -0700)]
lib/ofp-actions: Silently discard set ip ecn/ttl actions on OpenFlow10.

It is better to not abort().

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: supply a dummy err_handler of gre_cisco_protocol to prevent kernel crash
Wei Zhang [Sat, 5 Apr 2014 23:17:35 +0000 (16:17 -0700)]
datapath: supply a dummy err_handler of gre_cisco_protocol to prevent kernel crash

When use gre vport, openvswitch register a gre_cisco_protocol but
does not supply a err_handler with it. The gre_cisco_err() in
net/ipv4/gre_demux.c expect err_handler be provided with the
gre_cisco_protocol implementation, and call ->err_handler() without
existence check, cause the kernel crash.

This patch provide a err_handler to fix this bug.

Signed-off-by: Wei Zhang <asuka.com@163.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif-upcall: Expire netflow flow when revalidate_ukey failed
YAMAMOTO Takashi [Tue, 1 Apr 2014 12:21:45 +0000 (21:21 +0900)]
ofproto-dpif-upcall: Expire netflow flow when revalidate_ukey failed

This fixes missing netflow flows in
"ofproto-dpif - NetFlow flow expiration" tests.

Acked-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Conflicts:
ofproto/ofproto-dpif-upcall.c

10 years agoofp-print: Fix misaligned data access in ofp_print_error_msg().
Ben Pfaff [Sat, 5 Apr 2014 02:26:22 +0000 (19:26 -0700)]
ofp-print: Fix misaligned data access in ofp_print_error_msg().

The body of an OpenFlow error message often contains an inner OpenFlow
message, and when it does, the inner message starts at an odd multiple of 4
bytes from the beginning of the outer message.  That means that, on RISC
systems, accessing the inner message directly causes a bus error.  This
commit fixes the problem in a way that should make it difficult to recur.

This fixes the failure of tests 643, 645, and 651 on sparc seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agopackets: Fix misaligned data accesses for MPLS and SCTP fields.
Ben Pfaff [Sat, 5 Apr 2014 18:14:02 +0000 (11:14 -0700)]
packets: Fix misaligned data accesses for MPLS and SCTP fields.

The other 32-bit data fields in protocol headers were already using
ovs_16aligned_be32, but MPLS and SCTP had been overlooked.  This fixes
the failure of test 681 seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agodpif-netdev: Unwildcard entire odp_port in dpif_netdev_mask_from_nlattrs().
Ben Pfaff [Sat, 5 Apr 2014 17:27:05 +0000 (10:27 -0700)]
dpif-netdev: Unwildcard entire odp_port in dpif_netdev_mask_from_nlattrs().

One case in the dpif_netdev_mask_from_nlattrs() function accidentally
wildcarded only a 16-bit subset of the mask's odp_port.  On little-endian
machines this subset was the lower bits, which happened to work out OK,
but on big-endian machines this subset was the upper bits, which doesn't
work and causes a test failure.  (The problem was actually visible in the
test expected results on little-endian machines, but we had not noticed.)

This commit unwildcards the whole field, fixing the problem, and updates
the test expected results to match.

This fixes the failure of test 732 seen here:
https://buildd.debian.org/status/fetch.php?pkg=openvswitch&arch=sparc&ver=2.1.0%2Bgit20140325-1&stamp=1396438624

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agodebian: Allow kmod or module-init-tools for backward compatibility.
Ben Pfaff [Wed, 2 Apr 2014 21:54:51 +0000 (14:54 -0700)]
debian: Allow kmod or module-init-tools for backward compatibility.

Commit d473844693 (debian: Depend on 'kmod' instead of module-init-tools.)
switched from depending on module-init-tools to depending on kmod, which
is the new name of the appropriate package in Debian.  Unfortunately,
while kmod is the right name for the latest Debian distribution, it doesn't
have that name in old distributions and thus breaks the build on those.
This commit should work OK in either case, since it allows both names.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agodebian: Depend on 'kmod' instead of module-init-tools.
Ben Pfaff [Mon, 31 Mar 2014 20:38:50 +0000 (13:38 -0700)]
debian: Depend on 'kmod' instead of module-init-tools.

CC: 733696@bugs.debian.org
Reported-by: md@Linux.IT (Marco d'Itri)
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agorhel: Enable DHCP support for internal ports.
Flavio Leitner [Tue, 14 Jan 2014 02:22:07 +0000 (00:22 -0200)]
rhel: Enable DHCP support for internal ports.

The current initscripts ifup-ovs brings up internal ports as
an ordinary ethernet device, so BOOTPROTO=dhcp|none does not
consider any OVS/bridge detail.

Since DHCP requires a port in the bridge to reach the server,
bring up the required port before in the same way it does for
OVS bridge.

Signed-off-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
10 years agolib/pcap: Use ofpbuf_tail() instead of ofpbuf_end().
Jarno Rajahalme [Tue, 25 Mar 2014 23:16:28 +0000 (16:16 -0700)]
lib/pcap: Use ofpbuf_tail() instead of ofpbuf_end().

Using ofpbuf_end() to compute payload length would fail if the ofpbuf
had any tailroom.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Define old_cfm_fault as 'enum cfm_fault_reason'.
Alex Wang [Wed, 19 Mar 2014 23:19:28 +0000 (16:19 -0700)]
cfm: Define old_cfm_fault as 'enum cfm_fault_reason'.

CFM fault variable type has been changed to 'enum cfm_fault_reason' for
long time.  However, inside cfm_run(), the old_cfm_fault is still defined
as boolean.  This commit fixes the issue.

Found by inspection.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodpif-netdev: Use packet key to parse TCP flags.
Jarno Rajahalme [Wed, 19 Mar 2014 23:23:28 +0000 (16:23 -0700)]
dpif-netdev: Use packet key to parse TCP flags.

The flow that created the netdev_flow might have wildcarded TCP flags,
or it may not be a TCP flow at all.  Fix this by using the freshly
extracted flow key to parse TCP flags.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoSet release date for 2.1.0. v2.1.0
Justin Pettit [Wed, 19 Mar 2014 23:10:20 +0000 (16:10 -0700)]
Set release date for 2.1.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agocfm: Notify connectivity_seq on remote maintenance points change.
Alex Wang [Sat, 15 Mar 2014 01:30:39 +0000 (18:30 -0700)]
cfm: Notify connectivity_seq on remote maintenance points change.

Commit f23d157c ("ofproto-dpif: Don't poll ports when nothing changes")
did not ensure the update of the row of remote maintenance points in ovsdb
when it changes.  This commit makes the update happen by notifying the
global connectivity_seq.

Bug #1192265

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Revalidate flows when the group table changes.
Ben Pfaff [Mon, 17 Mar 2014 20:25:19 +0000 (13:25 -0700)]
ofproto-dpif: Revalidate flows when the group table changes.

Otherwise group table modifications won't be immediately reflected in the
treatment of flows already passing through the switch.

Reported-by: Hyojoon Kim <joonk@gatech.edu>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Tested-by: Hyojoon Kim <joonk@gatech.edu>
10 years agostp: Fix bpdu tx problem in listening state
kmindg [Sun, 9 Mar 2014 09:48:52 +0000 (17:48 +0800)]
stp: Fix bpdu tx problem in listening state

The restriction only allows to send bpdu in forwarding state in
compose_output_action__. But a port could send bpdu in listening
and learning state according to comments in lib/stp.h(State of
an STP port).

Until this commit, OVS did not send out BPDUs in listening and learning
states.  But those two states are temporary, the stp port will be in
forwarding state and send out BPDUs eventually (In the default
configuration listening and learning states last 15+15 second).  Therefore,
this bug increased convergence time but did not entirely break STP.

Signed-off-by: kmindg <kmindg@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotunnel: Do not set padding bits in tunnel mask.
Ben Pfaff [Sun, 2 Mar 2014 01:15:00 +0000 (17:15 -0800)]
tunnel: Do not set padding bits in tunnel mask.

On most architectures other than 32-bit x86, struct flow_tnl ends with 4
padding bytes.  Until now, tnl_xlate_init() set those bytes to nonzero
values in the wildcard mask.  When the wildcard mask passed through Netlink
attributes and back to userspace, the padding bytes of course became zero
again, which caused a wildcard mask mismatch and premature deletion of the
flow in revalidation.  This commit fixes the problem.

Bug #1192516.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoodp-util: Include tun_id when nonzero even if "key" flag not set.
Ben Pfaff [Sun, 2 Mar 2014 01:11:02 +0000 (17:11 -0800)]
odp-util: Include tun_id when nonzero even if "key" flag not set.

When a flow_tnl is being translated to Netlink attributes, the tun_id field
was included only if the FLOW_TNL_F_KEY flag was set.  This meant that for
a mask, where one would not necessarily expect that flag to be set even if
there were a key, the tun_id could be omitted even if it were nonzero.
This led to kernel flows that did not match on a field that was required
to be matched (possibly causing incorrect treatment of packets) and
premature deletion of kernel flows due to mask mismatch.  This commit
fixes the problem.

Bug #1192516.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: Correctly report flow used times for first 5 minutes after boot.
Ben Pfaff [Fri, 28 Feb 2014 21:12:04 +0000 (13:12 -0800)]
datapath: Correctly report flow used times for first 5 minutes after boot.

The kernel starts out its "jiffies" timer as 5 minutes below zero, as
shown in include/linux/jiffies.h:

  /*
   * Have the 32 bit jiffies value wrap 5 minutes after boot
   * so jiffies wrap bugs show up earlier.
   */
  #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ))

The loop in ovs_flow_stats_get() starts out with 'used' set to 0, then
takes any "later" time.  This means that for the first five minutes after
boot, flows will always be reported as never used, since 0 is greater than
any time already seen.

Bug #1192516.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agodpif-linux: Lookup netdev to get netdev type string.
Joe Stringer [Wed, 26 Feb 2014 21:22:35 +0000 (13:22 -0800)]
dpif-linux: Lookup netdev to get netdev type string.

When creating tap ports in dpif-linux, the "tap" type is treated the
same as "system", and the type is discarded. When dumping datapath
port types, this would cause "tap" type to be reported as a "system"
type.

Each time we see a port of the wrong type in bridge_reconfigure(), we
remove it and add a port with the correct configuration. This would
always occur for tap ports, causing deletion and re-creation of all tap
ports each time the bridge was reconfigured.

This patch makes dpif-linux use netdev to look up port types if the
datapath reports that they are of type OVS_VPORT_TYPE_NETDEV.

Bug #1196289.

Reported-by: James Schmidt <jschmidt@vmware.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agoupcall: Remove datapath flows when setting n-threads.
Joe Stringer [Tue, 11 Feb 2014 21:55:36 +0000 (13:55 -0800)]
upcall: Remove datapath flows when setting n-threads.

Previously, we would delete all ukeys when changing the number of
threads, but leave all flows in the datapath. This would cause
double-counting of stats for any flows that remain in the datapath. This
patch fixes the issue by ensuring that all flows are deleted from the
datapath before changing the number of threads.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoupcall: Delete flows that were not recently dumped.
Joe Stringer [Tue, 11 Feb 2014 21:55:35 +0000 (13:55 -0800)]
upcall: Delete flows that were not recently dumped.

Previously, we would clean up the ukeys whose flow was not seen in the
most recent dump, while leaving the flow in the datapath. In the
unlikely case that the datapath fails to dump a flow that still exists
in the datapath, this would cause double-counting of those flow stats.

This is currently very rare to see due to batching of datapath flow
deletion, but is more easily observable with upcoming patches which
modify the batch size based on dpif implementation.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoupcall: Refactor ukey creation and dump handling
Joe Stringer [Tue, 11 Feb 2014 21:55:34 +0000 (13:55 -0800)]
upcall: Refactor ukey creation and dump handling

This splits out functions for re-use by later patches, and compacts the
udump revalidation code.

Co-authored-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Conflicts:
ofproto/ofproto-dpif-upcall.c

10 years agoupcall: Defer ukey deletion until after pushing stats.
Joe Stringer [Tue, 11 Feb 2014 21:55:33 +0000 (13:55 -0800)]
upcall: Defer ukey deletion until after pushing stats.

It is possible for a datapath to dump the same flow twice, for instance
if the flow is the last in a batch of flows to be dumped, then a new
flow is inserted into the same bucket before the flow dumper fetches
another batch.

In this case, datapath flow stats may be duplicated: The revalidator
records the stats from the first flow, using the ukey to get the stats
delta. The ukey is deleted, then the revalidator reads the second
(duplicate) flow and cannot lookup the ukey for the delta. As such, it
will push the stats as-is.

This patch reduces the likelihood of such stats duplications by
deferring ukey deletion until after stats are pushed for deleted flows.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Test flow stats reporting.
Joe Stringer [Tue, 11 Feb 2014 21:55:32 +0000 (13:55 -0800)]
ofproto-dpif: Test flow stats reporting.

Basic test to check that the datapath reports the correct number of
packets seen, after a delay of 1 second.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif: Complete all packet translations before freeing an ofproto.
Ben Pfaff [Tue, 25 Feb 2014 16:01:01 +0000 (08:01 -0800)]
ofproto-dpif: Complete all packet translations before freeing an ofproto.

The following scenario can occur:

   1. Handler thread grabs a pointer to an ofproto in handle_upcalls().

   2. Main thread removes ofproto and destroys it in destruct().

   3. Handler thread uses pointer to ofproto and accesses freed memory.
      BOOM!

Each individual step above happens under the xlate_rwlock, but the ofproto
pointer is retained from step 1 to step 3, hence the problem.  This commit
fixes the problem by ensuring that after an ofproto is removed but before
it is destroyed, all packet translations get pushed all the way through
the upcall handler pipeline.  (No new packet translations can get a pointer
to the removed ofproto.)

Bug #1200351.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
10 years agoofproto-dpif: Fix segfault removing port when STP is enabled.
Ben Pfaff [Fri, 21 Feb 2014 20:40:00 +0000 (12:40 -0800)]
ofproto-dpif: Fix segfault removing port when STP is enabled.

Reported-by: Sridhar Samudrala <samudrala.sridhar@gmail.com>
Tested-by: Sridhar Samudrala <samudrala.sridhar@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto: Update only OFPUTIL_PS_LINK_DOWN (not STP) from netdev state.
Ben Pfaff [Thu, 20 Feb 2014 20:13:26 +0000 (12:13 -0800)]
ofproto: Update only OFPUTIL_PS_LINK_DOWN (not STP) from netdev state.

When a netdev indicates that its state or configuration has changed,
update_port() updates the OpenFlow port to match the changes.  However,
this was being taken too far: a netdev does not have an STP state, and a
state change was resetting the STP state of the port.  This fixes the
problem.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reported-by: Vasu Dasari <vdasari@gmail.com>
Tested-by: Vasu Dasari <vdasari@gmail.com>
10 years agoipfix: fix upcall cookie size checks to support 8 byte cookies
Romain Lenglet [Tue, 11 Feb 2014 23:21:08 +0000 (15:21 -0800)]
ipfix: fix upcall cookie size checks to support 8 byte cookies

Commit 96ed775f resizes all userspace metadata to be 8 bytes minimum.
Fix the upcall size checks accordingly.

Signed-off-by: Romain Lenglet <rlenglet@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vsctl: reconnect to the database if connection was dropped
Ansis Atteka [Tue, 18 Feb 2014 21:19:36 +0000 (13:19 -0800)]
ovs-vsctl: reconnect to the database if connection was dropped

If ovs-vsctl has to wait for ovs-vswitchd to reconfigure itself
according to the new database, then sometimes ovs-vsctl could
end up stuck in the event loop if OVSDB connection was dropped
while ovs-vsctl was still running.

This patch fixes this problem by letting ovs-vsctl to reconnect
to the OVSDB, if it has to wait cur_cfg field to be updated.

Issue: 1191997
Reported-by: Spiro Kourtessis <spiro@nicira.com>
Signed-Off-By: Ansis Atteka <aatteka@nicira.com>
10 years agodatapath: fix dp check in ovs_dp_reset_user_features
Jiri Pirko [Sun, 16 Feb 2014 01:30:23 +0000 (17:30 -0800)]
datapath: fix dp check in ovs_dp_reset_user_features

This fixes crash when userspace does "ovs-dpctl add-dp dev" where dev is
existing non-dp netdevice.

Introduced by:
commit 94358dcffbec33cbcfd425e925139fd7e9d6153f
"openvswitch: Drop user features if old user space attempted to create datapath"

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix race.
Jarno Rajahalme [Tue, 11 Feb 2014 23:34:39 +0000 (15:34 -0800)]
datapath: Fix race.

ovs_vport_cmd_dump() did rcu_read_lock() only after getting the
datapath, which could have been deleted in between.  Resolved by
taking rcu_read_lock() before the get_dp() call.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agometa-flow: Fix setting MFF_IP_FRAG.
Jarno Rajahalme [Fri, 7 Feb 2014 19:34:02 +0000 (11:34 -0800)]
meta-flow: Fix setting MFF_IP_FRAG.

mf_set_flow_value() was not setting 'flow->nw_frag' properly.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
10 years agoofproto-dpif-xlate: Make flows that match ICMP fields revalidate correctly.
Ben Pfaff [Tue, 11 Feb 2014 16:24:16 +0000 (08:24 -0800)]
ofproto-dpif-xlate: Make flows that match ICMP fields revalidate correctly.

ICMPv4 and ICMPv6 have 8-bit "type" and "code" fields.  struct flow
uses the low 8 bits of the 16-bit tp_src and tp_dst members to
represent these fields.  The datapath interface, on the other hand,
represents them with just 8 bits each.  This means that if the high 8
bits of the masks for these fields somehow become set (meaning to
match on the nonexistent "high bits" of these fields) during
translation, then they will get chopped off by a round trip through
the datapath, and revalidation will spot that as an inconsistency and
delete the flow.  This commit avoids the problem by making sure that
only the low 8 bits of either field can be unwildcarded for ICMP.

This seems like the minimal fix for this problem, appropriate for
backporting to earlier branches.  The root of the issue is that these high
bits can get set in the match at all.  I have some leads on that, but they
require more invasive changes elsewhere.

Bug #23320.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
10 years agoupcall: Avoid divide-by-zero calculating flow limit
Joe Stringer [Tue, 28 Jan 2014 21:04:35 +0000 (13:04 -0800)]
upcall: Avoid divide-by-zero calculating flow limit

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agopackets: Fix userland implementation of set-field ipv6 addresses
YAMAMOTO Takashi [Fri, 24 Jan 2014 06:50:41 +0000 (15:50 +0900)]
packets: Fix userland implementation of set-field ipv6 addresses

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-vsctl: Update will be discarded when multiple ovs-vsctl are executed
Ken Ajiro [Tue, 28 Jan 2014 01:20:43 +0000 (01:20 +0000)]
ovs-vsctl: Update will be discarded when multiple ovs-vsctl are executed

When two ovs-vsctl update map type column at same time, one ovs-vsctl's
update will be discarded although all ovs-vsctl succeeded. This patch
fixes this issue.

Signed-off-by: Ken Ajiro <ajiro@mxw.nes.nec.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapth: Suppress error messages on megaflow updates
Andy Zhou [Fri, 31 Jan 2014 23:47:58 +0000 (15:47 -0800)]
datapth: Suppress error messages on megaflow updates

With subfacets, we'd expect megaflow updates message to carry
the original micro flow. If not, EINVAL is returned and kernel
logs an error message.  Now that the user space subfacet layer is
removed, it is expected that flow updates can arrive with a
micro flow other than the original. Change the return code to
EEXIST and remove the kernel error log message.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix ovs_flow_free() ovs-lock assert.
Pravin B Shelar [Tue, 28 Jan 2014 02:18:33 +0000 (18:18 -0800)]
datapath: Fix ovs_flow_free() ovs-lock assert.

ovs_flow_free() is not called under ovs-lock during packet
execute path (ovs_packet_cmd_execute()). Since packet execute
does not touch flow->mask, there is no need to take that
lock either. So move assert in case where flow->mask is checked.

Found by code inspection.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Andy Zhou <azhou@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agobridge: Set ofport column in every database transaction.
Ben Pfaff [Fri, 31 Jan 2014 00:57:16 +0000 (16:57 -0800)]
bridge: Set ofport column in every database transaction.

Database transactions can occasionally fail due to concurrent changes in
the database.  When that happens, the next transaction should repeat the
changes that ovs-vswitchd tried to make the first time (adjusted for the
changes to the database).

The code to report the OpenFlow port number in use didn't do that.  It set
the ofport field once when it created the port and never set it again, even
if the transaction to set it failed.  This commit fixes the problem.

Bug #23047.
Reported-by: Suganya Ramachandran <suganyar@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agoofproto-dpif-upcall: Hardcode max_idle to 1500ms.
Ethan Jackson [Tue, 28 Jan 2014 00:40:27 +0000 (16:40 -0800)]
ofproto-dpif-upcall: Hardcode max_idle to 1500ms.

Before this patch, OVS tried to guess an optimal max idle time for
datapath flows based on the number of datapath flows relative to the
limit.  This caused instability because the limit was based on the
dump duration which was affected by the max idle time.  This patch
chooses instead to hardcode the max idle time to 1.5s except in
extreme case where the datapath flow limit is exceeded.  1.5s was
chosen to ensure pings occurring at once per second stay cached in the
datapath.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agodatapath: Fix ovs_dp_cmd_msg_size()
Daniele Di Proietto [Thu, 23 Jan 2014 16:18:59 +0000 (17:18 +0100)]
datapath: Fix ovs_dp_cmd_msg_size()

commit c58cc9a460fd158e5250e59902e96ac677dc115f (datapath: Allow user space to
announce ability to accept unaligned Netlink messages) introduced
OVS_DP_ATTR_USER_FEATURES netlink attribute in datapath responses,
but the attribute size was not taken into account in ovs_dp_cmd_msg_size().

Signed-off-by: Daniele Di Proietto <daniele.di.proietto@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoipsec: install iptables rules that set IPsec bit in skb mark
Ansis Atteka [Tue, 21 Jan 2014 01:16:39 +0000 (17:16 -0800)]
ipsec: install iptables rules that set IPsec bit in skb mark

Without these two iptables rules (one for UDP encapsulated IPsec and
another for direct IPsec), ovs-vswitchd would incorrectly conclude
that GRE packet belonged to a plain GRE tunnel instead of IPsec GRE
tunnel.

Reported-by: Aryan TaheriMonfared <aryan.taherimonfared@uis.no>
Reported-by: Daniel Hiltgen <daniel@netkine.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
10 years agobfd: Add bfd_src_ip and bfd_dst_ip.
Alex Wang [Tue, 21 Jan 2014 22:23:27 +0000 (14:23 -0800)]
bfd: Add bfd_src_ip and bfd_dst_ip.

This commit adds two new options, bfd_src_ip and bfd_dst_ip
respectively, which allows user to configure the source and
destination IP address of bfd control packet.  If the user
specified address cannot be parsed, the default address
will be used.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoupcall: Cache the number of flows from the datapath.
Joe Stringer [Wed, 22 Jan 2014 06:50:49 +0000 (06:50 +0000)]
upcall: Cache the number of flows from the datapath.

Fetching the number of flows in the datapath has been causing
unnecessary contention on the kernel ovs_lock in recent TCP CRR tests.
This patch caches this number for up to 100ms in the userspace to reduce
such kernel calls.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Co-authored-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off--by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agovlog: Avoid deadlock in vlog_init__() corner case.
Ben Pfaff [Fri, 6 Dec 2013 00:59:13 +0000 (16:59 -0800)]
vlog: Avoid deadlock in vlog_init__() corner case.

Anything inside vlog_init__() that tried to log a message was going to
deadlock, since it would hit pthread_once() recursively and wait for the
previous call to complete.  Unfortunately, there was a VLOG_ERR call inside
vlog_init__(), only called in the corner case where the system's clock was
wrong.

This fixes the problem by rearranging code so that the logging isn't
inside the "once-only" region.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Fix kernel panic on ovs_flow_free
Andy Zhou [Fri, 10 Jan 2014 23:57:04 +0000 (15:57 -0800)]
datapath: Fix kernel panic on ovs_flow_free

Both mega flow mask's reference counter and per flow table mask list
should only be accessed when holding ovs_mutex() lock. However
this is not true with ovs_flow_table_flush(). The patch fixes this bug.

Reported-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
10 years agodatapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed
Thomas Graf [Tue, 14 Jan 2014 09:27:02 +0000 (01:27 -0800)]
datapath: Pad OVS_PACKET_ATTR_PACKET if linear copy was performed

While the zerocopy method is correctly omitted if user space
does not support unaligned Netlink messages. The attribute is
still not padded correctly as skb_zerocopy() will not ensure
padding and the attribute size is no longer pre calculated
though nla_reserve() which ensured padding previously.

This patch applies appropriate padding if a linear data copy
was performed in skb_zerocopy().

Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.
YAMAMOTO Takashi [Wed, 15 Jan 2014 18:06:40 +0000 (10:06 -0800)]
ofproto-dpif-xlate: Avoid recursive acquisition of xlate_rwlock.

Currently xlate_rwlock is recursively acquired.
(xlate_send_packet -> ofproto_dpif_execute_actions -> xlate_actions)
Due to writer-preference in rwlock implementations, this causes
deadlock if another thread tries to acquire the lock exclusively
behind us.

This change avoids the problem by making xlate_send_packet drop
the lock before calling ofproto_dpif_execute_actions.  This is the
simplest fix but opens a race window against port reconfigurations.
Given the way xlate_send_packet is currently used, the race does not
seem a big problem.  An alternative would be passing down the
"xlate_rwlock is held" info to ofproto_dpif_execute_actions.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-xlate: Fix a whitespace error.
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:22 +0000 (12:41 +0900)]
ofproto-dpif-xlate: Fix a whitespace error.

No functional changes.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agofat-rwlock: Don't forget to destroy a mutex
YAMAMOTO Takashi [Wed, 15 Jan 2014 03:41:21 +0000 (12:41 +0900)]
fat-rwlock: Don't forget to destroy a mutex

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoclassifier: Use fat_rwlock instead of ovs_rwlock.
Ben Pfaff [Mon, 13 Jan 2014 19:21:12 +0000 (11:21 -0800)]
classifier: Use fat_rwlock instead of ovs_rwlock.

Jarno Rajahalme reported up to 40% performance gain on netperf TCP_CRR with
an earlier version of this patch in combination with a kernel NUMA patch,
together with a reduction in variance:
    http://openvswitch.org/pipermail/dev/2014-January/035867.html

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agofat-rwlock: New big but fast synchronization primitive.
Ben Pfaff [Mon, 13 Jan 2014 19:17:55 +0000 (11:17 -0800)]
fat-rwlock: New big but fast synchronization primitive.

This implements a reader-writer lock that uses a lot of memory (128 to 192
bytes per thread that takes the lock) but avoids cache line bouncing when
taking the read side.  Thus, a fat_rwlock is a good choice for rwlocks
taken frequently by readers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoovs-thread: Add new support for thread-specific data.
Ben Pfaff [Tue, 14 Jan 2014 22:35:48 +0000 (14:35 -0800)]
ovs-thread: Add new support for thread-specific data.

A couple of times I've wanted to create a dynamic data structure that has
thread-specific data, but I've not been able to do that because
PTHREAD_KEYS_MAX is so low (POSIX says at least 128, glibc is only a little
bigger at 1024).  This commit introduces a new form of thread-specific data
that supports a large number of items.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agoofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.
Ben Pfaff [Fri, 10 Jan 2014 23:17:43 +0000 (15:17 -0800)]
ofproto-dpif: Un-wildcard nw_frag only for protocols that have fragments.

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, a couple of pieces of
code in ofproto-dpif always marked nw_frag (which tracks whether a packet
is an IPv4 or IPV6 fragment) as exact-match.  For non-IP protocols, this
wasn't meaningful, so adding such a flow to the datapath and then receiving
it back caused nw_frag to become wildcarded, so revalidate_ukey() always
deleted them.

This fixes the problem by only un-wildcarding nw_frag for protocols where
it is defined (IPv4 and IPv6).

Noticed while observing CFM traffic (which isn't IP based) over a tunnel.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agotunnel: Un-wildcard only flags that really exist in tnl_xlate_init().
Ben Pfaff [Fri, 10 Jan 2014 23:14:27 +0000 (15:14 -0800)]
tunnel: Un-wildcard only flags that really exist in tnl_xlate_init().

The revalidator code in ofproto-dpif-upcall.c, in revalidate_ukey(),
deletes any datapath flow for which the kernel reports wildcarded bits
that userspace requires to be matched.  Until now, tnl_xlate_init() marked
every bit in the tunnel flags as required to be matched.  Since most of
those bits don't actually have defined flags, adding such a flow to the
datapath and then receiving it back caused those bits to become wildcarded,
which meant that revalidate_ukey() always deleted them.

This fixes the problem by only un-wildcarding defined flags.

Reported-by: Guolin Yang <gyang@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.
Ben Pfaff [Mon, 13 Jan 2014 23:33:27 +0000 (15:33 -0800)]
ofproto-dpif-upcall: Avoid unnecessarily installing datapath flows.

handle_upcalls() always installed a flow for every packet, as long as
the datapath didn't already have too many flows, but there are cases where
we don't want to do this:

    - If we get multiple packets in a single microflow all in one batch
      (perhaps due to GSO breaking up a large TCP packet for sending to
      userspace, or for another reason), then we only need to install the
      datapath flow once.

    - For a slow-pathed flow received via a slow-path action in the kernel,
      we know that the kernel flow is already there (because otherwise it
      would have been received as "no match" instead of an action), so
      there is no benefit to reinstalling it.

Noticed because a CFM slow-pathed flow was getting reinstalled every time
a CFM packet was received.

Reported-by: Guolin Yang <gyang@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agosFlow: clear the padding
Francesco Fusco [Thu, 19 Dec 2013 17:16:24 +0000 (18:16 +0100)]
sFlow: clear the padding

putString pads the string to the 4-byte boundary without
clearing the "padded" memory. This patch simply set the
padding to zero.

Signed-off-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoUpdate build requirements.
Ben Pfaff [Tue, 31 Dec 2013 22:23:34 +0000 (14:23 -0800)]
Update build requirements.

Libtool is now required as of commit 38b7a52b61 (openvswitch: Use libtool
and allow building shared libs).

It seems that a build requirement for Python slipped in a while back, for
generating ovs-vswitchd.conf.db.5, and no one complained, so we might as
well make it official.  (That will let us simplify some bits of the build,
too, since they won't have to be conditional on Python anymore, so I'm all
in favor of this change.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Fix cpath_down set failure.
Alex Wang [Thu, 9 Jan 2014 02:51:43 +0000 (18:51 -0800)]
bfd: Fix cpath_down set failure.

Commit ccc09689 (bfd: Implement Bidirectional Forwarding Detection.)
set the bfd local diagnostic to "Concatenated Path Down" in response
to the set of cpath_down only when the current local diagnostic is
"None".  However, since the bfd local diagnostic is not reset when
the bfd state is restored from last erroneous state, the set of
cpath_down will not update the local diagnostic in that case.

This commit fixes the bug by always checking for local diagnostic
change when cpath_down is set or reset.

Bug #22625
Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
10 years agodatapath: Use kmem_cache_free() instead of kfree()
Wei Yongjun [Wed, 8 Jan 2014 14:07:52 +0000 (06:07 -0800)]
datapath: Use kmem_cache_free() instead of kfree()

memory allocated by kmem_cache_alloc() should be freed using
kmem_cache_free(), not kfree().

Fixes: e298e5057006 ('openvswitch: Per cpu flow stats.')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agoofproto-dpif: Fix a vlan-splinter megaflow bug
Andy Zhou [Tue, 7 Jan 2014 08:17:25 +0000 (00:17 -0800)]
ofproto-dpif: Fix a vlan-splinter megaflow bug

When vlan-splinter is enabled, ovs receives non-vlan flows from the
kernel vlan ports, vlan tag is then added to the incoming flow before
xlating, so that they look like those received from a trunk port.

In case megaflow is enabled, xlating may set vlan masks during rule
processing as usual. If those vlan masks were serialized and downloaded
to the kernel (this bug), those mega flows will be rejected due to
unexpected vlan mask encapsulation, since the original kernel flows do
not have vlan tags. This bug does not break connectivity, but impacts
performance since all traffic received on vlan splinter ports will now
be handled by vswitchd, as no datapath flows can be successfully
installed.

This fix is to make sure no vlan mask encapsulation is generated for
the datapath flow if its in_port was re-written by vlan-splinter
receiving logic.

Bug #22567

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: Check for backported sctp_compute_cksum().
Jesse Gross [Fri, 3 Jan 2014 23:44:28 +0000 (15:44 -0800)]
datapath: Check for backported sctp_compute_cksum().

This is backported by RHEL7.

Reported-by: Ashok Byahatti <ashok.byahatti@embrane.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agoodp-util: Avoid null dereference in parse_8021q_onward().
Ben Pfaff [Tue, 31 Dec 2013 19:32:16 +0000 (11:32 -0800)]
odp-util: Avoid null dereference in parse_8021q_onward().

For parsing a mask, this code in parse_8021q_onward() always read out
the OVS_KEY_ATTR_VLAN attribute without first checking whether it existed.
The correct behavior, implemented by this commit, appears to be treating
the VLAN as wildcarded and to continue parsing the flow.

Bug #22312.
Reported-by: Krishna Miriyala <miriyalak@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
10 years agobridge: Fix reversed string parsing in bridge_configure_flow_miss_model().
Alex Wang [Mon, 30 Dec 2013 22:21:40 +0000 (14:21 -0800)]
bridge: Fix reversed string parsing in bridge_configure_flow_miss_model().

This commit fixes a command matching error introduced by commit
7155fa52f (ofproto-dpif: Add 'force-miss-model' configuration).

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agobfd: Notify connectivity_seq on rmt_state changes.
Joe Stringer [Wed, 25 Dec 2013 00:50:53 +0000 (16:50 -0800)]
bfd: Notify connectivity_seq on rmt_state changes.

The bfd module did not previously change the global connectivity_seq
when the remote state changed, which means that such state changes may
not be propagated to the database. This is particularly bad if this is
the last state transition to happen in an otherwise stable environment.
This patch checks for transitions in remote state, and ensures that the
main thread will update the database when these happen.

Bug #22136.

Co-authored-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofp-parse: Check port number only after parsing it in parse_output().
Daisuke Kotani [Mon, 23 Dec 2013 09:19:48 +0000 (18:19 +0900)]
ofp-parse: Check port number only after parsing it in parse_output().

This patch allows to set max_len to UINT16_MAX in parse_output
if output port is OFPP_CONTROLLER.

Signed-off-by: Daisuke Kotani <kotani@net.ist.i.kyoto-u.ac.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoPrepare for 2.1.0.
Justin Pettit [Tue, 24 Dec 2013 00:15:46 +0000 (16:15 -0800)]
Prepare for 2.1.0.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: compat: Configure check GRE DEMUX.
Pravin B Shelar [Mon, 23 Dec 2013 03:43:58 +0000 (19:43 -0800)]
datapath: compat: Configure check GRE DEMUX.

RHEL6-openstack kernel has backported gre DEMUX module,
Therefore add configure check to detect it.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Bug #21936

10 years agodatapath: compat: Add configure check for lockdep_rtnl_is_held()
Pravin B Shelar [Fri, 20 Dec 2013 23:34:40 +0000 (15:34 -0800)]
datapath: compat: Add configure check for lockdep_rtnl_is_held()

RHEL6-openstack kernel has backported lockdep_rtnl_is_held().

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: compat: Fix skb_has_frag_list definition.
Pravin B Shelar [Fri, 20 Dec 2013 22:30:28 +0000 (14:30 -0800)]
datapath: compat: Fix skb_has_frag_list definition.

RHEL6-openstack kernel has already replaced skb_has_frags
with skb_has_frag_list().

Fix compilation error on RHEL6-openstack.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
10 years agobitmap: add bitmap_count1 function
Ben Pfaff [Mon, 23 Dec 2013 20:56:14 +0000 (12:56 -0800)]
bitmap: add bitmap_count1 function

Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-dev.py: Pass leak-check=full to valgrind.
Ethan Jackson [Thu, 12 Dec 2013 03:04:10 +0000 (19:04 -0800)]
ovs-dev.py: Pass leak-check=full to valgrind.

This valgrind leak checker isn't really useful without this.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Acked-by: Joe Stringer <joestringer@nicira.com>
10 years agocompiler.h: Update documentation
Joe Stringer [Fri, 20 Dec 2013 20:52:52 +0000 (12:52 -0800)]
compiler.h: Update documentation

OVS_LOCKS_EXCLUDED doesn't exist. This should be OVS_EXCLUDED.

Signed-off-by: Joe Stringer <joestringer@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoNEWS: Mention new ovs-ofctl ofp-parse-pcap command.
Ben Pfaff [Mon, 23 Dec 2013 18:41:14 +0000 (10:41 -0800)]
NEWS: Mention new ovs-ofctl ofp-parse-pcap command.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoovs-ofctl: New command "ofp-parse-pcap" to dump OpenFlow from PCAP files.
Ben Pfaff [Fri, 22 Nov 2013 21:17:23 +0000 (13:17 -0800)]
ovs-ofctl: New command "ofp-parse-pcap" to dump OpenFlow from PCAP files.

Based on the number of people who ask about Wireshark support for OpenFlow,
this is likely to be widely useful.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agopcap-file: Add timestamp support for reading and writing pcap files.
Ben Pfaff [Fri, 22 Nov 2013 19:42:06 +0000 (11:42 -0800)]
pcap-file: Add timestamp support for reading and writing pcap files.

Only the write support is initially useful, but an upcoming commit will add
a user for the read support.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agoofpbuf: New function ofpbuf_shift().
Ben Pfaff [Fri, 22 Nov 2013 19:42:42 +0000 (11:42 -0800)]
ofpbuf: New function ofpbuf_shift().

An upcoming commit will add the first user.

Signed-off-by: Ben Pfaff <blp@nicira.com>
10 years agodatapath: bug.h missing from distfiles
Chris Luke [Sun, 22 Dec 2013 22:43:33 +0000 (14:43 -0800)]
datapath: bug.h missing from distfiles

commit 7c359202 introduced datapath/linux/compat/include/bug.h
but did not include it in datapath/linux/Modules.mk, which results
in the following build error:

> The distribution is missing the following files:
> datapath/linux/compat/include/linux/bug.h

Signed-off-by: Chris Luke <chris_luke@cable.comcast.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agodatapath: Fix sparse warning on BUILD_BUG_ON_INVALID()
Andy Zhou [Sat, 21 Dec 2013 00:18:58 +0000 (16:18 -0800)]
datapath: Fix sparse warning on BUILD_BUG_ON_INVALID()

Sparse gives the following warnings when compile against Linux kernel
3.5:

 CHECK   /root/projs/ovs/openvswitch/datapath/linux/skbuff-openvswitch.c
 include/linux/mm.h:405:9: error: undefined identifier
 'BUILD_BUG_ON_INVALID'
 include/linux/mm.h:405:9: error: not a function <noident>

The same issue may also exist in kernel 3.6.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
10 years agobfd: Send FINAL immediately after receiving POLL.
Alex Wang [Fri, 20 Dec 2013 22:53:52 +0000 (14:53 -0800)]
bfd: Send FINAL immediately after receiving POLL.

Commit 307464a11 (ofproto-dpif-monitor: Use heap to order the mport
wakeup time.) makes bfd only send packet at specified periodic instant.
This fails to meet the RFC5880 requirement, which requires bfd send
FINAL immediately after receiving POLL.

This commit fixes the above issue by scheduling bfd to send FINAL
within 100 ms after receiving POLL.

Signed-off-by: Alex Wang <alexw@nicira.com>
10 years agodatapath: Check for backported netdev_features_t.
Jesse Gross [Tue, 17 Dec 2013 18:22:40 +0000 (10:22 -0800)]
datapath: Check for backported netdev_features_t.

This is apparently used by CentOS 6.5.

Reported-by: Phil Daws <uxbod@splatnix.net>
Reported-by: Edouard Bourguignon <madko@linuxed.net>
Signed-off-by: Jesse Gross <jesse@nicira.com>
10 years agolinux: Report supported user features to the kernel
Thomas Graf [Thu, 19 Dec 2013 15:20:42 +0000 (16:20 +0100)]
linux: Report supported user features to the kernel

Following commit (''netlink: Do not enforce alignment of last Netlink
attribute''), signal the ability to receive unaligned Netlink messages
to the datapath to enable utilization of zerocopy optimizations.

Opening a datapath is now done by issueing a OVS_DP_CMD_SET in order
to overwrite previously set user features.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>