aboutsummaryrefslogtreecommitdiff
path: root/datapath/flow.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-01-24 14:59:57 -0800
committerBen Pfaff <blp@nicira.com>2011-01-27 21:08:36 -0800
commit856081f683d3e7d5b5fa07af4233d285eb205c47 (patch)
treef626bca05553ff757f1810f517b6d928ec0b1c28 /datapath/flow.h
parent36956a7d33c9ee204fcb184484a5aaacbd9ecef8 (diff)
datapath: Report kernel's flow key when passing packets up to userspace.
One of the goals for Open vSwitch is to decouple kernel and userspace software, so that either one can be upgraded or rolled back independent of the other. To do this in full generality, it must be possible to change the kernel's idea of the flow key separately from the userspace version. This commit takes one step in that direction by making the kernel report its idea of the flow that a packet belongs to whenever it passes a packet up to userspace. This means that userspace can intelligently figure out what to do: - If userspace's notion of the flow for the packet matches the kernel's, then nothing special is necessary. - If the kernel has a more specific notion for the flow than userspace, for example if the kernel decoded IPv6 headers but userspace stopped at the Ethernet type (because it does not understand IPv6), then again nothing special is necessary: userspace can still set up the flow in the usual way. - If userspace has a more specific notion for the flow than the kernel, for example if userspace decoded an IPv6 header but the kernel stopped at the Ethernet type, then userspace can forward the packet manually, without setting up a flow in the kernel. (This case is bad from a performance point of view, but at least it is correct.) This commit does not actually make userspace flexible enough to handle changes in the kernel flow key structure, although userspace does now have enough information to do that intelligently. This will have to wait for later commits. This commit is bigger than it would otherwise be because it is rolled together with changing "struct odp_msg" to a sequence of Netlink attributes. The alternative, to do each of those changes in a separate patch, seemed like overkill because it meant that either we would have to introduce and then kill off Netlink attributes for in_port and tun_id, if Netlink conversion went first, or shove yet another variable-length header into the stuff already after odp_msg, if adding the flow key to odp_msg went first. This commit will slow down performance of checksumming packets sent up to userspace. I'm not entirely pleased with how I did it. I considered a couple of alternatives, but none of them seemed that much better. Suggestions welcome. Not changing anything wasn't an option, unfortunately. At any rate some slowdown will become unavoidable when OVS actually starts using Netlink instead of just Netlink framing. (Actually, I thought of one option where we could avoid that: make userspace do the checksum instead, by passing csum_start and csum_offset as part of what goes to userspace. But that's not perfect either.) Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/flow.h')
-rw-r--r--datapath/flow.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/datapath/flow.h b/datapath/flow.h
index f09f76c4..5e5ae5e1 100644
--- a/datapath/flow.h
+++ b/datapath/flow.h
@@ -100,6 +100,7 @@ int flow_cmp(const struct tbl_node *, void *target);
*/
#define FLOW_BUFSIZE 96
+u32 flow_to_nlattrs(const struct sw_flow_key *, struct sk_buff *);
int flow_copy_from_user(struct sw_flow_key *, const struct nlattr __user *ukey, u32 key_len);
int flow_copy_to_user(struct nlattr __user *ukey, const struct sw_flow_key *, u32 key_len);