2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 12:58:00 +00:00

108 Commits

Author SHA1 Message Date
Pravin B Shelar
4fe3445afb vswitchd: Log all tunnel parameters of given flow.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2012-11-21 18:51:36 -08:00
Ansis Atteka
72e8bf28bb datapath: add skb mark matching and set action
This patch adds support for skb mark matching and set action.

Acked-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ansis Atteka <aatteka@nicira.com>
2012-11-21 16:19:30 -08:00
Pravin B Shelar
29c7a2b26e odp-utils: Print human readable ipv4-tunnel-key flags.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2012-11-14 21:17:27 -08:00
Pravin B Shelar
ec956fc743 odp-utils: Refactor slow_path_reason parse and format functions.
These functions are used in next patch.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2012-11-14 21:17:13 -08:00
Mehak Mahajan
8087f5ff82 Process RARP packets with ethertype 0x8035 similar to ARP packets.
With this commit, OVS will match the data in the RARP packets having
ethertype 0x8035, in the same way as the data in the ARP packets.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
2012-11-02 13:20:16 -07:00
Justin Pettit
ddbfda8462 Use ODP ports in dpif layer and below.
The current code has a simple mapping between datapath and OpenFlow port
numbers (the port numbers were the same other than OFPP_LOCAL which maps
to datapath port 0).  Since the translation was know at compile time,
this allowed different layers to easily translate between the two, so
the translation often occurred late.

A future commit will break this simple mapping, so this commit draws a
line between where datapath and OpenFlow port numbers are used.  The
ofproto-dpif layer will be responsible for the translations.  Callers
above will use OpenFlow port numbers.  Providers below will use
datapath port numbers.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
2012-11-01 22:54:27 -07:00
Jesse Gross
35651d6a6b odp: Enable parsing ipv4_tunnel key.
We can format ipv4_tunnel keys from the kernel but can't currently
parse them.  Userspace doesn't know how to do anything with this
information but this support enables utilities like ovs-dpctl and
ovs-appctl ofproto/trace to show useful information.

Bug #13785

Signed-off-by: Jesse Gross <jesse@nicira.com>
2012-11-01 16:52:26 -07:00
Kyle Mestery
356af50bc2 datapath: Add support for tun_key to Open vSwitch datapath
This is a first pass at providing a tun_key which can be
used as the basis for flow-based tunnelling. The
tun_key includes and replaces the tun_id in both struct
ovs_skb_cb and struct sw_tun_key.

This patch allows all existing tun_id behaviour to still work. Existing
users of tun_id are redirected to tun_key->tun_id to retain compatibility.
However, when the userspace code is updated to make use of the new
tun_key, the old behaviour will be deprecated and removed.

NOTE: With these changes, the tunneling code no longer assumes input and
output keys are symmetric.  If they are not, PMTUD needs to be disabled
for tunneling to work.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Reviewed-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2012-10-20 12:15:24 -07:00
Jesse Gross
296e07ace0 flow: Extend struct flow to contain tunnel outer header.
Soon the kernel will begin supplying the information about the outer
IP header for tunneled packets and userspace will need to be able to
track it as part of the flow.  For the time being this is only used
internally by OVS and not exposed outwards to OpenFlow.  As a result,
this threads the information throughout userspace but simply stores
the existing tun_id in it.

Signed-off-by: Jesse Gross <jesse@nicira.com>
2012-10-03 10:04:10 -07:00
Jesse Gross
6e9bea4da9 datapath: Relax set header validation.
When installing a flow with an action to set a particular field we
need to validate that the packets that are part of the flow actually
contain that header.  With IP we use zeroed addresses and with TCP/UDP
the check is for zeroed ports.  This check is overly broad and can catch
packets like DHCP requests that have a zero source address in a
legitimate header.  This changes the check to look for a zeroed protocol
number for IP or for both ports be zero for TCP/UDP before considering
the header to not exist.

Bug #12769

Reported-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
2012-08-03 19:27:05 -07:00
Ben Pfaff
bed69b3e61 odp-util: Include <config.h> first.
Otherwise _GNU_SOURCE doesn't get defined early enough and on some systems
LLONG_MIN is missing when odp-util.c tries to use it indirectly through
token-bucket.h.

Reported-by: Michael Hu <mhu@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-06-21 10:42:20 -07:00
Ben Pfaff
2508ac16de odp-util: Update ODPUTIL_FLOW_KEY_BYTES for current kernel flow format.
Before we submitted the kernel module upstream, we updated the flow format
by adding two fields to the description of packets with VLAN headers, but
we forgot to update ODPUTIL_FLOW_KEY_BYTES to reflect these changes.  The
result was that a maximum-length flow did not fit in the given space.

This fixes a crash processing IPv6 neighbor discovery packets with VLAN
headers received in a tunnel configured with key=flow or in_key=flow.

This updates some comments to better describe the implications of
ODPUTIL_FLOW_KEY_BYTES (suggested by Justin).

This also updates test-odp.c so that it would have caught this problem, and
updates odp.at to demonstrate that a full 156 bytes are necessary.  (To see
that, revert the change to ODPUTIL_FLOW_KEY_BYTES and run the test.)

Reported-by: Dan Wendlandt <dan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-25 09:56:18 -07:00
Simon Horman
9d3ee0bc63 ovs-dpctl: Don't include include/openvswitch/tunnel.h
The inclusion include/openvswitch/tunnel.h does not seem to be needed any
more.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-24 09:04:36 -07:00
Ben Pfaff
44bac24ba5 simap: New data structure for string-to-integer maps.
This commit adapts a couple of existing pieces of code to use the
new data structure.  The following commit will add another user
(which is also the first use of the simap_increas() function).

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-22 10:32:02 -07:00
Ben Pfaff
79d4ffe2c9 odp-util: Fix parsing of actions encapsulated within "sample" actions.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-10 11:44:04 -07:00
Ben Pfaff
6a7e895f94 ofproto-dpif: Introduce "slow path" datapath flows.
Most exact-match flows can be handled directly in the datapath, but
for various reasons, some cannot: every packet in these flows must
be sent separately to userspace.  Until now, flows that cannot be
handled entirely in the kernel have been allowed to miss each time
in the datapath.  This is generally OK, but it has a few
disadvantages:

    * It can make troubleshooting at the level where one must look
      at datapath flows a bit confusing in some cases, because
      datapath misses due to genuinely new flows are mixed in with
      datapath misses for known flows that cannot be set up.

    * It means that the kernel-to-userspace packets for a given
      input port always go to a single kernel-to-userspace queue,
      even if we'd like to segregate out some of the packets for
      known flows.  (An upcoming commit has examples.)

This commit therefore introduces the concept of a "slow path" flow,
one that is installed in the datapath with a single action that
sends the flow's packets to userspace.  To make troubleshooting
easier, the action includes a reason code (displayed by "ovs-dpctl
dump-flows") that explains why the flow has been slow-pathed.

Bug #7550.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-09 12:58:55 -07:00
Ben Pfaff
1673e0e400 odp-util: Change user_action_cookie from struct to union.
An upcoming commit will introduce a new type and a new use for the
additional members.  It seems cleanest to use a union, rather that using
the existing members multiple ways.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-09 12:58:54 -07:00
Ben Pfaff
36fc5f1833 ofproto-dpif: Clean up and centralize sFlow logic.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-09 12:58:53 -07:00
Ben Pfaff
21ae82ffb3 odp-util: Use switch for checking values of an enum.
The compiler warns when we forget to handle some value of an enum, whereas
it won't for a sequence of 'if' statements.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-09 12:58:53 -07:00
Ben Pfaff
751c778501 ofp-util: Treat a packet-out in_port of OFPP_CONTROLLER as OFPP_NONE.
Some OpenFlow 1.0 controllers incorrectly use OPFP_CONTROLLER as the
in_port in packet-out messages, when OFPP_NONE is their intent.  Until now,
Open vSwitch has rejected such requests with an error message.  This commit
makes Open vSwitch instead treat OFPP_CONTROLLER the same as OFPP_NONE for
compatibility with those controllers.

(Also, as of this writing, OpenFlow 1.0.1 appears to be changing the port
to use from OFPP_NONE to OFPP_CONTROLLER.)

Suggested-by: Rob Sherwood <rob.sherwood@bigswitch.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-07 12:30:54 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ben Pfaff
3a8cfc5087 odp-util: Describe invalid keys and actions in more detail.
I have an outstanding bug report that has tons of "***56 leftover bytes***"
messages with no way to guess what the problem is.  I hope this makes
debugging possible.

Bug #9346.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-01-26 16:21:50 -08:00
Ben Pfaff
6814e51f41 ofproto-dpif: Implement self-check of flow translations.
One of the major tasks of ofproto-dpif is to translate OpenFlow
actions into "ODP" datapath actions.  These translations are essentially
a cache that requires revalidation when certain state changes occur.  For
best performance it's important to revalidate flows only when necessary,
so from time to time Open vSwitch has gotten this wrong, which meant that
stale flows could persist in the kernel and cause surprising behavior.

This commit implements a simple "self check": every trip through the
Open vSwitch main loop randomly chooses one flow entry and checks that
its actions have been correctly translated.  If not, Open vSwitch logs
the details of the problem.  This should help find problems more
quickly in the future.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-01-16 12:37:44 -08:00
Pravin B Shelar
c4f2731da6 odp-util: Handle ipv6 in set nw action.
Rather than silently skipping ipv6 action generation, following patch
generates OVS_ACTION_ATTR_SET action for ipv6. Datapath which do not
support ipv6 action can reject this action.

Bug #8758
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2012-01-11 12:44:23 -08:00
Ethan Jackson
999fba59af ofproto-dpif: Implement PACKET_IN in userspace.
In future patches, PACKET_IN messages will include meta-data which
is only available in userspace during action translation.  Either,
this data needs to be stored until it's required by a userspace
datapath action, or the PACKET_IN messages must be sent at the time
the data is available.  This patch implements the latter.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-01-10 14:30:15 -08:00
Ben Pfaff
deedf7e78b flow: Rename 'priority' to 'skb_priority'.
This priority's mean is completely different from the priority of an
OpenFlow rule, so it is confusing for it to have the same name.

We should be on the lookout for a less Linux-specific name, but this one
seems fine for now.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-12-21 15:52:38 -08:00
Ethan Jackson
5bbda0aab1 odp-util: Move commit_odp_actions() from ofproto-dpif.
In an effort to simplify ofproto-dpif, this commit moves the
definition of commit_odp_actions() to odp-util.
2011-11-28 15:47:48 -08:00
Ben Pfaff
b0f7b9b5c9 ofproto-dpif: Support differing user/kernel packet parsing support.
Feature #4886.
2011-11-23 13:19:53 -08:00
Ben Pfaff
becffb8626 tests: Rewrite code for comparing sets of ODP actions.
The compare-odp-actions.pl utility isn't fully general, even for its
intended purpose of allowing sets of ODP actions to be compared
ignoring unimportant differences in ordering of output actions and
VLAN set actions.  I decided that the proper way to do it was to have
a utility that can actually parse the actions, instead of just
doing textual transformations on them.  So, this commit replaces
compare-odp-actions.pl by "ovs-dpctl normalize-actions", which is
sufficiently general for the intended purpose.

The new ovs-dpctl functionality can be easily extended to handle
differences in fields other than VLAN, but only VLAN is needed so
far.

This will be needed in an upcoming commit that in some cases
introduces redundant "set vlan" actions into the ODP actions, which
compare-odp-actions.pl doesn't tolerate.
2011-11-17 10:24:05 -08:00
Ben Pfaff
7202cbe552 odp-util: New function odp_actions_from_string().
An upcoming commit will add a user.  The only planned users for now are
part of unit tests themselves, so it doesn't seem important to unit test
it.
2011-11-17 10:11:54 -08:00
Ben Pfaff
b2a60db8e4 odp-util: Add support for named ports to odp_flow_key_from_string().
Really the "trace" command should support this but in fact I need it for
an upcoming update to a test.
2011-11-17 10:11:54 -08:00
Ben Pfaff
39db78a0fb odp-util: New function factored out of put_userspace_action().
An upcoming patch to odp-util will add a new user, but this seems like a
reasonable change in any case.
2011-11-17 10:11:54 -08:00
Ben Pfaff
c4a0802f06 odp-util: Code formatting improvements. 2011-11-17 10:11:53 -08:00
Ben Pfaff
9ac130ad15 odp-util: Reorder OVS_KEY_ATTR_* cases for consistency.
This matches the order of their definition in openvswitch.h.

Reported-by: Justin Pettit <jpettit@nicira.com>
2011-11-17 10:11:26 -08:00
Ben Pfaff
8ddc056dd1 datapath: Don't drop packets with partial vlan tags.
In the future it is likely that our vlan support will expand to
include multiply tagged packets.  When this happens, we would
ideally like for it to be consistent with our current tagging.

Currently, if we receive a packet with a partial VLAN tag we will
automatically drop it in the kernel, which is unique among the
protocols we support.  The only other reason to drop a packet is
a memory allocation error.  For a doubly tagged packet, we will
parse the first tag and indicate that another tag was present but
do not drop if the second tag is incorrect as we do not parse it.

This changes the behavior of the vlan parser to match other protocols
and also deeper tags by indicating the presence of a broken tag with
the 802.1Q EtherType but no vlan information.  This shifts the policy
decision to userspace on whether to drop broken tags and allows us to
uniformly add new levels of tag parsing.

Although additional levels of control are provided to userspace, this
maintains the current behavior of dropping packets with a broken
tag when using the NORMAL action because that is the correct behavior
for an 802.1Q-aware switch.  The userspace flow parser actually
already had the new behavior so this corrects an inconsistency.

Reported-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-14 20:23:17 -08:00
Ben Pfaff
fea393b1d6 datapath: Describe policy for extending flow key, implement needed changes.
When the datapath was converted to use Netlink attributes for describing
flow keys, I had a vague idea of how it could be smoothly extensible, but
I didn't actually implement extensibility or carefully think it through.
This commit adds a document that describes how flow keys can be extended
in a compatible fashion and adapts the existing interface to match what
it says.

This commit doesn't actually implement extensibility.  I already have a
separate patch series out for that.  This patch series borrows from that
one heavily, but the extensibility series will need to be reworked
somewhat once this one is in.

This commit is only lightly tested because I don't have a good test setup
for VLANs.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-14 16:52:51 -08:00
Ben Pfaff
34118caede datapath: Allow flow key Netlink attributes to appear in any order.
This is more conventional use of Netlink.

For upstreaming, 'u64 attrs' can be changed to u32 and the uses of 1ULL
can be changed to 1.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-14 15:09:01 -08:00
Ben Pfaff
b3b5bf02d5 odp-util: Use ovs_key_attr_to_string() names in format_odp_key_attr(). 2011-11-11 14:07:16 -08:00
Ben Pfaff
a052b51b3d odp-util: Adjust style.
Usually we don't put a new-line in prototypes unless we have to.  I also
think that this comment deserves to be higher up in the file, so I moved
it.
2011-11-11 14:07:16 -08:00
Ben Pfaff
7a8e9ed2f7 odp-util: Trigger warning for unhandled attrs in format_odp_key_attr().
I usually do things this way but must have overlooked this one a while ago.
2011-11-11 14:07:16 -08:00
Ben Pfaff
744791b56b odp-util: New function ovs_key_attr_to_string().
This seems like a worthwhile improvement in itself, but it will also see
additional users in upcoming commits.
2011-11-11 14:07:16 -08:00
Justin Pettit
eadef31329 Prepend "nw_" to "frag" and "tos" elements.
Most of the members in structures referring to network elements indicate
the layer (e.g., "tl_", "nw_", "tp_").  The "frag" and "tos" members
didn't, so this commit add them.
2011-11-10 18:03:04 -08:00
Justin Pettit
60258dcba6 datapath: Rename ipv6_tos to ipv6_tclass.
IPv6 uses the term "traffic class" for what IPv4 calls
"type-of-service".  This commit renames the the "ipv6_tos" field to
"ipv6_tclass" in the "ovs-key_ipv6" struct to be more consistent with
the IPv6 terminology.

Suggested-by: Jesse Gross <jesse@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09 13:24:52 -08:00
Justin Pettit
7229a773ea odp-util: Use PRIu8 instead of PRId8 when printing ip_proto.
Suggested-by: Ben Pfaff <blp@nicira.com>
2011-11-09 13:24:52 -08:00
Justin Pettit
a61680c6d1 Support matching and modifying IP TTL.
Add support matching the IPv4 TTL and IPv6 hop limit fields.  This
commit also adds support for modifying the IPv4 TTL.  Modifying the IPv6
hop limit isn't currently supported, since we don't support modifying
IPv6 headers.

We will likely want to change the user-space interface, since basic
matching and setting the TTL are not generally useful.  We will probably
want the ability to match on extraordinary events (such as TTL of 0 or 1)
and a decrement action.

Feature #8024

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09 13:24:52 -08:00
Justin Pettit
530180fd5a Support matching and modifying IP ECN bits.
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09 10:47:59 -08:00
Justin Pettit
9e44d71563 Don't overload IP TOS with the frag matching bits.
This will be useful later when we add support for matching the ECN bits
within the TOS field.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09 10:37:57 -08:00
Justin Pettit
fa8223b7fd Support matching IPv6 flow label.
Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-09 10:37:55 -08:00
Pravin B Shelar
abff858b5a datapath: Convert kernel priority actions into match/set.
Following patch adds skb-priority to flow key. So userspace will know
what was priority when packet arrived and we can remove the pop/reset
priority action. It's no longer necessary to have a special action for
pop that is based on the kernel remembering original skb->priority.
Userspace can just emit a set priority action with the original value.

Since the priority field is a match field with just a normal set action,
we can convert it into the new model for actions that are based on
matches.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>

Bug #7715
2011-11-01 10:13:16 -07:00
Edward Tomasz Napierała
6ca00f6f17 Fix build on FreeBSD.
Patch below fixes build on FreeBSD; tested on 10.0-CURRENT.

Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2011-11-01 09:11:52 -07:00