2009-07-08 13:19:16 -07:00
|
|
|
/*
|
2012-05-02 15:21:36 -07:00
|
|
|
* Copyright (c) 2007-2011 Nicira, Inc.
|
2009-07-08 13:19:16 -07:00
|
|
|
*
|
2009-06-15 15:11:30 -07:00
|
|
|
* This file is offered under your choice of two licenses: Apache 2.0 or GNU
|
|
|
|
* GPL 2.0 or later. The permission statements for each of these licenses is
|
|
|
|
* given below. You may license your modifications to this file under either
|
|
|
|
* of these licenses or both. If you wish to license your modifications under
|
|
|
|
* only one of these licenses, delete the permission text for the other
|
|
|
|
* license.
|
2009-07-08 13:19:16 -07:00
|
|
|
*
|
2009-06-15 15:11:30 -07:00
|
|
|
* ----------------------------------------------------------------------
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
* ----------------------------------------------------------------------
|
2011-11-16 13:39:40 -08:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of version 2 of the GNU General Public
|
|
|
|
* License as published by the Free Software Foundation.
|
2009-06-15 15:11:30 -07:00
|
|
|
*
|
2011-11-16 13:39:40 -08:00
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2009-06-15 15:11:30 -07:00
|
|
|
*
|
2011-11-16 13:39:40 -08:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301, USA
|
2009-06-15 15:11:30 -07:00
|
|
|
* ----------------------------------------------------------------------
|
2009-07-08 13:19:16 -07:00
|
|
|
*/
|
|
|
|
|
2011-10-05 10:50:58 -07:00
|
|
|
#ifndef _LINUX_OPENVSWITCH_H
|
|
|
|
#define _LINUX_OPENVSWITCH_H 1
|
2009-07-08 13:19:16 -07:00
|
|
|
|
|
|
|
#include <linux/types.h>
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
|
2011-10-22 18:50:44 -07:00
|
|
|
/**
|
|
|
|
* struct ovs_header - header for OVS Generic Netlink messages.
|
|
|
|
* @dp_ifindex: ifindex of local port for datapath (0 to make a request not
|
|
|
|
* specific to a datapath).
|
|
|
|
*
|
|
|
|
* Attributes following the header are specific to a particular OVS Generic
|
|
|
|
* Netlink family, but all of the OVS families use this header.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ovs_header {
|
|
|
|
int dp_ifindex;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Datapaths. */
|
2011-01-28 13:55:04 -08:00
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_DATAPATH_FAMILY "ovs_datapath"
|
|
|
|
#define OVS_DATAPATH_MCGROUP "ovs_datapath"
|
2011-10-22 18:22:18 -07:00
|
|
|
#define OVS_DATAPATH_VERSION 0x1
|
2011-08-18 10:35:40 -07:00
|
|
|
|
|
|
|
enum ovs_datapath_cmd {
|
|
|
|
OVS_DP_CMD_UNSPEC,
|
|
|
|
OVS_DP_CMD_NEW,
|
|
|
|
OVS_DP_CMD_DEL,
|
|
|
|
OVS_DP_CMD_GET,
|
|
|
|
OVS_DP_CMD_SET
|
2011-01-28 13:55:04 -08:00
|
|
|
};
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2011-01-26 15:42:00 -08:00
|
|
|
/**
|
2011-08-18 10:35:40 -07:00
|
|
|
* enum ovs_datapath_attr - attributes for %OVS_DP_* commands.
|
|
|
|
* @OVS_DP_ATTR_NAME: Name of the network device that serves as the "local
|
2011-01-21 17:01:56 -08:00
|
|
|
* port". This is the name of the network device whose dp_ifindex is given in
|
2011-08-18 10:35:40 -07:00
|
|
|
* the &struct ovs_header. Always present in notifications. Required in
|
|
|
|
* %OVS_DP_NEW requests. May be used as an alternative to specifying
|
2011-01-21 17:01:56 -08:00
|
|
|
* dp_ifindex in other requests (with a dp_ifindex of 0).
|
2011-09-14 13:05:09 -07:00
|
|
|
* @OVS_DP_ATTR_UPCALL_PID: The Netlink socket in userspace that is initially
|
|
|
|
* set on the datapath port (for OVS_ACTION_ATTR_MISS). Only valid on
|
|
|
|
* %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
|
|
|
|
* not be sent.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
|
2011-01-28 13:55:04 -08:00
|
|
|
* datapath. Always present in notifications.
|
2011-01-26 15:42:00 -08:00
|
|
|
*
|
2011-08-18 10:35:40 -07:00
|
|
|
* These attributes follow the &struct ovs_header within the Generic Netlink
|
|
|
|
* payload for %OVS_DP_* commands.
|
2011-01-26 15:42:00 -08:00
|
|
|
*/
|
2011-08-18 10:35:40 -07:00
|
|
|
enum ovs_datapath_attr {
|
|
|
|
OVS_DP_ATTR_UNSPEC,
|
|
|
|
OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */
|
2011-09-14 13:05:09 -07:00
|
|
|
OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */
|
|
|
|
__OVS_DP_ATTR_MAX
|
2011-01-26 15:42:00 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_DP_ATTR_MAX (__OVS_DP_ATTR_MAX - 1)
|
2011-01-26 15:42:00 -08:00
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_dp_stats {
|
2011-10-22 18:50:44 -07:00
|
|
|
__u64 n_hit; /* Number of flow table matches. */
|
|
|
|
__u64 n_missed; /* Number of flow table misses. */
|
|
|
|
__u64 n_lost; /* Number of misses not sent to userspace. */
|
|
|
|
__u64 n_flows; /* Number of flows present */
|
2009-07-08 13:19:16 -07:00
|
|
|
};
|
|
|
|
|
2011-09-15 19:36:17 -07:00
|
|
|
struct ovs_vport_stats {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__u64 rx_packets; /* total packets received */
|
|
|
|
__u64 tx_packets; /* total packets transmitted */
|
|
|
|
__u64 rx_bytes; /* total bytes received */
|
|
|
|
__u64 tx_bytes; /* total bytes transmitted */
|
|
|
|
__u64 rx_errors; /* bad packets received */
|
|
|
|
__u64 tx_errors; /* packet transmit problems */
|
|
|
|
__u64 rx_dropped; /* no space in linux buffers */
|
|
|
|
__u64 tx_dropped; /* no space available in linux */
|
2011-09-15 19:36:17 -07:00
|
|
|
};
|
|
|
|
|
2011-10-22 18:50:44 -07:00
|
|
|
/* Fixed logical ports. */
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
#define OVSP_LOCAL ((__u16)0)
|
2011-10-22 18:50:44 -07:00
|
|
|
|
|
|
|
/* Packet transfer. */
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_PACKET_FAMILY "ovs_packet"
|
2011-10-22 18:22:18 -07:00
|
|
|
#define OVS_PACKET_VERSION 0x1
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
enum ovs_packet_cmd {
|
2011-10-22 18:50:44 -07:00
|
|
|
OVS_PACKET_CMD_UNSPEC,
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2011-10-22 18:50:44 -07:00
|
|
|
/* Kernel-to-user notifications. */
|
|
|
|
OVS_PACKET_CMD_MISS, /* Flow table miss. */
|
|
|
|
OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */
|
2011-01-26 13:41:54 -08:00
|
|
|
|
2011-10-22 18:50:44 -07:00
|
|
|
/* Userspace commands. */
|
|
|
|
OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */
|
2011-01-26 13:41:54 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2011-08-18 10:35:40 -07:00
|
|
|
* enum ovs_packet_attr - attributes for %OVS_PACKET_* commands.
|
|
|
|
* @OVS_PACKET_ATTR_PACKET: Present for all notifications. Contains the entire
|
2011-01-26 13:41:54 -08:00
|
|
|
* packet as received, from the start of the Ethernet header onward. For
|
2011-08-18 10:35:40 -07:00
|
|
|
* %OVS_PACKET_CMD_ACTION, %OVS_PACKET_ATTR_PACKET reflects changes made by
|
|
|
|
* actions preceding %OVS_ACTION_ATTR_USERSPACE, but %OVS_PACKET_ATTR_KEY is
|
2011-01-23 21:56:00 -08:00
|
|
|
* the flow key extracted from the packet as originally received.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_PACKET_ATTR_KEY: Present for all notifications. Contains the flow key
|
|
|
|
* extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows
|
2011-01-26 13:41:54 -08:00
|
|
|
* userspace to adapt its flow setup strategy by comparing its notion of the
|
|
|
|
* flow key against the kernel's.
|
2011-09-28 10:43:07 -07:00
|
|
|
* @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used
|
|
|
|
* for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION
|
2011-10-12 16:24:54 -07:00
|
|
|
* notification if the %OVS_ACTION_ATTR_USERSPACE action specified an
|
|
|
|
* %OVS_USERSPACE_ATTR_USERDATA attribute.
|
2011-01-26 13:41:54 -08:00
|
|
|
*
|
2011-08-18 10:35:40 -07:00
|
|
|
* These attributes follow the &struct ovs_header within the Generic Netlink
|
|
|
|
* payload for %OVS_PACKET_* commands.
|
2011-01-26 13:41:54 -08:00
|
|
|
*/
|
2011-08-18 10:35:40 -07:00
|
|
|
enum ovs_packet_attr {
|
|
|
|
OVS_PACKET_ATTR_UNSPEC,
|
|
|
|
OVS_PACKET_ATTR_PACKET, /* Packet data. */
|
|
|
|
OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */
|
2011-09-28 10:43:07 -07:00
|
|
|
OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */
|
|
|
|
__OVS_PACKET_ATTR_MAX
|
2010-01-04 13:08:37 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_PACKET_ATTR_MAX (__OVS_PACKET_ATTR_MAX - 1)
|
2011-01-23 20:01:30 -08:00
|
|
|
|
2011-10-22 18:50:44 -07:00
|
|
|
/* Virtual ports. */
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_VPORT_FAMILY "ovs_vport"
|
|
|
|
#define OVS_VPORT_MCGROUP "ovs_vport"
|
2011-10-22 18:22:18 -07:00
|
|
|
#define OVS_VPORT_VERSION 0x1
|
2011-08-18 10:35:40 -07:00
|
|
|
|
|
|
|
enum ovs_vport_cmd {
|
|
|
|
OVS_VPORT_CMD_UNSPEC,
|
|
|
|
OVS_VPORT_CMD_NEW,
|
|
|
|
OVS_VPORT_CMD_DEL,
|
|
|
|
OVS_VPORT_CMD_GET,
|
|
|
|
OVS_VPORT_CMD_SET
|
2011-01-28 13:59:03 -08:00
|
|
|
};
|
2011-01-23 20:01:30 -08:00
|
|
|
|
2011-10-22 18:50:44 -07:00
|
|
|
enum ovs_vport_type {
|
|
|
|
OVS_VPORT_TYPE_UNSPEC,
|
|
|
|
OVS_VPORT_TYPE_NETDEV, /* network device */
|
|
|
|
OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
|
2012-11-05 13:38:34 -08:00
|
|
|
OVS_VPORT_TYPE_FT_GRE, /* Flow based GRE tunnel. */
|
2011-11-05 20:13:55 -07:00
|
|
|
OVS_VPORT_TYPE_PATCH = 100, /* virtual tunnel connecting two vports */
|
2011-10-22 18:50:44 -07:00
|
|
|
OVS_VPORT_TYPE_GRE, /* GRE tunnel */
|
|
|
|
OVS_VPORT_TYPE_CAPWAP, /* CAPWAP tunnel */
|
2012-10-05 17:55:02 -07:00
|
|
|
OVS_VPORT_TYPE_GRE64 = 104, /* GRE tunnel with 64-bit keys */
|
2011-10-22 18:50:44 -07:00
|
|
|
__OVS_VPORT_TYPE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OVS_VPORT_TYPE_MAX (__OVS_VPORT_TYPE_MAX - 1)
|
|
|
|
|
datapath: Change listing ports to use an iterator concept.
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 add new
features to the kernel vport layer without changing userspace software. In
turn, that means that the odp_port structure must become variable-length.
This does not, however, fit in well with the ODP_PORT_LIST ioctl in its
current form, because that would require userspace to know how much space
to allocate for each port in advance, or to allocate as much space as
could possibly be needed. Neither choice is very attractive.
This commit prepares for a different solution, by replacing ODP_PORT_LIST
by a new ioctl ODP_VPORT_DUMP that retrieves information about a single
vport from the datapath on each call. It is much cleaner to allocate the
maximum amount of space for a single vport than to do so for possibly a
large number of vports.
It would be faster to retrieve a number of vports in batch instead of just
one at a time, but that will naturally happen later when the kernel
datapath interface is changed to use Netlink, so this patch does not bother
with it.
The Netlink version won't need to take the starting port number from
userspace, since Netlink sockets can keep track of that state as part
of their "dump" feature.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-10 13:12:12 -08:00
|
|
|
/**
|
2011-08-18 10:35:40 -07:00
|
|
|
* enum ovs_vport_attr - attributes for %OVS_VPORT_* commands.
|
|
|
|
* @OVS_VPORT_ATTR_PORT_NO: 32-bit port number within datapath.
|
|
|
|
* @OVS_VPORT_ATTR_TYPE: 32-bit %OVS_VPORT_TYPE_* constant describing the type
|
2011-01-28 13:59:03 -08:00
|
|
|
* of vport.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device
|
2011-01-28 13:59:03 -08:00
|
|
|
* this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes
|
|
|
|
* plus a null terminator.
|
2011-11-05 20:13:55 -07:00
|
|
|
* @OVS_VPORT_ATTR_OPTIONS: Vport-specific configuration information.
|
2011-09-14 13:05:09 -07:00
|
|
|
* @OVS_VPORT_ATTR_UPCALL_PID: The Netlink socket in userspace that
|
|
|
|
* OVS_PACKET_CMD_MISS upcalls will be directed to for packets received on
|
|
|
|
* this port. A value of zero indicates that upcalls should not be sent.
|
2011-09-15 19:36:17 -07:00
|
|
|
* @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for
|
2011-01-28 13:59:03 -08:00
|
|
|
* packets sent or received through the vport.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_VPORT_ATTR_ADDRESS: A 6-byte Ethernet address for the vport.
|
2011-01-28 13:59:03 -08:00
|
|
|
*
|
2011-08-18 10:35:40 -07:00
|
|
|
* These attributes follow the &struct ovs_header within the Generic Netlink
|
|
|
|
* payload for %OVS_VPORT_* commands.
|
datapath: Change listing ports to use an iterator concept.
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 add new
features to the kernel vport layer without changing userspace software. In
turn, that means that the odp_port structure must become variable-length.
This does not, however, fit in well with the ODP_PORT_LIST ioctl in its
current form, because that would require userspace to know how much space
to allocate for each port in advance, or to allocate as much space as
could possibly be needed. Neither choice is very attractive.
This commit prepares for a different solution, by replacing ODP_PORT_LIST
by a new ioctl ODP_VPORT_DUMP that retrieves information about a single
vport from the datapath on each call. It is much cleaner to allocate the
maximum amount of space for a single vport than to do so for possibly a
large number of vports.
It would be faster to retrieve a number of vports in batch instead of just
one at a time, but that will naturally happen later when the kernel
datapath interface is changed to use Netlink, so this patch does not bother
with it.
The Netlink version won't need to take the starting port number from
userspace, since Netlink sockets can keep track of that state as part
of their "dump" feature.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-10 13:12:12 -08:00
|
|
|
*
|
2011-08-18 10:35:40 -07:00
|
|
|
* For %OVS_VPORT_CMD_NEW requests, the %OVS_VPORT_ATTR_TYPE and
|
|
|
|
* %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is
|
2011-01-28 13:59:03 -08:00
|
|
|
* optional; if not specified a free port number is automatically selected.
|
2011-08-18 10:35:40 -07:00
|
|
|
* Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type
|
2011-09-12 17:12:52 -07:00
|
|
|
* of vport. %OVS_VPORT_ATTR_STATS and %OVS_VPORT_ATTR_ADDRESS are optional,
|
|
|
|
* and other attributes are ignored.
|
2011-01-28 13:59:03 -08:00
|
|
|
*
|
2011-08-18 10:35:40 -07:00
|
|
|
* For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to
|
2011-01-28 13:59:03 -08:00
|
|
|
* look up the vport to operate on; otherwise dp_idx from the &struct
|
2011-08-18 10:35:40 -07:00
|
|
|
* ovs_header plus %OVS_VPORT_ATTR_PORT_NO determine the vport.
|
datapath: Change listing ports to use an iterator concept.
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 add new
features to the kernel vport layer without changing userspace software. In
turn, that means that the odp_port structure must become variable-length.
This does not, however, fit in well with the ODP_PORT_LIST ioctl in its
current form, because that would require userspace to know how much space
to allocate for each port in advance, or to allocate as much space as
could possibly be needed. Neither choice is very attractive.
This commit prepares for a different solution, by replacing ODP_PORT_LIST
by a new ioctl ODP_VPORT_DUMP that retrieves information about a single
vport from the datapath on each call. It is much cleaner to allocate the
maximum amount of space for a single vport than to do so for possibly a
large number of vports.
It would be faster to retrieve a number of vports in batch instead of just
one at a time, but that will naturally happen later when the kernel
datapath interface is changed to use Netlink, so this patch does not bother
with it.
The Netlink version won't need to take the starting port number from
userspace, since Netlink sockets can keep track of that state as part
of their "dump" feature.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-01-10 13:12:12 -08:00
|
|
|
*/
|
2011-08-18 10:35:40 -07:00
|
|
|
enum ovs_vport_attr {
|
|
|
|
OVS_VPORT_ATTR_UNSPEC,
|
2011-10-25 14:03:35 -07:00
|
|
|
OVS_VPORT_ATTR_PORT_NO, /* u32 port number within datapath */
|
|
|
|
OVS_VPORT_ATTR_TYPE, /* u32 OVS_VPORT_TYPE_* constant. */
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */
|
2011-11-05 20:13:55 -07:00
|
|
|
OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */
|
2011-10-25 14:03:35 -07:00
|
|
|
OVS_VPORT_ATTR_UPCALL_PID, /* u32 Netlink PID to receive upcalls */
|
2011-09-15 19:36:17 -07:00
|
|
|
OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */
|
2011-11-05 20:13:55 -07:00
|
|
|
OVS_VPORT_ATTR_ADDRESS = 100, /* hardware address */
|
2011-08-18 10:35:40 -07:00
|
|
|
__OVS_VPORT_ATTR_MAX
|
2009-07-08 13:19:16 -07:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
|
2011-01-26 12:28:59 -08:00
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
/* OVS_VPORT_ATTR_OPTIONS attributes for patch vports. */
|
2011-01-26 12:28:59 -08:00
|
|
|
enum {
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_PATCH_ATTR_UNSPEC,
|
|
|
|
OVS_PATCH_ATTR_PEER, /* name of peer vport, as a string */
|
|
|
|
__OVS_PATCH_ATTR_MAX
|
2011-01-26 12:28:59 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_PATCH_ATTR_MAX (__OVS_PATCH_ATTR_MAX - 1)
|
2011-10-22 18:50:44 -07:00
|
|
|
|
2011-01-28 14:00:51 -08:00
|
|
|
/* Flows. */
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_FLOW_FAMILY "ovs_flow"
|
|
|
|
#define OVS_FLOW_MCGROUP "ovs_flow"
|
2011-10-22 18:22:18 -07:00
|
|
|
#define OVS_FLOW_VERSION 0x1
|
2011-01-28 14:00:51 -08:00
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
enum ovs_flow_cmd {
|
|
|
|
OVS_FLOW_CMD_UNSPEC,
|
|
|
|
OVS_FLOW_CMD_NEW,
|
|
|
|
OVS_FLOW_CMD_DEL,
|
|
|
|
OVS_FLOW_CMD_GET,
|
|
|
|
OVS_FLOW_CMD_SET
|
2011-01-28 14:00:51 -08:00
|
|
|
};
|
2011-01-26 12:28:59 -08:00
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_flow_stats {
|
2011-10-22 18:50:44 -07:00
|
|
|
__u64 n_packets; /* Number of matched packets. */
|
|
|
|
__u64 n_bytes; /* Number of matched bytes. */
|
2009-07-08 13:19:16 -07:00
|
|
|
};
|
|
|
|
|
2011-10-05 09:59:51 -07:00
|
|
|
enum ovs_key_attr {
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_KEY_ATTR_UNSPEC,
|
2011-11-14 15:56:43 -08:00
|
|
|
OVS_KEY_ATTR_ENCAP, /* Nested set of encapsulated attributes. */
|
2011-11-01 17:13:06 -07:00
|
|
|
OVS_KEY_ATTR_PRIORITY, /* u32 skb->priority */
|
|
|
|
OVS_KEY_ATTR_IN_PORT, /* u32 OVS dp port number */
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_KEY_ATTR_ETHERNET, /* struct ovs_key_ethernet */
|
2011-11-14 15:56:43 -08:00
|
|
|
OVS_KEY_ATTR_VLAN, /* be16 VLAN TCI */
|
2011-11-01 17:13:06 -07:00
|
|
|
OVS_KEY_ATTR_ETHERTYPE, /* be16 Ethernet type */
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_KEY_ATTR_IPV4, /* struct ovs_key_ipv4 */
|
|
|
|
OVS_KEY_ATTR_IPV6, /* struct ovs_key_ipv6 */
|
|
|
|
OVS_KEY_ATTR_TCP, /* struct ovs_key_tcp */
|
|
|
|
OVS_KEY_ATTR_UDP, /* struct ovs_key_udp */
|
|
|
|
OVS_KEY_ATTR_ICMP, /* struct ovs_key_icmp */
|
|
|
|
OVS_KEY_ATTR_ICMPV6, /* struct ovs_key_icmpv6 */
|
|
|
|
OVS_KEY_ATTR_ARP, /* struct ovs_key_arp */
|
|
|
|
OVS_KEY_ATTR_ND, /* struct ovs_key_nd */
|
2012-11-05 11:08:47 -08:00
|
|
|
OVS_KEY_ATTR_IPV4_TUNNEL, /* struct ovs_key_ipv4_tunnel */
|
2012-10-20 12:15:24 -07:00
|
|
|
OVS_KEY_ATTR_TUN_ID = 63, /* be64 tunnel ID */
|
2011-08-18 10:35:40 -07:00
|
|
|
__OVS_KEY_ATTR_MAX
|
2011-01-23 18:44:44 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_KEY_ATTR_MAX (__OVS_KEY_ATTR_MAX - 1)
|
2011-01-23 18:44:44 -08:00
|
|
|
|
Implement new fragment handling policy.
Until now, OVS has handled IP fragments more awkwardly than necessary. It
has not been possible to match on L4 headers, even in fragments with offset
0 where they are actually present. This means that there was no way to
implement ACLs that treat, say, different TCP ports differently, on
fragmented traffic; instead, all decisions for fragment forwarding had to
be made on the basis of L2 and L3 headers alone.
This commit improves the situation significantly. It is still not possible
to match on L4 headers in fragments with nonzero offset, because that
information is simply not present in such fragments, but this commit adds
the ability to match on L4 headers for fragments with zero offset. This
means that it becomes possible to implement ACLs that drop such "first
fragments" on the basis of L4 headers. In practice, that effectively
blocks even fragmented traffic on an L4 basis, because the receiving IP
stack cannot reassemble a full packet when the first fragment is missing.
This commit works by adding a new "fragment type" to the kernel flow match
and making it available through OpenFlow as a new NXM field named
NXM_NX_IP_FRAG. Because OpenFlow 1.0 explicitly says that the L4 fields
are always 0 for IP fragments, it adds a new OpenFlow fragment handling
mode that fills in the L4 fields for "first fragments". It also enhances
ovs-ofctl to allow users to configure this new fragment handling mode and
to parse the new field.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Bug #7557.
2011-10-19 21:33:44 -07:00
|
|
|
/**
|
|
|
|
* enum ovs_frag_type - IPv4 and IPv6 fragment type
|
|
|
|
* @OVS_FRAG_TYPE_NONE: Packet is not a fragment.
|
|
|
|
* @OVS_FRAG_TYPE_FIRST: Packet is a fragment with offset 0.
|
|
|
|
* @OVS_FRAG_TYPE_LATER: Packet is a fragment with nonzero offset.
|
|
|
|
*
|
|
|
|
* Used as the @ipv4_frag in &struct ovs_key_ipv4 and as @ipv6_frag &struct
|
|
|
|
* ovs_key_ipv6.
|
|
|
|
*/
|
|
|
|
enum ovs_frag_type {
|
|
|
|
OVS_FRAG_TYPE_NONE,
|
|
|
|
OVS_FRAG_TYPE_FIRST,
|
|
|
|
OVS_FRAG_TYPE_LATER,
|
|
|
|
__OVS_FRAG_TYPE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_ethernet {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__u8 eth_src[6];
|
|
|
|
__u8 eth_dst[6];
|
2011-01-23 18:44:44 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_ipv4 {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__be32 ipv4_src;
|
|
|
|
__be32 ipv4_dst;
|
|
|
|
__u8 ipv4_proto;
|
|
|
|
__u8 ipv4_tos;
|
2011-11-05 15:48:12 -07:00
|
|
|
__u8 ipv4_ttl;
|
Implement new fragment handling policy.
Until now, OVS has handled IP fragments more awkwardly than necessary. It
has not been possible to match on L4 headers, even in fragments with offset
0 where they are actually present. This means that there was no way to
implement ACLs that treat, say, different TCP ports differently, on
fragmented traffic; instead, all decisions for fragment forwarding had to
be made on the basis of L2 and L3 headers alone.
This commit improves the situation significantly. It is still not possible
to match on L4 headers in fragments with nonzero offset, because that
information is simply not present in such fragments, but this commit adds
the ability to match on L4 headers for fragments with zero offset. This
means that it becomes possible to implement ACLs that drop such "first
fragments" on the basis of L4 headers. In practice, that effectively
blocks even fragmented traffic on an L4 basis, because the receiving IP
stack cannot reassemble a full packet when the first fragment is missing.
This commit works by adding a new "fragment type" to the kernel flow match
and making it available through OpenFlow as a new NXM field named
NXM_NX_IP_FRAG. Because OpenFlow 1.0 explicitly says that the L4 fields
are always 0 for IP fragments, it adds a new OpenFlow fragment handling
mode that fills in the L4 fields for "first fragments". It also enhances
ovs-ofctl to allow users to configure this new fragment handling mode and
to parse the new field.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Bug #7557.
2011-10-19 21:33:44 -07:00
|
|
|
__u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
|
2011-01-23 18:44:44 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_ipv6 {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__be32 ipv6_src[4];
|
|
|
|
__be32 ipv6_dst[4];
|
2011-11-01 15:57:56 -07:00
|
|
|
__be32 ipv6_label; /* 20-bits in least-significant bits. */
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__u8 ipv6_proto;
|
2011-11-09 12:17:38 -08:00
|
|
|
__u8 ipv6_tclass;
|
2011-11-05 15:48:12 -07:00
|
|
|
__u8 ipv6_hlimit;
|
Implement new fragment handling policy.
Until now, OVS has handled IP fragments more awkwardly than necessary. It
has not been possible to match on L4 headers, even in fragments with offset
0 where they are actually present. This means that there was no way to
implement ACLs that treat, say, different TCP ports differently, on
fragmented traffic; instead, all decisions for fragment forwarding had to
be made on the basis of L2 and L3 headers alone.
This commit improves the situation significantly. It is still not possible
to match on L4 headers in fragments with nonzero offset, because that
information is simply not present in such fragments, but this commit adds
the ability to match on L4 headers for fragments with zero offset. This
means that it becomes possible to implement ACLs that drop such "first
fragments" on the basis of L4 headers. In practice, that effectively
blocks even fragmented traffic on an L4 basis, because the receiving IP
stack cannot reassemble a full packet when the first fragment is missing.
This commit works by adding a new "fragment type" to the kernel flow match
and making it available through OpenFlow as a new NXM field named
NXM_NX_IP_FRAG. Because OpenFlow 1.0 explicitly says that the L4 fields
are always 0 for IP fragments, it adds a new OpenFlow fragment handling
mode that fills in the L4 fields for "first fragments". It also enhances
ovs-ofctl to allow users to configure this new fragment handling mode and
to parse the new field.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Bug #7557.
2011-10-19 21:33:44 -07:00
|
|
|
__u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
|
2010-12-29 19:03:46 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_tcp {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__be16 tcp_src;
|
|
|
|
__be16 tcp_dst;
|
2011-01-23 18:44:44 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_udp {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__be16 udp_src;
|
|
|
|
__be16 udp_dst;
|
2011-01-23 18:44:44 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_icmp {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__u8 icmp_type;
|
|
|
|
__u8 icmp_code;
|
2011-01-23 18:44:44 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_icmpv6 {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__u8 icmpv6_type;
|
|
|
|
__u8 icmpv6_code;
|
2010-12-29 19:03:46 -08:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_arp {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__be32 arp_sip;
|
|
|
|
__be32 arp_tip;
|
|
|
|
__be16 arp_op;
|
|
|
|
__u8 arp_sha[6];
|
|
|
|
__u8 arp_tha[6];
|
2009-07-08 13:19:16 -07:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
struct ovs_key_nd {
|
datapath-protocol: Use Linux kernel types directly.
We want datapath-protocol.h to be acceptable as a Linux kernel header, so
it must use Linux kernel types and must not have references to Open vSwitch
symbols or header files. This commit primarily makes that change to
datapath-protocol.h.
At the same time, at least for now we also want datapath-protocol.h to be
usable on non-Linux platforms, so we need some kind of compatiblity. Thus,
this commit also introduces a <linux/types.h> header file that defines the
necessary Linux kernel types on non-Linux platforms.
In turn, this requires openvswitch/types.h to use the Linux types directly
for ovs_be<N>; otherwise, sparse complains because now __be<N> and
ovs_be<N> are incompatible from its perspective, so this commit makes that
change too.
I don't have a non-Linux kernel platform readily available, so I only
tested the non-Linux part of the linux/types.h substitute by forcing that
case to be triggered with #if 0. It worked, except for errors in actual
Linux kernel headers included explicitly from OVS source files, so I think
it's likely to work in practice.
Bug #7559.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-10-05 10:42:34 -07:00
|
|
|
__u32 nd_target[4];
|
|
|
|
__u8 nd_sll[6];
|
|
|
|
__u8 nd_tll[6];
|
2011-02-01 22:54:11 -08:00
|
|
|
};
|
|
|
|
|
2012-10-20 12:15:24 -07:00
|
|
|
/* Values for ovs_key_ipv4_tunnel->tun_flags */
|
2012-11-06 12:45:19 -08:00
|
|
|
#define OVS_TNL_F_DONT_FRAGMENT (1 << 0)
|
|
|
|
#define OVS_TNL_F_CSUM (1 << 1)
|
|
|
|
#define OVS_TNL_F_KEY (1 << 2)
|
2012-10-20 12:15:24 -07:00
|
|
|
|
|
|
|
struct ovs_key_ipv4_tunnel {
|
|
|
|
__be64 tun_id;
|
|
|
|
__u32 tun_flags;
|
|
|
|
__be32 ipv4_src;
|
|
|
|
__be32 ipv4_dst;
|
|
|
|
__u8 ipv4_tos;
|
|
|
|
__u8 ipv4_ttl;
|
|
|
|
__u8 pad[2];
|
|
|
|
};
|
|
|
|
|
2011-01-26 15:42:00 -08:00
|
|
|
/**
|
2011-08-18 10:35:40 -07:00
|
|
|
* enum ovs_flow_attr - attributes for %OVS_FLOW_* commands.
|
|
|
|
* @OVS_FLOW_ATTR_KEY: Nested %OVS_KEY_ATTR_* attributes specifying the flow
|
2011-01-28 14:00:51 -08:00
|
|
|
* key. Always present in notifications. Required for all requests (except
|
|
|
|
* dumps).
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying
|
2011-08-18 10:31:15 -07:00
|
|
|
* the actions to take for packets that match the key. Always present in
|
2011-11-01 14:16:41 -07:00
|
|
|
* notifications. Required for %OVS_FLOW_CMD_NEW requests, optional for
|
|
|
|
* %OVS_FLOW_CMD_SET requests.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this
|
2011-01-28 14:00:51 -08:00
|
|
|
* flow. Present in notifications if the stats would be nonzero. Ignored in
|
|
|
|
* requests.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_FLOW_ATTR_TCP_FLAGS: An 8-bit value giving the OR'd value of all of the
|
2011-01-28 14:00:51 -08:00
|
|
|
* TCP flags seen on packets in this flow. Only present in notifications for
|
|
|
|
* TCP flows, and only if it would be nonzero. Ignored in requests.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_FLOW_ATTR_USED: A 64-bit integer giving the time, in milliseconds on
|
2011-01-28 14:00:51 -08:00
|
|
|
* the system monotonic clock, at which a packet was last processed for this
|
|
|
|
* flow. Only present in notifications if a packet has been processed for this
|
|
|
|
* flow. Ignored in requests.
|
2011-08-18 10:35:40 -07:00
|
|
|
* @OVS_FLOW_ATTR_CLEAR: If present in a %OVS_FLOW_CMD_SET request, clears the
|
2011-01-28 14:00:51 -08:00
|
|
|
* last-used time, accumulated TCP flags, and statistics for this flow.
|
|
|
|
* Otherwise ignored in requests. Never present in notifications.
|
2011-01-26 15:42:00 -08:00
|
|
|
*
|
2011-08-18 10:35:40 -07:00
|
|
|
* These attributes follow the &struct ovs_header within the Generic Netlink
|
|
|
|
* payload for %OVS_FLOW_* commands.
|
2011-01-26 15:42:00 -08:00
|
|
|
*/
|
2011-08-18 10:35:40 -07:00
|
|
|
enum ovs_flow_attr {
|
|
|
|
OVS_FLOW_ATTR_UNSPEC,
|
|
|
|
OVS_FLOW_ATTR_KEY, /* Sequence of OVS_KEY_ATTR_* attributes. */
|
|
|
|
OVS_FLOW_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
|
|
|
|
OVS_FLOW_ATTR_STATS, /* struct ovs_flow_stats. */
|
|
|
|
OVS_FLOW_ATTR_TCP_FLAGS, /* 8-bit OR'd TCP flags. */
|
|
|
|
OVS_FLOW_ATTR_USED, /* u64 msecs last used in monotonic time. */
|
|
|
|
OVS_FLOW_ATTR_CLEAR, /* Flag to clear stats, tcp_flags, used. */
|
|
|
|
__OVS_FLOW_ATTR_MAX
|
2009-07-08 13:19:16 -07:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2011-09-28 10:43:07 -07:00
|
|
|
/**
|
2011-10-12 16:24:54 -07:00
|
|
|
* enum ovs_sample_attr - Attributes for %OVS_ACTION_ATTR_SAMPLE action.
|
2011-09-28 10:43:07 -07:00
|
|
|
* @OVS_SAMPLE_ATTR_PROBABILITY: 32-bit fraction of packets to sample with
|
|
|
|
* @OVS_ACTION_ATTR_SAMPLE. A value of 0 samples no packets, a value of
|
|
|
|
* %UINT32_MAX samples all packets and intermediate values sample intermediate
|
|
|
|
* fractions of packets.
|
|
|
|
* @OVS_SAMPLE_ATTR_ACTIONS: Set of actions to execute in sampling event.
|
|
|
|
* Actions are passed as nested attributes.
|
2011-10-12 16:24:54 -07:00
|
|
|
*
|
|
|
|
* Executes the specified actions with the given probability on a per-packet
|
|
|
|
* basis.
|
2011-09-28 10:43:07 -07:00
|
|
|
*/
|
|
|
|
enum ovs_sample_attr {
|
|
|
|
OVS_SAMPLE_ATTR_UNSPEC,
|
|
|
|
OVS_SAMPLE_ATTR_PROBABILITY, /* u32 number */
|
|
|
|
OVS_SAMPLE_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */
|
|
|
|
__OVS_SAMPLE_ATTR_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OVS_SAMPLE_ATTR_MAX (__OVS_SAMPLE_ATTR_MAX - 1)
|
|
|
|
|
2011-10-12 16:24:54 -07:00
|
|
|
/**
|
|
|
|
* enum ovs_userspace_attr - Attributes for %OVS_ACTION_ATTR_USERSPACE action.
|
|
|
|
* @OVS_USERSPACE_ATTR_PID: u32 Netlink PID to which the %OVS_PACKET_CMD_ACTION
|
|
|
|
* message should be sent. Required.
|
|
|
|
* @OVS_USERSPACE_ATTR_USERDATA: If present, its u64 argument is copied to the
|
|
|
|
* %OVS_PACKET_CMD_ACTION message as %OVS_PACKET_ATTR_USERDATA,
|
|
|
|
*/
|
|
|
|
enum ovs_userspace_attr {
|
|
|
|
OVS_USERSPACE_ATTR_UNSPEC,
|
|
|
|
OVS_USERSPACE_ATTR_PID, /* u32 Netlink PID to receive upcalls. */
|
|
|
|
OVS_USERSPACE_ATTR_USERDATA, /* u64 optional user-specified cookie. */
|
|
|
|
__OVS_USERSPACE_ATTR_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OVS_USERSPACE_ATTR_MAX (__OVS_USERSPACE_ATTR_MAX - 1)
|
|
|
|
|
2011-11-14 15:56:43 -08:00
|
|
|
/**
|
|
|
|
* struct ovs_action_push_vlan - %OVS_ACTION_ATTR_PUSH_VLAN action argument.
|
|
|
|
* @vlan_tpid: Tag protocol identifier (TPID) to push.
|
2011-11-14 17:19:41 -08:00
|
|
|
* @vlan_tci: Tag control identifier (TCI) to push. The CFI bit must be set
|
|
|
|
* (but it will not be set in the 802.1Q header that is pushed).
|
2011-11-14 15:56:43 -08:00
|
|
|
*
|
|
|
|
* The @vlan_tpid value is typically %ETH_P_8021Q. The only acceptable TPID
|
|
|
|
* values are those that the kernel module also parses as 802.1Q headers, to
|
|
|
|
* prevent %OVS_ACTION_ATTR_PUSH_VLAN followed by %OVS_ACTION_ATTR_POP_VLAN
|
|
|
|
* from having surprising results.
|
|
|
|
*/
|
|
|
|
struct ovs_action_push_vlan {
|
|
|
|
__be16 vlan_tpid; /* 802.1Q TPID. */
|
|
|
|
__be16 vlan_tci; /* 802.1Q TCI (VLAN ID and priority). */
|
|
|
|
};
|
|
|
|
|
2011-10-21 14:38:54 -07:00
|
|
|
/**
|
2011-10-25 14:03:35 -07:00
|
|
|
* enum ovs_action_attr - Action types.
|
2011-10-21 14:38:54 -07:00
|
|
|
*
|
2011-10-25 14:03:35 -07:00
|
|
|
* @OVS_ACTION_ATTR_OUTPUT: Output packet to port.
|
|
|
|
* @OVS_ACTION_ATTR_USERSPACE: Send packet to userspace according to nested
|
|
|
|
* %OVS_USERSPACE_ATTR_* attributes.
|
2011-11-14 15:56:43 -08:00
|
|
|
* @OVS_ACTION_ATTR_SET: Replaces the contents of an existing header. The
|
|
|
|
* single nested %OVS_KEY_ATTR_* attribute specifies a header to modify and its
|
|
|
|
* value.
|
|
|
|
* @OVS_ACTION_ATTR_PUSH_VLAN: Push a new outermost 802.1Q header onto the
|
|
|
|
* packet.
|
|
|
|
* @OVS_ACTION_ATTR_POP_VLAN: Pop the outermost 802.1Q header off the packet.
|
2011-10-25 14:03:35 -07:00
|
|
|
* @OVS_ACTION_ATTR_SAMPLE: Probabilitically executes actions, as specified in
|
|
|
|
* the nested %OVS_SAMPLE_ATTR_* attributes.
|
2011-10-21 14:38:54 -07:00
|
|
|
*
|
2011-11-14 15:56:43 -08:00
|
|
|
* Only a single header can be set with a single %OVS_ACTION_ATTR_SET. Not all
|
|
|
|
* fields within a header are modifiable, e.g. the IPv4 protocol and fragment
|
|
|
|
* type may not be changed.
|
2011-10-21 14:38:54 -07:00
|
|
|
*/
|
|
|
|
|
2011-10-05 09:59:51 -07:00
|
|
|
enum ovs_action_attr {
|
2011-08-18 10:35:40 -07:00
|
|
|
OVS_ACTION_ATTR_UNSPEC,
|
2011-10-25 14:03:35 -07:00
|
|
|
OVS_ACTION_ATTR_OUTPUT, /* u32 port number. */
|
2011-10-12 16:24:54 -07:00
|
|
|
OVS_ACTION_ATTR_USERSPACE, /* Nested OVS_USERSPACE_ATTR_*. */
|
2011-10-25 14:03:35 -07:00
|
|
|
OVS_ACTION_ATTR_SET, /* One nested OVS_KEY_ATTR_*. */
|
2011-11-14 15:56:43 -08:00
|
|
|
OVS_ACTION_ATTR_PUSH_VLAN, /* struct ovs_action_push_vlan. */
|
|
|
|
OVS_ACTION_ATTR_POP_VLAN, /* No argument. */
|
2011-10-12 16:24:54 -07:00
|
|
|
OVS_ACTION_ATTR_SAMPLE, /* Nested OVS_SAMPLE_ATTR_*. */
|
2011-08-18 10:35:40 -07:00
|
|
|
__OVS_ACTION_ATTR_MAX
|
2009-07-08 13:19:16 -07:00
|
|
|
};
|
|
|
|
|
2011-08-18 10:35:40 -07:00
|
|
|
#define OVS_ACTION_ATTR_MAX (__OVS_ACTION_ATTR_MAX - 1)
|
2009-07-08 13:19:16 -07:00
|
|
|
|
2011-10-05 10:50:58 -07:00
|
|
|
#endif /* _LINUX_OPENVSWITCH_H */
|