meta-flow: Fix and simplify mf_get_mask().

This function can be implemented as a trivial wrapper around
mf_get_value(), which I hadn't noticed before, so it's better to do it
that way.  Also, examining the code that is removed, it had some bugs in
it (for example, all MFF_TUN_* fields were treated as if they were
MFF_TUN_ID) which mf_get_value() does not have, so this fixes bugs too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
vswitchd: log skb_mark and skb_priority

This patch adds logging support for skb_mark and skb_priority.

Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
ofproto-dpif: Avoid potential undefined behavior in type_run().

When HMAP_FOR_EACH completes, the value in the loop control variable is not
necessarily NULL.  It is NULL minus the offset of the hmap_node struct
member, which is nonnull if that offset is nonzero.  Currently,
'all_ofproto_dpifs_node' is the first member in struct ofproto_dpif, so
there is no real bug, but there would be if the struct were rearranged.

This commit heads off the problem by avoiding any assumption about the
loop control variable after HMAP_FOR_EACH.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Fix memory leak in type_run().

The dpif_port_destroy() call was in the dpif_port_query_by_name() error
path, when there's nothing to destroy, rather than in the "success" path,
where there is data to destroy.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: Fix another memory leak in type_run().

'devname' needs to be destroyed whether it's the datapath device or not.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto, ofproto-dpif: Fix memory leaks of struct iface_hint structures.

Signed-off-by: Ben Pfaff <blp@nicira.com>
meta-flow: Correctly byteswap skb_priority/skb_mark for mf_value.

Fixes the following sparse warnings:

meta-flow.c:947:21: warning: incorrect type in assignment (different base types)
meta-flow.c:947:21:    expected restricted __be32 [usertype] be32
meta-flow.c:947:21:    got unsigned int const [unsigned] [usertype] skb_priority
meta-flow.c:951:21: warning: incorrect type in assignment (different base types)
meta-flow.c:951:21:    expected restricted __be32 [usertype] be32
meta-flow.c:951:21:    got unsigned int const [unsigned] [usertype] skb_mark

Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: support Linux 3.7

datapath: backport 15e473046cb6e5d18a4d0057e61d76315230382b

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
[jesse: fix kernel version in error message]
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath: linux2.7 s/pid/portid/g

the following up of 15e473046cb6e5d18a4d0057e61d76315230382b
This patch replaces pid with portid under datapath/linux/compat

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Add ODP level handling of OVS_KEY_ATTR_IPV4_TUNNEL.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme@nsn.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
ovsdb-doc: Fix formatting at top of generated manpage.

This keeps the first paragraph of text from running into the title.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
ofproto: Remove trailing whitespace.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
xenserver: Downgrade not on XenServer warning to DBG.

This log message is annoying and of questionable usefulness.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
ovs: Replace TODO:XXX with XXX.

According to the coding style, XXX is the appropriate tag for code
that needs work.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
ofproto-dpif: User proper type for odp_port when outputting.

Found by inspection.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
ofproto-dpif: Don't output to nonexistent ports.

In older versions of Open vSwitch, one could reasonably predict
that the datapath port number would be the same as the OpenFlow
port number even for ports which may not exist yet.  With the
single datapath model, it's no possible longer to make this
prediction.  Therefore, instead of attempting to, this code simply
drops packets which output to a nonexistent port.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
ovs-ctl: Exit, instead of resuming, after handling fatal signals.

When I wrote the "trap" calls in ovs-ctl, I had the mistaken notion that
"trap $cmd $signal" would execute $cmd and then exit when $signal was
caught.  This is incorrect.  Instead, it executes $cmd and then resumes
executing the shell script.

On the other hand, "trap $cmd 0" does by itself what I wanted: it causes
the shell to execute $cmd and then exits due to the signal.  So this commit
changes the offending traps to use this form.

Bug #14290.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Kyle Mestery <kmestery@cisco.com>
netdev-vport: Remove the ability to send packets.

The only user of netdev_send() is dpif-netdev which doesn't support
vports.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
netdev-vport: Remove set_stats() implementation.

The only user of netdev_set_stats() is bonding (for updating the
fake interface).  This interface is never a vport, so it seems
quite a bit cleaner to keep the relevant code in the netdev-linux
library where it's needed, instead of in netdev-vport, where it
adds needless complexity.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
ofproto: Remove ofproto_set_desc().

Nothing calls it, and it's a lousy interface.

Signed-off-by: Ben Pfaff <blp@nicira.com>