2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

594 Commits

Author SHA1 Message Date
Ben Pfaff
19187a715f Implement OpenFlow 1.5 group desc stats request.
OpenFlow 1.4 and earlier always send the description of every group in
response to an OFPMP_GROUP_DESC request.  OpenFlow 1.5 proposes allowing
the controller to request a description of a single group.  This commit
implements a prototype.

EXT-69.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:44 -07:00
Ben Pfaff
42dccab550 Add skeleton for OF1.5 support.
This allows OF1.5 prototyping to take place in a natural way.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:44 -07:00
Ben Pfaff
aa233d5772 Remove --enable-of14 option because the implementation is now safe.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:43 -07:00
Ben Pfaff
13e1aff8b9 ofp-util: Remove ofputil_get_phy_port_size().
The size is not fixed for OpenFLow 1.4 and later, so it's a little
deceptive to return any particular value.  This function was only used in
one place, so move it inline there.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:43 -07:00
Ben Pfaff
942130c5f8 ofp-util: Simplify ofputil_decode_switch_features().
It does not need to check the size, because the decoder in ofp-msgs.c
checks for a valid size.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:43 -07:00
Ben Pfaff
1bb2cdbef2 Implement OpenFlow 1.4 queue statistics.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:43 -07:00
Ben Pfaff
5469537be5 Implement OpenFlow 1.4 port statistics.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:43 -07:00
Ben Pfaff
37ab26e80c Implement basic OpenFlow 1.4 table-mod message.
Vacancy events and eviction are not yet implemented--see OPENFLOW-1.1+.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:42 -07:00
Ben Pfaff
18cc69d926 Implement OpenFlow 1.4 port_mod messages.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:42 -07:00
Ben Pfaff
8c3cc78538 ofp-util: Implement OpenFlow 1.4 port status and port desc reply messages.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:42 -07:00
Ben Pfaff
6b0f20ac52 ofp-util: Reduce duplicate code.
ofputil_put_phy_port() and ofputil_append_port_desc_stats_reply() had a
lot of code duplication.  This reduces it: it deletes some specialized
code from ofputil_put_phy_port(), moving it into its caller
ofputil_put_switch_features_port() that actually needed it.  That change
then allows ofputil_append_port_desc_stats_reply() to become a simple
wrapper around ofputil_put_phy_port().

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:42 -07:00
Ben Pfaff
9a4eddbb6e ofp-util: Generalize functions for parsing OF1.3+ properties.
The main effect is to move these functions a little earlier in the file.

Also, OpenFlow 1.4 changed the table-features specific error codes to new
values that apply to all property sets, so this commit updates the error
code names and adds the appropriate OpenFlow 1.4+ codes.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:42 -07:00
Ben Pfaff
9b77a33644 ofp-util: Remove ofputil_count_phy_ports().
It's harder to calculate the number of ports in a given amount of space in
OpenFlow 1.4 and later, because the ofp_port structure becomes variable
length in those versions.  This commit removes the one caller, replacing
it by a version that doesn't need to know the number of ports in advance.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:41 -07:00
Ben Pfaff
e28ac5cf36 ofp-msgs: New functions ofpmp_version() and ofpmp_decode_raw().
Each of these allows code in ofp-util.c to be simplified.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-14 10:31:41 -07:00
Ben Pfaff
fca6d553da ovs-ofctl: Fix port lookup and "ovs-ofctl" behavior for OpenFlow 1.3+.
ovs-ofctl supports using port names in commands that operate on ports.  It
does this by connecting to the switch, listing the ports, and picking out
the one with the specified name.  However, this didn't work properly for
OpenFlow 1.3+, because it always used an OFPT_FEATURES_REQUEST to list the
ports, and in OpenFlow 1.3+ the reply to this request does not include a
list of ports.  This commit fixes the problem (using code that previously
was just a fallback when there were too many ports to fit in an
OFPT_FEATURES_REPLY).

For similar reasons, "ovs-ofctl show" wasn't listing the switch's ports
when it connected to a switch over OpenFlow 1.3 or later.  This commit
fixes that bug also.

Signed-off-by: Ben Pfaff <blp@nicira.com>

Conflicts:
	utilities/ovs-ofctl.c
2014-05-14 10:31:41 -07:00
Andy Zhou
63759e71f6 ofp-util: compile group stats with visual studio
Visual studio supports zero-size array within a struct or union,
but has to be the last element. GCC does not have this restriction.

Commits 644cfd84772eb7d8 and 6fdaa45a6f6c9 make use of 0 size array.
Remove them so that visual studio can compile them as well.

Reported-by: Gurucharan Shetty <gshetty@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-05-08 16:18:33 -07:00
Alexandru Copot
777af88d50 Add basic implementation for OpenFlow 1.4 bundles
This is only the communication part of the bundles functionality.
The actual message pre-validation and commits are not implemented.

We also enable OF1.4 for all the tests.

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
[blp@nicira.com made ofputil_decode_bundle_add() more obviously correct]
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-05-02 09:41:33 -07:00
Jarno Rajahalme
419681daf1 lib/flow: Introduce miniflow_extract().
miniflow_extract() extracts packet headers directly to a miniflow,
which is a compressed form of the struct flow.  This does not require
a large struct to be cleared to begin with, and accesses less memory.
These performance benefits should allow this to be used in the DPDK
datapath.

miniflow_extract() takes a miniflow as an input/output parameter.  On
input the buffer for values to be extracted must be properly
initialized.  On output the map contains ones for all the fields that
have been extracted.

Some struct flow fields are reordered to make miniflow_extract to
progress in the logical order.

Some explicit "inline" keywords are necessary for GCC to optimize this
properly.  Also, macros are used for same reason instead of inline
functions for pushing data to the miniflow.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
2014-04-18 08:33:12 -07:00
Jarno Rajahalme
5b23ff7e7d lib/ofp-util: Restore the check for minus sign in port number strings.
Commit 33ab38d9 (meta-flow: Simplify mf_from_ofp_port_string())
inadvertently removed a check for minus sign at the beginning of a
port number string introduced by commit 05dddba (meta-flow: Don't
allow negative port numbers).  This check is still needed, so put it
back, but to ofputil_port_from_string() this time.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Justin Pettit <jpettit@nicira.com>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
2014-04-18 08:26:56 -07:00
Andy Zhou
dcbe78ad12 ofp-util.c: Simplify ofputil_group_stats_to_* functions.
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-04-10 18:56:16 -07:00
Jarno Rajahalme
cf3b753866 ofpbuf: Abstract 'l2' pointer and document usage conventions.
Rename 'l2' to 'frame' and add new ofpbuf_set_frame() and ofpbuf_l2().
ofpbuf_set_frame() alse resets all the layer offsets.  ofpbuf_l2()
returns NULL if the packet has no Ethernet header, as indicated either
by unset l3 offset or NULL frame pointer.  Callers of ofpbuf_l2() are
supposed to check the return value, unless they can otherwise be sure
that the packet has a valid Ethernet header.

The recent commit 437d0d22 made some assumptions that were not valid
regarding the use of the 'l2' pointer in rconn module and by
compose_rarp().  This is now fixed as follows: rconn now relies on the
fact that once OpenFlow messages are given to rconn for transport, the
frame pointer is no longer needed to refer to the OpenFlow header; and
compose_rarp() now sets the frame pointer and offsets as expected.

In addition to storing network frames, ofpbufs are also used for
handling OpenFlow messages and action lists.  lib/ofpbuf.h now has a
comment documenting the current usage conventions and invariants.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-04-03 11:51:59 -07:00
Jarno Rajahalme
6b8c377a6e ofpbuf: Rename trivial _get_ functions without the "get".
Code reads better without the "get", for example "ofpbuf_l3()"
v.s. "ofpbuf_get_l3()".  L4 payoad access functions still use the
"get" (e.g., "ofpbuf_get_tcp_payload()").

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
2014-04-03 11:51:54 -07:00
Pravin Shelar
1f317cb5c2 ofpbuf: Introduce access api for base, data and size.
These functions will be used by later patches.  Following patch
does not change functionality.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
2014-03-30 06:18:43 -07:00
Jarno Rajahalme
437d0d22ab lib/ofpbuf: Compact
This patch shrinks the struct ofpbuf from 104 to 48 bytes on 64-bit
systems, or from 52 to 36 bytes on 32-bit systems (counting in the
'l7' removal from an earlier patch).  This may help contribute to
cache efficiency, and will speed up initializing, copying and
manipulating ofpbufs.  This is potentially important for the DPDK
datapath, but the rest of the code base may also see a little benefit.

Changes are:

- Remove 'l7' pointer (previous patch).
- Use offsets instead of layer pointers for l2_5, l3, and l4 using
  'l2' as basis.  Usually 'data' is the same as 'l2', but this is not
  always the case (e.g., when parsing or constructing a packet), so it
  can not be easily used as the offset basis.  Also, packet parsing is
  faster if we do not need to maintain the offsets each time we pull
  data from the ofpbuf.
- Use uint32_t for 'allocated' and 'size', as 2^32 is enough even for
  largest possible messages/packets.
- Use packed enum for 'source'.
- Rearrange to avoid unnecessary padding.
- Remove 'private_p', which was used only in two cases, both of which
  had the invariant ('l2' == 'data'), so we can temporarily use 'l2'
  as a private pointer.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-03-29 17:22:19 -07:00
Andy Zhou
a79f29f20e lib/flow: add dp_hash and recirc_id to struct flow
Signed-off-by: Andy Zhou <azhou@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
2014-03-25 13:23:41 -07:00
Alexander Wu
5deff5aa26 ofp-util: Implement OFPMP_TABLE_FEATURES decoding and printing.
Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-03-23 23:27:00 -07:00
Alexander Wu
9c4dbc1caa ofp-actions: Complete ofp13_action_type.
Signed-off-by: Alexander Wu <alexander.wu@huawei.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-03-23 22:58:55 -07:00
Ben Pfaff
ecb229bebb Disable OF1.4 in ovs-vswitchd and ovs-ofctl without specially enabling.
When the OF1.4 is made safe, so that receiving an unimplemented message
cannot crash the switch, this commit should be reverted.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-03-23 14:47:47 -07:00
Alexandru Copot
c37c03826c ofproto: Allow the use of the OpenFlow 1.4 protocol
This defines the version number for OpenFlow 1.4 so that the switch
can actually use it. The ovsdb schema is also modified.

Signed-off-by: Alexandru Copot <alex.mihai.c@gmail.com>
Cc: Daniel Baluta <dbaluta@ixiacom.com>
[blp@nicira.com adjusted code in cases where 1.3 and 1.4 are the same]
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-03-23 14:44:58 -07:00
YAMAMOTO Takashi
bf062576fd ofp-util: Avoid gcc warning on NetBSD
Avoid the following warning caused by the combination
of NetBSD's htons implementation and gcc bug.
Now --enable-Werror build succeeds on NetBSD-6.

    lib/ofp-util.c: In function 'ofputil_match_from_ofp10_match':
    lib/ofp-util.c:174:15: error: integer overflow in expression

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-02-20 08:29:50 -08:00
kmindg
646f2b37ea ofp-util: Fix a typo in ofputil_decode_ofp11_port
Signed-off-by: kmindg <kmindg@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-02-19 11:32:17 -08:00
Ben Pfaff
8bfd0fdace Enhance userspace support for MPLS, for up to 3 labels.
This commit makes the userspace support for MPLS more complete.  Now
up to 3 labels are supported.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Co-authored-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Simon Horman <horms@verge.net.au>
2014-02-04 10:41:30 -08:00
Ben Pfaff
1fe4c0a0ca ofp-util: Ignore out_group in flow_mods for commands other than delete.
OpenFlow 1.1 through 1.4 say that the out_group in a flow_mod, for commands
other than OFPFC_DELETE or OFPFC_DELETE_STRICT, should be ignored.  OVS
actually reported an error.  This fixes the problem.

Reported-by: chen zhang <3zhangchen9211@gmail.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2014-01-21 09:53:38 -08:00
Harold Lim
428b2eddc9 Rename NOT_REACHED to OVS_NOT_REACHED
This allows other libraries to use util.h that has already
defined NOT_REACHED.

Signed-off-by: Harold Lim <haroldl@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-12-17 13:16:39 -08:00
Ben Pfaff
4d197ebbf6 ofp-util: Implement OpenFlow 1.1 packet-in message.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
2013-12-04 08:23:32 -08:00
Ben Pfaff
0f83fea0f0 ofp-util: Break ofputil_encode_packet_in() into multiple functions.
This form makes it obvious that an OpenFlow 1.1 implementation is missing.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
2013-12-04 08:23:26 -08:00
Alin Serdean
34582733d9 Avoid printf type modifiers not supported by MSVC C runtime library.
The MSVC C library printf() implementation does not support the 'z', 't',
'j', or 'hh' format specifiers.  This commit changes the Open vSwitch code
to avoid those format specifiers, switching to standard macros from
<inttypes.h> where available and inventing new macros resembling them
where necessary.  It also updates CodingStyle to specify the macros' use
and adds a Makefile rule to report violations.

Signed-off-by: Alin Serdean <aserdean@cloudbasesolutions.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-25 23:38:59 -08:00
Ben Pfaff
ba2fe8e9f1 ofp-actions: Make ofpacts_check() report consistency for all protocols.
Until now ofpacts_check() has been told either to enforce consistency or
not, but that means that the caller has to know exactly what protocol is
going to be in use (because some protocols require consistency to be
enforced and others don't).  This commit changes ofpacts_check() to just
rule out protocols that require enforcement when it detects
inconsistencies.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-11-20 09:37:16 -08:00
Jarno Rajahalme
476f36e83b Classifier: Staged subtable matching.
Subtable lookup is performed in ranges defined for struct flow,
starting from metadata (registers, in_port, etc.), then L2 header, L3,
and finally L4 ports.  Whenever it is found that there are no matches
in the current subtable, the rest of the subtable can be skipped.  The
rationale of this logic is that as many fields as possible can remain
wildcarded.


Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-11-19 17:31:29 -08:00
Simon Horman
083761ad80 ofproto: Add enum ofp_table
Add enum ofp_table and use it for Flow Mod.

Cc: Andy Zhou <azhou@nicira.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-12 08:38:22 -08:00
Ben Pfaff
13b1febe4f ofp-util: Report OFPMMFC_BAD_FLAGS for bad band flags.
It doesn't make sense to specify both kbps and pkt/s, because the two units
are mutually exclusive.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-11-05 09:47:02 -08:00
Ben Pfaff
142cdb018d ofp-util: Report OFPMMFC_BAD_COMMAND for bad meter mod commands.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-11-05 09:46:53 -08:00
Ben Pfaff
f99d6aa01f ofp-util: Report OFPMMFC_BAD_BAND for bad band type in meter mod decoding.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-11-05 09:46:44 -08:00
Simon Horman
2134b5ec7d ofproto: Add group desc and stats tests
Lightly exercise group desc and stats

Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com found that a new test segfaulted and folded in fixes]
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-02 17:55:29 -07:00
Simon Horman
e57681e530 ofproto: Verify compatibility of liveness of groups with their type
Require liveness for fast-failover groups as it is mandated by OpenFlow1.3.
Allow livness for select groups which is in keeping with OpenFlow1.3.
Disallow liveness it for other group types.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-01 23:02:20 -07:00
Jarno Rajahalme
097d493945 Add OF11 SET MPLS LABEL and SET MPLS TC actions.
Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
2013-11-01 22:36:16 -07:00
Ben Pfaff
7e9f8266a4 ofproto: Centralize action checking, doing it at decode time.
Jarno pointed out that modify_flows__() didn't really need to check every
instance of the flow separately.  After some further investigation I
decided that this was even more of an improvement.

CC: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-11-01 22:23:23 -07:00
Ben Pfaff
0e19706066 ofp-util: Enforce OpenFlow 1.1+ table_id requirements in flow_mod messages.
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-01 22:20:17 -07:00
Ben Pfaff
57ad4e9ed5 ofp-util: Move ofputil_check_output_port() to ofp-actions, rename.
This function is related to actions to ofp-actions seems like a logical
place for it.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
2013-11-01 22:18:38 -07:00
Jarno Rajahalme
e3f8f88748 ofp-actions: Simplify interface and internal structure.
This makes later changes simpler.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2013-11-01 16:07:08 -07:00