openflow: Better abstract handling of packet-in messages.
authorBen Pfaff <blp@ovn.org>
Wed, 20 Jan 2016 17:57:16 +0000 (09:57 -0800)
committerBen Pfaff <blp@ovn.org>
Wed, 20 Jan 2016 17:57:16 +0000 (09:57 -0800)
commit9bfe933472a784cd6b3f946afc3eed73d74f6a7d
tree0f9ade568c83b24cf3ec18c2932cb4950fdf4c6f
parent730b985b03f79b5bd9c46edb8f1dc77a7db92547
openflow: Better abstract handling of packet-in messages.

Packet-in messages have been a bit of a mess.  First, their abstraction
in the form of struct ofputil_packet_in has some fields that are used
in a clear way for incoming and outgoing packet-ins, and others
(packet_len, total_len, buffer_id) have have confusing meanings or
usage pattern depending on their direction.

Second, it's very confusing how a packet-in has both a reason (OFPR_*)
and a miss type (OFPROTO_PACKET_IN_*) and how those add up to the
actual reason that is used "on the wire" for each OpenFlow version (and
even whether the packet-in is sent at all!).

Finally, there's all kind of low-level detail randomly scattered between
connmgr, ofproto-dpif-xlate, and ofp-util.

This commit attempts to clear up some of the confusion.  It simplifies
the struct ofputil_packet_in abstraction by removing the members that
didn't have a clear and consistent meaning between incoming and outgoing
packet-ins.  It gets rid of OFPROTO_PACKET_IN_*, instead adding a couple
of nonstandard OFPR_* reasons that add up to what OFPROTO_PACKET_IN_*
was meant to say (in what I hope is a clearer way).  And it consolidates
the tricky parts into ofp-util, where I hope it will be easier to
understand all in one place.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Jarno Rajahalme <jarno@ovn.org>
12 files changed:
include/openflow/openflow-common.h
lib/learning-switch.c
lib/ofp-print.c
lib/ofp-util.c
lib/ofp-util.h
ofproto/connmgr.c
ofproto/connmgr.h
ofproto/fail-open.c
ofproto/ofproto-dpif-xlate.c
ofproto/ofproto-dpif.c
ofproto/ofproto.c
ovn/controller/pinctrl.c