ofproto, ofp-util: Begin disentangling packet-in wire format and handling.

struct ofputil_packet_in mixes data included in OpenFlow packet_in messages
with data that used internally by ofproto and connmgr to queue and route
packet_ins.  This commit begins disentangling these purposes by adding a
new struct ofproto_packet_in that wraps struct ofputil_packet_in.  Adding
this new level of indirection causes a lot of code churn, so this commit
mainly takes care of that to make the remaining changes easier to read.

This commit does move the list node used for queuing packet_ins into the
new wrapper structure.

Signed-off-by: Ben Pfaff <blp@nicira.com>
connmgr: Move controller_id from ofputil_packet_in to ofproto_packet_in.

controller_id isn't part of the OpenFlow message, so it shouldn't be in
ofputil_packet_in.

Signed-off-by: Ben Pfaff <blp@nicira.com>
connmgr: Move send_len from ofputil_packet_in to ofproto_packet_in.

send_len is not directly part of the OpenFlow packet_in message, at least
given that it is partially redundant with packet_len.  send_len is, rather,
a request to the connmgr that expresses how many bytes the action requested
be sent to the controller, but the connmgr cannot always honor it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Improve comments on struct ofputil_packet_in.

Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-util: Use correct cookie value in "packet_in"s when no flow involved.

OpenFlow 1.3 uses all-1-bits in a packet_in to indicate that the packet_in
was not generated by a flow, but Open vSwitch incorrectly used 0.  This
fixes the problem.

For consistency, this commit also changes NXT_PACKET_IN to use all-1-bits
for this case, event though NXT_PACKET_IN was previously defined to use
zero.  This doesn't appear to make a difference for the NVP controller; if
it causes a problem for some other controller then I will revert that part
of the change.

Found by inspection.

Signed-off-by: Ben Pfaff <blp@nicira.com>
fail-open: Add function to identify fail-open's flows.

This seems slightly cleaner than embedding this logic directing into
ofproto-dpif, since it is an interface that theoretically could be useful
to other ofproto providers.

Signed-off-by: Ben Pfaff <blp@nicira.com>
connmgr: Fix packet-in reason for OpenFlow1.3 table-miss flow entries.

As per spec, make packet-in reason for OpenFlow1.3 table-miss flow
entries no_match rather than action.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
pinsched: Eliminate function callback in interface.

I'm not a fan of function callbacks because I feel that they obscure
interfaces.  This eliminates the function callback used until now in
the pinsched code.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Fix ovs-ofctl documentation.

State that if decrementing makes a TTL zero, controller notifications
may be sent.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Allow OFPACT_SET_IP_DSCP to act on both IPv4 and IPv6 packets.

This removes semantic differences between different OpenFlow
versions, making it easier to translate between them.
Also, rename OFPACT_SET_IPV4_DSCP to OFPACT_SET_IP_DSCP.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Add OF11 set IPv4 ECN action.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Add OF11 SET IP TTL action.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-actions: Make union ofp_action more generic.

Make union ofp_action more generic by allowing it to be used for
all actions.  OFP_ACTION_ALIGN (which is 8, as the sizeof(union
ofp_action) used to be) is now used where sizeof union ofp_action
was used before.  On the same note, variable name 'n_actions' is
changed to 'max_actions' as the number of actions cannot be simply
divided when actions have various sizes.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-actions: Enforce action consistency.

OpenFlow 1.1+ specs encourage switches to verify action consistency
at flow setup time.  Implement this for OpenFlow 1.1+ only to not
break any current OF 1.0 based use.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath: Per cpu flow stats.

With mega flow implementation ovs flow can be shared between
multiple CPUs which makes stats updates highly contended
operation. Following patch allocates separate stats for each
CPU to make stats update scalable.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
connmgr: Fix an abort.

Fix a problem introduced by commit cfa955b083c5617212a29a03423e063ff6cb350a.
(connmgr: Fix packet-in reason for OpenFlow1.3 table-miss flow entries.).

ofconn might not be connected here, in that case
ofputil_protocol_to_ofp_version aborts.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofp-print: Update a printf format for the recent pin.total_len change.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>