2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-23 14:57:06 +00:00
Commit Graph

2218 Commits

Author SHA1 Message Date
Justin Pettit
17764fb2ac ofp-util: Fix offset when making Nicira extension error messages. 2010-12-07 21:58:30 -08:00
Ben Pfaff
0bc9407dbb ofpbuf: New function ofpbuf_use_const().
This is a code cleanup.

Suggested-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:17 -08:00
Ben Pfaff
4b87bea69d dpif-netdev: Use ofpbuf functions instead of their out-of-line expansions.
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:14 -08:00
Ben Pfaff
2208d6b713 cfm: Use ofpbuf_new() instead of its out-of-line expansion.
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:10 -08:00
Ben Pfaff
ad8ee2c0f3 odp-util: Bump up maximum number of ODP actions.
The kernel supports more than a single page of actions now, so userspace
should be able to take advantage of this.

Upcoming commits will completely replace this data structure but this
commit makes the bug fix clear and is suitable for cherry-picking to
long-term support branches.
2010-12-07 13:44:10 -08:00
Ben Pfaff
f9ba8dad04 ofp-util: Fully initialize flow_wildcards in ofputil_cls_rule_from_match().
The new 'zero' member was not being properly initialized.  One approach
would be to add an assignment, but it seems more future-proof to let
flow_wildcards_init_catchall() do the right thing.

Noticed by valgrind.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:44:06 -08:00
Ben Pfaff
06448753e2 datapath: Fix odp-compat definition of struct compat_odp_execute.
The in_port member and padding were removed from struct odp_execute some
time ago, but the compat definition didn't reflect this.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-07 13:42:57 -08:00
Ben Pfaff
4f564f8dc7 ovs-ofctl: Add --more option to increase OpenFlow message verbosity.
This is useful for seeing the raw NXM data instead of just the parsed
cls_rules.
2010-12-07 13:32:02 -08:00
Ben Pfaff
88ca35eed0 ovs-ofctl: Add NXM support. 2010-12-07 13:32:01 -08:00
Ben Pfaff
7fa9111326 ofp-print: Implement printing for OFPUTIL_NXT_FLOW_MOD. 2010-12-07 13:22:46 -08:00
Ben Pfaff
00b1c62fe8 ofp-parse: Add support for registers.
This updates the ovs-ofctl manpage even though ovs-ofctl doesn't really
support registers yet.
2010-12-07 12:47:42 -08:00
Ben Pfaff
4c5df7f774 ofp-parse: Add support for tun_id.
This updates the ovs-ofctl manpage even though ovs-ofctl doesn't really
support tun_id yet.
2010-12-07 12:47:40 -08:00
Ben Pfaff
07b37e8f98 classifier: Implement better classifier rule formatting.
The old formatting was only good enough for debugging, but now we need to
be able to format cls_rules as part of ofp-print.c.  This new code is
modeled after ofp_match_to_string().
2010-12-07 12:45:26 -08:00
Ben Pfaff
2e4f5fcf3f ofp-util: New abstractions for flow_mod, flow_stats_request.
These will be useful for adding Nicira Extended Match support to ovs-ofctl.

This commit makes ofproto use the new flow_mod abstraction, but not the
new flow and aggregate stats abstraction.  The latter takes a bit more
infrastructure that I haven't finished yet.
2010-12-07 12:45:24 -08:00
Ben Pfaff
558d80cbfa nx-match: Add tests for error return values for unknown NXM fields. 2010-12-07 11:04:15 -08:00
Ben Pfaff
60d5e0d859 nicira-ext: Clarify comments about 'src' and 'dst' in NXAST_REG actions. 2010-12-07 11:03:06 -08:00
Ben Pfaff
19e7439c61 nicira-ext: Clarify and fix macros to check for NXM metadata registers.
The NXM_IS_NX_REG macro didn't check the "hasmask" bit, which meant that it
looked like it was supposed to match both exact and wildcarded NXM headers,
e.g. both NXM_NX_REG0 and NXM_NX_REG0_W.  But exact and wildcarded NXM
headers differ not just in the "hasmask" bit but in the "length" value
also (the wildcarded version's length is twice the exact version's length),
so this was not what it actually did.

The only current users of NXM_IS_NX_REG actually only want to match exact
versions, so this commit makes it only match those.  It also adds a new
NXM_IS_NX_REG_W macro that matches only wildcarded versions.  This new
macro has no users yet, but its existence should help to make it clear that
NXM_IS_NX_REG only matches exact NXM headers.

Reported-by: Natasha Gude <natasha@nicira.com>
2010-12-07 11:03:06 -08:00
Ben Pfaff
73d67a4355 netdev-vport: Properly initialize tnl_port_config structure to 0.
Otherwise the configuration starts out indeterminate and tends to be
rejected by the kernel.

Bug #4195.
2010-12-07 10:41:05 -08:00
Ethan Jackson
e58de0e386 vswitchd: Incorporate vlan into bond hash.
With this patch vlan tags are incorporated into bond hashes in
addition to the source mac address.

NIC-294
2010-12-06 13:59:43 -08:00
Ethan Jackson
557c178b31 vswitchd: Remove bond/migrate MAC argument.
Before this patch one could specify a mac address as part of the
bond/migrate command.  This will no longer make sense as bond
hashing becomes more complicated.
2010-12-06 13:55:09 -08:00
Ethan Jackson
a27598cdb2 vswitchd: Correct indentation in bridge.
The "bond_unixctl_hash" function was using tabs instead of spaces.
2010-12-06 13:55:09 -08:00
Ben Pfaff
20d9a814c7 Fix "make dist" by adding include/linux/types.h to distribution. 2010-12-06 10:29:04 -08:00
Ben Pfaff
dfdfc8d43d ofp-util: New functions for creating Nicira extension messages. 2010-12-06 10:24:56 -08:00
Ben Pfaff
d1e2cf2119 Refactor and centralize basic OpenFlow message decoding and validation.
Open vSwitch contains a few different chunks of code that need to decode
an OpenFlow message to determine its type and then validate that it is
long enough.  Until now, the code for doing this has been more or less
scattered across the tree.  Whenever a new piece of code needed to do this,
it generally needed to reimplement at least part of it.

This commit centralizes all of that work into a single function,
ofputil_decode_msg_type(), and helper functions, and converts all of the
code that was decoding messages by hand to use the new function.
2010-12-06 10:20:20 -08:00
Ben Pfaff
c24750a102 port-array: Remove.
This code had no remaining users.
2010-12-06 10:05:44 -08:00
Ben Pfaff
531edfbb42 pinsched: Use hmap instead of port_array.
This is the last remaining use of port_array in the tree.  It wasn't really
taking advantage of any of the special features of port_arrays, so it's
better to save some time and memory by using an hmap instead.

(In addition, OpenFlow 1.1, which we may eventually want to support, has
changed from 16-bit to 32-bit port numbers, which would require the
port_array code to be rewritten anyhow.)
2010-12-06 10:05:44 -08:00
Ben Pfaff
7f009380f6 vconn: New function vconn_transact_multiple_noreply().
This will be useful for sending a bunch of flow_mod messages all at once.
2010-12-06 10:03:32 -08:00
Ben Pfaff
b3907fbc6c queue: Get rid of ovs_queue data structure.
ovs_queue doesn't seem very useful; it's just a singly-linked list.  It's
more generally useful to use a general-purpose "struct list" for lists of
packets, so this commit adds such a member to "struct ofpbuf" and shifts
the existing users to use it.
2010-12-06 10:03:31 -08:00
Ben Pfaff
772ec52b89 util: Introduce ASSIGN_CONTAINER to make iteration macros easier to read. 2010-12-06 09:59:30 -08:00
Ben Pfaff
7c9b00732c docs: Only regenerate vswitch.pic when the schema really changes.
Until now, vswitch.pic has been rebuilt whenever the schema changed.  This
is OK when the E-R diagram would really change, but many changes to the
schema don't change the E-R diagram, and it surprises people when
vswitch.pic changes in such a situation.  This commit fixes the problem.

Requested-by: Justin Pettit <jpettit@nicira.com>
2010-12-06 09:56:38 -08:00
Jesse Gross
4230c96685 datapath: Update 32/64 bit compat ioctl to match new names.
ODP_PORT_LIST32 is now ODP_VPORT_LIST32.

Reported-by: CS Lee <geek00l@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
2010-12-06 08:29:49 -08:00
Jesse Gross
dd8d6b8cd4 datapath: Consolidate checksum compatibility code.
Checksum offloading has changed quite a bit across different kernel
and Xen versions.  Since it is part of the skb data structure it is
unfortunately difficult to separate out into compatibility code.
This consolidates all of the checksum code in one place which makes
it easier read and remove as we prepare for upstreaming.  On newer
kernels it also puts everything in inline functions, eliminating the
need to run through the compat code or make extra function calls.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2010-12-03 17:40:26 -08:00
Ethan Jackson
29b639ed75 lib: Add zero padding field to flow_wildcards.
Before this commit, the compiler would add two bytes of padding to
the 'flow_wildcards' structure to achieve 32bit alignment.  These
two bytes had inconsistent values which caused 'flow_wildcards_hash'
to behave inconsistently.  This commit explicitly 32bit aligns
'flow_wildcards' with zero padding.

This commit also fixes an issue where in-band rules were not
getting deleted when in-band control was disabled.
2010-12-03 15:52:59 -08:00
Ben Pfaff
7237e4f4b6 datapath: Merge vport "attach" into "create" and "detach" into "destroy".
These steps are sequentially in lockstep, so we might as well combine them.

This expands the region over which the vport_lock is held.  I didn't
carefully verify that this was OK.

This also eliminates the synchronize_rcu() call from destruction of tunnel
vports, since they didn't appear to me to need it.

It should be possible to eliminate the synchronize_rcu() from the netdev,
patch, and internal_dev vports, but this commit does not do that.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 15:44:51 -08:00
Ben Pfaff
e779d8d90d datapath: Merge "struct dp_port" into "struct vport".
After the previous commit, which changed the datapath to always create and
attach a vport at the same time, and to always detach and delete a vport
at the same time, there is no longer any real distinction between a dp_port
and a vport.  This commit, therefore, merges the two together to simplify
code.  It might even improve performance, although I have not checked.

I wasn't sure at first whether the merged structure should be "struct
dp_port" or "struct vport".  I went with the latter since the "v" prefix
sounds cool.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 14:43:38 -08:00
Ben Pfaff
98563392db netdev-linux: Don't treat "system" devices as vports for setting stats.
Linux kernel datapath vports have a "set_stats" method.  Until now,
internal vports have been handled in the userspace netdev library as
type "system", so the "system" netdevs would try to use the vport
"set_stats" method.  Now, however, internal netdevs have been broken out
as a separate netdev type, so only that new type of netdev has to be able
to call into "set_stats".  This commit, therefore, removes it from the
"system" netdevs.
2010-12-03 14:43:38 -08:00
Ben Pfaff
a181129613 dpif: Log port number of deleted port in dpif_port_del().
This made tracking down a particular bug easier for me.  (It's too bad that
we can't log the port name, but we don't have it here.)
2010-12-03 14:42:28 -08:00
Ben Pfaff
c3827f619a datapath: Make adding and attaching a vport a single step.
For some time now, Open vSwitch datapaths have internally made a
distinction between adding a vport and attaching it to a datapath.  Adding
a vport just means to create it, as an entity detached from any datapath.
Attaching it gives it a port number and a datapath.  Similarly, a vport
could be detached and deleted separately.

After some study, I think I understand why this distinction exists.  It is
because ovs-vswitchd tries to open all the datapath ports before it tries
to create them.  However, changing it to create them before it tries to
open them is not difficult, so this commit does this.

The bulk of this commit, however, changes the datapath interface to one
that always creates a vport and attaches it to a datapath in a single step,
and similarly detaches a vport and deletes it in a single step.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 14:41:38 -08:00
Ben Pfaff
94903c9898 datapath: Encapsulate parameters for new vports in new struct vport_parms.
Upcoming commits will keep needing to pass more information to the vport
'create' member function.  It's annoying to have to modify a dozen pieces
of code every time just to do this, so this commit encapsulates all of the
parameters in a new struct and passes that instead.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 11:33:41 -08:00
Ben Pfaff
17e42975c2 util: Improve type-safety of OBJECT_CONTAINING. 2010-12-03 10:34:02 -08:00
Ben Pfaff
24cd0dee6e ovs-ofctl: Demote common log messages from INFO to DBG level.
These log messages were useful long ago, but I have not found them helpful
in a long time.  Also noticed by Paul Ingram <paul@nicira.com>.
2010-12-03 10:34:01 -08:00
Ben Pfaff
b8c5c0dc73 ovs-ofctl: Reimplement dumping particular tables.
"dump-flows" and "dump-aggregate" are documented to accept a "table"
value to dump only a particular OpenFlow table, but commit 8050b31d6
"ofp-parse: Refactor flow parsing" broke this, by always dumping table
0.  This commit should fix it (though I haven't tested it).
2010-12-03 10:32:38 -08:00
Ben Pfaff
87542e21fa classifier: New cls_rule functions for setting registers and tun_id. 2010-12-03 10:30:11 -08:00
Ben Pfaff
492f75720e nicira-ext: Name the enum used for flow formats, to clarify code. 2010-12-03 10:30:11 -08:00
Ben Pfaff
3fd8e510dc datapath: Add __aligned_u64 compat support for user and kernel headers.
__aligned_u64 is a 64-bit integer type that is guaranteed to be aligned on
a 64-bit boundary.  It is used in ABI structures to allow them to be shared
between 32- and 64-bit userspace without the need for kernel compat code.
The first use in OVS is coming up in this series of patches.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 09:32:31 -08:00
Ben Pfaff
4029c21acb datapath: Change vals[] in struct port_lookup_key into discrete members.
The 'vals' array is only convenient for use by port_hash().  It's a
liability otherwise, since it makes the code wider and harder to read and
seems to me less amenable to compiler optimization.

In an upcoming patch the key needed in struct port_lookup_key will
increase in size to 64 bits, so that using an array of u32 becomes even
more problematic.  Therefore, this commit gets rid of the array in favor
of discrete named members that carry the same information.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 09:32:31 -08:00
Ben Pfaff
5b16f00916 Format tunnel IDs consistently.
Some code failed to convert tunnel IDs to host byte order for printing,
so this fixes that.  Some code printed tunnel IDs with a 0x prefix and
other code didn't, so this code uses the '#' flag consistently (which
prints 0x for nonzero values and omits it for zero).

This commit also stops always printing all 8 digits.  When tunnel IDs
are expanded to 64 bits, as they will be soon, printing 16 digits all the
time wastes too much space.

Acked-by: Jesse Gross <jesse@nicira.com>
2010-12-03 09:32:31 -08:00
Jesse Gross
8e6c8ff5ae datapath: Allow skbs with a frag list.
We can already receive packets with a frag list due to reassembly
in CAPWAP tunneling.  Since we can handle it, we might as well open
it up to internal devices as well to prevent linearization.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2010-12-02 17:10:16 -08:00
Jesse Gross
a5b7d883a8 datapath: Don't set dev->last_rx on kernels >= 2.6.29.
dev->last_rx is used for rebalancing in Linux bonding.  However,
on a SMP machine it quickly becomes a very hot cacheline.  On
kernels 2.6.29 and later the networking core will update last_rx
only if bonding is in use, so drivers do not need to set it at all.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2010-12-02 17:10:16 -08:00
Jesse Gross
15d90bb6c9 tunnels: Mark tnl_ops as static.
Both GRE and CAPWAP have tnl_ops that are only accessed inside of
their respective files.  Therefore mark these structures as static.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2010-12-02 17:10:16 -08:00