seq: Attribute wakeups to seq_wait()'s caller, not to seq_wait() itself.

The poll_loop code has a feature that, when turned on manually or
automatically (due to high CPU use), logs the source file and line number
of the code that caused a thread to wake up from poll().  Until now, when
a function calls seq_wait(), the source file and line number logged was
the code inside seq_wait().  seq_wait() has many callers, so that
information is not as useful as it could be.  This commit changes the
source file and line number used to be that of seq_wait()'s caller.

I found this useful for debugging.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto: per-table statistics

Add per-table counters. This resolves some short-comings
in the data provided in a table stats reply message.

* Lookups and matches are calculated based on table
  accesses rather than datapath flow hits and misses.

* Lookups and matches are credited to the table where they
  occurred rather than all being credited to table 0.

These problems were observed when running make check-ryu
and this patch allows many of its tester.py match checks
to pass.

Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
bridge: Add test that ports that disappear get added back to the datapath.

The test added in this commit would have caught the bug fixed by commit
96be8de595150 (bridge: When ports disappear from a datapath, add them
back.).  With that commit reverted, the new test fails.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Gurucharan Shetty <gshetty@nicira.com>
ofproto: Remove ofproto_group_write_lookup()

ofproto_group_write_lookup() slightly different from
ofproto_group_lookup() in handling reference counting.
Currently, it has only one caller: modify_group().
It seems the abstraction is not adding value here.

Remove the function, along with some refactoring, makes modify_group()
easier to understand.

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ryan Wilson <wryan@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif: remove a redundant assignment

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-xlate: Simplify group_is_alive

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto-dpif-xlate: Coding style fix for bucket_is_alive()

Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
userspace: add support for pop_eth and push_eth actions

These actions will allow L2->L3 and L3->L2 switching, and are supposed
to be added to flows installed in the datapath transparently by
ovs-vswitchd.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
userspace: add layer 3 flow and switching support

This commit relaxes the assumption that all packets have an Ethernet
header, and adds support for layer 3 flows.  For each packet received on
the Linux kernel datapath the l2 and l3 members of struct ofpbuf are
intialized appropriately, and some functions now expect this (notably
flow_extract()), in order to differentiate between layer 2 and layer 3
packets.  struct flow has now a new 'base_layer' member, because we
cannot assume that a flow has no Ethernet header when eth_src and
eth_dst are 0.  For layer 3 packets, the protocol type is still stored
in the eth_type member.

Switching L2->L3 and L3->L2 are both implemented by adding the pop_eth
and push_eth actions respectively when a transition is detected.  The
push_eth action puts 0s on both source and destination MACs.  These
addresses can be modified with mod_dl_dst and mod_dl_src actions.

Added new prerequisite MFP_ETHERNET for fields MFF_ETH_SRC, MFF_ETH_DST,
MFF_VLAN_TCI, MFF_DL_VLAN, MFF_VLAN_VID and MFF_DL_VLAN_PCP.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>
datapath: add layer 3 flow/port support

Implementation of the pop_eth and push_eth actions in the kernel, and
layer 3 flow support.

Signed-off-by: Lorand Jakab <lojakab@cisco.com>