ofproto-dpif-upcall: Translate input port as part of upcall translation.
authorJesse Gross <jesse@kernel.org>
Thu, 9 Jun 2016 20:18:45 +0000 (13:18 -0700)
committerJesse Gross <jesse@kernel.org>
Mon, 13 Jun 2016 20:28:26 +0000 (13:28 -0700)
commitd1d7816bec0ddc005e99df8d39c8c280ce8b4115
tree419ec8d86a757ec3913cae600792da9d681e7fb7
parent968353c2d16c61b80be5298b4f2728d63f74404a
ofproto-dpif-upcall: Translate input port as part of upcall translation.

When we generate wildcards for upcalled flows, the flows and therefore
the wildcards, are in OpenFlow format. These are mostly the same but
one exception is the input port. We work around this problem by simply
performing an exact match on the input port when generating netlink
formatted keys. (This does not lose any information in practice because
action translation also always exact matches on input port.)

While this works fine for kernel based flows, it misses the userspace
datapath, which directly consumes the OFP format mask for the input
port. The effect of this is that the in_port mask is sometimes only
the lower 16 bits of the field. (This is because OFP format is a 16-bit
value stored in a 32-bit field. The full width of the field is initialized
with an exact match mask but certain operations result in cleaving this
down to 16 bits.) In practice this does not cause a problem because datapath
port numbers are almost always in the lower 16 bits of the range anyways.

This moves the masking of the datapath format field to translation so that
all datapaths see the same result. This also makes more sense conceptually
as the input port in the flow is also in ODP format at this stage.

Signed-off-by: Jesse Gross <jesse@kernel.org>
Acked-by: Daniele Di Proietto <diproiettod@vmware.com>
ofproto/ofproto-dpif-upcall.c