On Thu, Jun 14, 2012 at 09:40:55AM +0900, Simon Horman wrote:
> > -    if (code == OFPUTIL_OFPT_PACKET_IN) {
> > +    if (code == OFPUTIL_OFPT_PACKET_IN && oh->version == OFP10_VERSION) {
> 
> I am wondering if it would be better to rename OFPUTIL_OFPT_PACKET_IN as
> OFPUTIL_OFPT10_PACKET_IN and add OFPUTIL_OFPT12_PACKET_IN and avoid
> checking oh->version directly here. The same probably applies to other
> the decoders for other messages that differ between Open Flow 1.0 and 1.2.

I'm not sure; I'm split on a similar issue for the flow_mod message.

A single code has the advantage that client code doesn't have to
unnecessarily distinguish messages that are, from its perspective,
equivalent.  Separate codes have the advantage that the decode function
doesn't have to distinguish the different versions of a message.

On the whole, I'm leaning toward using a single code, on the principle
that one should isolate complexity in libraries, not in their clients.

(This also argues for, e.g., merging OFPUTIL_NXT_FLOW_MOD into
OFPUTIL_OFPT_FLOW_MOD.)
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to