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

279 Commits

Author SHA1 Message Date
Isaku Yamahata
3e34fbdd62 OF11: push_vlan support
This implementes push_vlan with 802.1Q.
NOTE: 802.1AD (QinQ) is not supported. It requires another effort.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-10-26 09:49:05 -07:00
Joe Stringer
4cceacb94c ofp-actions: Implement writing to metadata field
In OpenFlow 1.1, we add support for OFPIT_WRITE_METADATA. This allows us to
write to the metadata field. Internally it is represented using ofpact_metadata.

We introduce NXAST_WRITE_METADATA to handle writing to the metadata field in
OpenFlow 1.0+. This structure reflects OFPIT_WRITE_METADATA.

When writing out the structure to OpenFlow 1.1, it uses the OFPIT_WRITE_METADATA
instruction only, and not the new NXAST action (which would be redundant).

Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-10-18 12:44:54 -07:00
Ben Pfaff
9908606290 ofp-actions: Prefer OFPAT11_DEC_TTL to NXAST_DEC_TTL for OpenFlow 1.1+.
When "dec_ttl" is specified as the name of an action, in OpenFlow 1.1 and
later we should prefer to use the standardized action, rather than the
Nicira extension.

Reported-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Isaku Yamahata <yamahata@valinux.co.jp>
2012-10-18 11:39:28 -07:00
Isaku Yamahata
8e61c1104e ofpaction: support OF11 pop_vlan
This patch adds support of OF11+ pop_vlan.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
[blp@nicira.com added a test]
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-10-18 10:36:07 -07:00
Isaku Yamahata
7bcb1506ee lib: support OF11 dec_nw_ttl
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
[blp@nicira.com changed code to use "dec_ttl" instead of "dec_nw_ttl"]
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-10-18 08:52:57 -07:00
Ethan Jackson
f606c7e994 ofp-actions: Remove unused variable.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-10-16 15:40:27 -07:00
Isaku Yamahata
b19e879339 instruction/clear-actions: string parser/formater, of packet decoder/encoder
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-10-16 10:35:26 -07:00
Isaku Yamahata
8dd546660e instruction: support goto-table action
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-10-16 10:28:10 -07:00
Simon Horman
f5c45121cf ofp-actions: Add parsing of set_field actions
Based heavily on work by Isaku Yamahata <yamahata@valinux.co.jp>

Cc: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com adjusted documentation, added test]
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-28 09:52:23 -07:00
Isaku Yamahata
d55b18c8fa ofp-actions: Add support for OpenFlow 1.2 "set-field" action.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
[blp@nicira.com extracted this code from a larger patch by above, so:]
Signed-off-by: Ben Pfaff <blp@nicira.com>
[regarding final version of patch:]
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-09-26 09:21:28 -07:00
Ben Pfaff
3ddcaf2d7d ofp-actions: Allow OF1.1+ actions to be variable-length.
Previously there was no need for this, because all implemented standard
OpenFlow actions had a fixed length, but the OF1.2 "set-field" action (soon
to be implemented) is variable length.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-09-26 09:21:27 -07:00
Ben Pfaff
e9536ecb50 ofp-actions: Prepare to treat OF1.2 actions as OF1.1 actions.
The numbering of OpenFlow 1.0 actions overlaps with the numbering
of OpenFlow 1.1+ actions, so the two sets of actions have to be
distinguished for input and output.  But OpenFlow 1.1 and 1.2
actions are numbered to avoid this problem, so there is no need
to distinguish them in the same way.  Therefore, this commit
prepares to treat them together.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
2012-09-26 09:21:27 -07:00
Ben Pfaff
c6100d9214 ovs-ofctl: Accept port keywords, OF1.1 port numbers, reject port number 0.
OpenFlow 1.0 has special reserved ports in the range 0xfff8 to 0xffff.
OpenFlow 1.1 and later has the same ports in the range 0xfffffff8 to
0xffffffff and allows the OF1.0 range to be used for ordinary ("physical")
switch ports.  This means that, naively, the meaning of a port number in
the range 0xfff8 to 0xffff given on the ovs-ofctl command line depends on
the protocol in use.  This commit implements something a little smarter:

    - Accept keyword names (e.g. LOCAL) for special reserved ports
      everywhere that such a port can plausibly be used (previously they
      were only accepted in some places).

    - Translate 0xfff8...0xffff to 0xfffffff8...0xffffffff for now, since
      OF1.1+ isn't in widespread use and those particular ports aren't
      likely to be in use in OF1.1+ anyway.

    - Log warnings about those ports when they are specified by number, to
      allow users to fix their invocations.

Also:

    - Accept the OF1.1+ port numbers for these ports, without warning, for
      compatibility with the upcoming OF1.1+ support.

    - Stop accepting port number 0, which has never been a valid port
      number in OpenFlow 1.0 and later.  (This required fixing some tests
      that inadvertently used this port number).

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Simon Horman <horms@verge.net.au>
2012-09-20 08:40:29 -07:00
Simon Horman
78a3fff6c3 lib/ofp-util: preparation for OF12 of ofp-util
Add necessary macros to ofp-util for OF12 support.
This is just a placeholder.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-04 13:21:11 -07:00
Simon Horman
e38c9de5db ofp-errors: Remove OFPERR_NXBIC_DUP_TYPE
OFPERR_NXBIC_DUP_TYPE is currently only used in
decode_openflow11_instructions() which is part of a non-NX extension
portion of the Open Flow 1.1+ implementation.

After recent discussion it has been decided to attempt to only use
standardised, albeit less-specific, errors unless errors arise from use of
an NX extension.

With the above in mind it seems appropriate to:
* Use OFPERR_OFPIT_BAD_INSTRUCTION in place of OFPERR_NXBIC_DUP_TYPE.
* Remove OFPERR_NXBIC_DUP_TYPE as it is no longer used.

An unfortunate side-effect of this change is that the error for
the case in question is now less-specific.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-09-04 13:04:46 -07:00
Ethan Jackson
c51c638a13 nicira-ext: Deprecate the autopath action.
The autopath action is an obsolete attempt to replicate
functionality contained in the bundle action.  It is ugly and of
questionable usefulness.  This patch deprecates it and schedules
its removal for February 2013.  If there are concerns, please email
dev@openvswitch.org.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-08-28 18:27:05 -07:00
Isaku Yamahata
6ae0fd547b lib/ofp-actions: improve ofpact_instruction_name_from_type()
eliminate unnecessary loop.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-28 11:02:10 -07:00
Ethan Jackson
9ff262f435 ofp-actions: Correct copyright statement.
This patch changes the name of Nicira from "Nicira Networks" which
is incorrect, to "Nicira, Inc." which is correct.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-08-21 13:30:01 -07:00
Mehak Mahajan
c2d967a562 Add Nicira vendor extension action NXAST_DEC_TTL_CNT_IDS.
Currently, if a controller having a nonzero id registers to get a
OFPR_INVALID_TTL async message, it will not receive it.  This is because
compose_dec_ttl() only sent the invalid ttl packets to the default controller
id.  NXAST_DEC_TTL_CNT_IDS is a new action that accepts a list of controller
ids, each separated by `,', to which the OFPR_INVALID_TTL packets must be sent.
The earlier requirement of the controller having to explicitly register to
receive these asynchronous messages is retained.
The syntax of this action is:
    dec_ttl(id1,id2)
where id1, id2 are valid controller ids.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
2012-08-16 14:52:04 -07:00
Isaku Yamahata
a359d5ad70 ofp-actions/instruction: helper functions for intructions
This patch introduces helper functions
- to cast
- to convert from/to text

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-14 09:58:18 -07:00
Isaku Yamahata
a64f0b0fcd ofp-actions: export OVSINST_OFPIT11_xxx
They will be used by ofp-parser.c.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-14 09:58:11 -07:00
Simon Horman
a07c15bc39 ofp-actions: Return action size
Modify ofpacts_put_openflow11_actions() to return the length of actions
appended. This will be used when encoding Packet Out messages for
Open Flow 1.1 and 1.2. The motivation for this is to avoid open coding
the size calculation which may end up being needed elsewhere too.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-08 16:27:09 -07:00
Isaku Yamahata
0300caafc5 ofp-actions: simplify ofpacts_from_openflow1[01]
Those logic is same, so simplify it. This will be also use for OF12.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-18 09:07:27 -07:00
Ben Pfaff
699dddf180 ofp-actions: Improve action error logging a bit more.
Commit 0c449c5683a improved action error logging for one case, but we might
as well do it for the other case too.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-17 21:15:40 -07:00
Ethan Jackson
1ec3db6fd8 ofproto: Fix compiler warnings.
This patch fixes the following warnings on my system:

lib/ofp-actions.c:458:13: error: format '%x' expects argument of
type 'unsigned int', but argument 4 has type 'long unsigned int'
[-Werror=format]

ofproto/ofproto.c:3940:13: error: comparison between 'enum
ofoperation_type' and 'enum nx_flow_update_event'
[-Werror=enum-compare]

ofproto/ofproto.c:3941:13: error: comparison between 'enum
ofoperation_type' and 'enum nx_flow_update_event'
[-Werror=enum-compare]

ofproto/ofproto.c:3942:13: error: comparison between 'enum
ofoperation_type' and 'enum nx_flow_update_event'
[-Werror=enum-compare]

Signed-off-by: Ethan Jackson <ethan@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-17 09:47:14 -07:00
Ben Pfaff
13f894b1f0 ofp-actions: Improve comments.
Reported-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-16 14:46:22 -07:00
Ben Pfaff
0c449c5683 ofp-actions: Add hex dump of bad actions to log message on error.
This should make debugging easier in such cases.

Bug #12460.
Reported-by: Natasha Gude <natasha@nicira.com>
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-11 01:05:09 -07:00
Ben Pfaff
d01c980ffe ofp-actions: Add decoding and encoding OF1.1 instructions and actions.
So far, only the Apply-Actions instruction is supported, and only
actions that have identical semantics to OpenFlow 1.0 actions.

Co-authored-by: Simon Horman <horms@verge.net.au>
Co-authored-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-03 22:21:12 -07:00
Ben Pfaff
f25d0cf3c3 Introduce ofpacts, an abstraction of OpenFlow actions.
OpenFlow actions have always been somewhat awkward to handle.
Moreover, over time we've started creating actions that require more
complicated parsing.  When we maintain those actions internally in
their wire format, we end up parsing them multiple times, whenever
we have to look at the set of actions.

When we add support for OpenFlow 1.1 or later protocols, the situation
will get worse, because these newer protocols support many of the same
actions but with different representations.  It becomes unrealistic to
handle each protocol in its wire format.

This commit adopts a new strategy, by converting OpenFlow actions into
an internal form from the wire format when they are read, and converting
them back to the wire format when flows are dumped.  I believe that this
will be more maintainable over time.

Thanks to Simon Horman and Pravin Shelar for reviews.

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-07-03 22:21:11 -07:00