X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=include%2Fopenvswitch%2Fdatapath-protocol.h;h=2ae0c828671aeb04544f8a2e0676763334d53451;hb=72b0630028e94a24d92a7c14cd7bce96a252a3f5;hp=537dd59552f3c58ea44045e92a3959fc75c5f378;hpb=064af42167bf4fc9aaea2702d80ce08074b889c0;p=openvswitch diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h index 537dd595..2ae0c828 100644 --- a/include/openvswitch/datapath-protocol.h +++ b/include/openvswitch/datapath-protocol.h @@ -1,20 +1,43 @@ /* * Copyright (c) 2009 Nicira Networks. * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. + * 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. * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * ---------------------------------------------------------------------- + * 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. + * ---------------------------------------------------------------------- + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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. + * + * 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. + * ---------------------------------------------------------------------- */ -/* Protocol between secchan and datapath. */ +/* Protocol between userspace and kernel datapath. */ #ifndef OPENVSWITCH_DATAPATH_PROTOCOL_H #define OPENVSWITCH_DATAPATH_PROTOCOL_H 1 @@ -47,14 +70,15 @@ #define ODP_PORT_GROUP_GET _IOWR('O', 12, struct odp_port_group) #define ODP_FLOW_GET _IOWR('O', 13, struct odp_flow) -#define ODP_FLOW_GET_MULTIPLE _IOWR('O', 14, struct odp_flowvec) +#define ODP_FLOW_PUT _IOWR('O', 14, struct odp_flow) #define ODP_FLOW_LIST _IOWR('O', 15, struct odp_flowvec) - #define ODP_FLOW_FLUSH _IO('O', 16) -#define ODP_FLOW_PUT _IOWR('O', 17, struct odp_flow) -#define ODP_FLOW_DEL _IOWR('O', 18, struct odp_flow) +#define ODP_FLOW_DEL _IOWR('O', 17, struct odp_flow) + +#define ODP_EXECUTE _IOR('O', 18, struct odp_execute) -#define ODP_EXECUTE _IOR('O', 19, struct odp_execute) +#define ODP_SET_SFLOW_PROBABILITY _IOR('O', 20, int) +#define ODP_GET_SFLOW_PROBABILITY _IOW('O', 21, int) struct odp_stats { /* Flows. */ @@ -77,6 +101,7 @@ struct odp_stats { /* Queues. */ __u16 max_miss_queue; /* Max length of ODPL_MISS queue. */ __u16 max_action_queue; /* Max length of ODPL_ACTION queue. */ + __u16 max_sflow_queue; /* Max length of ODPL_SFLOW queue. */ }; /* Logical ports. */ @@ -88,7 +113,9 @@ struct odp_stats { #define ODPL_MISS (1 << _ODPL_MISS_NR) #define _ODPL_ACTION_NR 1 /* Packet output to ODPP_CONTROLLER. */ #define ODPL_ACTION (1 << _ODPL_ACTION_NR) -#define ODPL_ALL (ODPL_MISS | ODPL_ACTION) +#define _ODPL_SFLOW_NR 2 /* sFlow samples. */ +#define ODPL_SFLOW (1 << _ODPL_SFLOW_NR) +#define ODPL_ALL (ODPL_MISS | ODPL_ACTION | ODPL_SFLOW) /* Format of messages read from datapath fd. */ struct odp_msg { @@ -97,7 +124,23 @@ struct odp_msg { __u16 port; /* Port on which frame was received. */ __u16 reserved; __u32 arg; /* Argument value specified in action. */ - /* Followed by packet data. */ + + /* + * Followed by: + * + * ODPL_MISS, ODPL_ACTION: packet data. + * + * ODPL_SFLOW: "struct odp_sflow_sample_header", followed by + * an array of "union odp_action"s, followed by packet data. + */ +}; + +/* Header added to sFlow sampled packet. */ +struct odp_sflow_sample_header { + __u64 sample_pool; /* Number of potentially sampled packets. */ + __u32 n_actions; /* Number of following "union odp_action"s. */ + __u32 reserved; /* Pad up to 64-bit boundary. */ + /* Followed by n_action "union odp_action"s. */ }; #define ODP_PORT_INTERNAL (1 << 0) /* This port is simulated. */ @@ -126,28 +169,33 @@ struct odp_flow_stats { __u32 used_nsec; __u8 tcp_flags; __u8 ip_tos; - __u16 reserved; + __u16 error; /* Used by ODP_FLOW_GET. */ }; struct odp_flow_key { - __be32 nw_src; /* IP source address. */ - __be32 nw_dst; /* IP destination address. */ - __u16 in_port; /* Input switch port. */ - __be16 dl_vlan; /* Input VLAN. */ - __be16 dl_type; /* Ethernet frame type. */ - __be16 tp_src; /* TCP/UDP source port. */ - __be16 tp_dst; /* TCP/UDP destination port. */ - __u8 dl_src[ETH_ALEN]; /* Ethernet source address. */ - __u8 dl_dst[ETH_ALEN]; /* Ethernet destination address. */ - __u8 nw_proto; /* IP protocol. */ - __u8 reserved; /* Pad to 64 bits. */ + __be32 nw_src; /* IP source address. */ + __be32 nw_dst; /* IP destination address. */ + __u16 in_port; /* Input switch port. */ + __be16 dl_vlan; /* Input VLAN. */ + __be16 dl_type; /* Ethernet frame type. */ + __be16 tp_src; /* TCP/UDP source port. */ + __be16 tp_dst; /* TCP/UDP destination port. */ + __u8 dl_src[ETH_ALEN]; /* Ethernet source address. */ + __u8 dl_dst[ETH_ALEN]; /* Ethernet destination address. */ + __u8 nw_proto; /* IP protocol or lower 8 bits of + ARP opcode. */ + __u8 reserved; /* Pad to 64 bits. */ }; +/* Flags for ODP_FLOW. */ +#define ODPFF_ZERO_TCP_FLAGS (1 << 0) /* Zero the TCP flags. */ + struct odp_flow { struct odp_flow_stats stats; struct odp_flow_key key; union odp_action *actions; __u32 n_actions; + __u32 flags; }; /* Flags for ODP_FLOW_PUT. */