On Wed, Mar 02, 2011 at 02:31:00PM -0800, Ben Pfaff wrote:
> Until now, the tun_id and in_port have been lost when a packet is sent from
> the kernel to userspace and then back to the kernel. I didn't think that
> this was a problem, but recent behavior made me look closer and see that
> it makes a difference if sFlow is turned on or if an
> ODP_ATTR_ACTION_CONTROLLER action is present. We could possibly kluge
> around those, but for future-proofing it seems better to pass the packet
> metadata from userspace to the kernel. That is what this commit does.
>
> This commit introduces a user-kernel protocol break. We could avoid that,
> if it is desirable, by making ODP_PACKET_ATTR_KEY optional for
> ODP_PACKET_CMD_EXECUTE commands.
>
> Signed-off-by: Ben Pfaff <[email protected]>
> Bug #4769.
Here's an incremental to apply to this that doesn't discard the
metadata that has just been extracted:
diff --git a/datapath/datapath.c b/datapath/datapath.c
index 9c9740b..e06c3b0 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -709,13 +709,13 @@ static int odp_packet_cmd_execute(struct sk_buff *skb,
struct genl_info *info)
/* Initialize OVS_CB (it came from Netlink so might not be zeroed). */
memset(OVS_CB(packet), 0, sizeof(struct ovs_skb_cb));
- /* Get flow metadata provided by userspace. */
- err = flow_metadata_from_nlattrs(&key.in_port, &key.tun_id,
- a[ODP_PACKET_ATTR_KEY]);
+ err = flow_extract(packet, -1, &key, &is_frag);
if (err)
goto exit;
- err = flow_extract(packet, -1, &key, &is_frag);
+ /* Get flow metadata provided by userspace. */
+ err = flow_metadata_from_nlattrs(&key.in_port, &key.tun_id,
+ a[ODP_PACKET_ATTR_KEY]);
if (err)
goto exit;
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev_openvswitch.org