X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fopenvswitch%2Fdatapath-protocol.h;h=25f8e132410517d456228ac2705573a27bd4e30e;hb=51d4d59822785c1044cd96e6c73427347e0154c2;hp=25499aa1be90e2ebbd1b112cbe925253d6b599ad;hpb=36956a7d33c9ee204fcb184484a5aaacbd9ecef8;p=sliver-openvswitch.git diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h index 25499aa1b..25f8e1324 100644 --- a/include/openvswitch/datapath-protocol.h +++ b/include/openvswitch/datapath-protocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010 Nicira Networks. + * Copyright (c) 2009, 2010, 2011 Nicira Networks. * * 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 @@ -85,7 +85,7 @@ #define ODP_VPORT_ATTACH _IOR('O', 7, struct odp_port) #define ODP_VPORT_DETACH _IOR('O', 8, int) #define ODP_VPORT_QUERY _IOWR('O', 9, struct odp_port) -#define ODP_VPORT_LIST _IOWR('O', 10, struct odp_portvec) +#define ODP_VPORT_DUMP _IOWR('O', 10, struct odp_vport_dump) #define ODP_FLOW_GET _IOWR('O', 13, struct odp_flowvec) #define ODP_FLOW_PUT _IOWR('O', 14, struct odp_flow) @@ -141,47 +141,39 @@ struct odp_stats { #define ODPL_SFLOW (1 << _ODPL_SFLOW_NR) #define ODPL_ALL (ODPL_MISS | ODPL_ACTION | ODPL_SFLOW) -/** - * struct odp_msg - format of messages read from datapath fd. - * @length: Total length of message, including this header. - * @type: One of the %_ODPL_* constants. - * @port: Port that received the packet embedded in this message. - * @arg: Argument value whose meaning depends on @type. - * - * For @type == %_ODPL_MISS_NR, the header is followed by packet data. The - * @arg member is the ID (in network byte order) of the tunnel that - * encapsulated this packet. It is 0 if the packet was not received on a tunnel. - * - * For @type == %_ODPL_ACTION_NR, the header is followed by packet data. The - * @arg member is copied from the %ODPAT_CONTROLLER action that caused the - * &struct odp_msg to be composed. - * - * For @type == %_ODPL_SFLOW_NR, the header is followed by &struct - * odp_sflow_sample_header, then by a series of Netlink attributes (whose - * length is specified in &struct odp_sflow_sample_header), then by packet - * data. - */ -struct odp_msg { - uint32_t length; - uint16_t type; - uint16_t port; - __aligned_u64 arg; +enum odp_packet_type { + ODP_PACKET_ATTR_UNSPEC, + ODP_PACKET_ATTR_TYPE, /* 32-bit enum, one of _ODP_*_NR. */ + ODP_PACKET_ATTR_PACKET, /* Packet data. */ + ODP_PACKET_ATTR_KEY, /* Nested ODP_KEY_ATTR_* attributes. */ + ODP_PACKET_ATTR_USERDATA, /* 64-bit data from ODPAT_CONTROLLER. */ + ODP_PACKET_ATTR_SAMPLE_POOL, /* # sampling candidate packets so far. */ + ODP_PACKET_ATTR_ACTIONS, /* Nested ODPAT_* attributes. */ + __ODP_PACKET_ATTR_MAX }; +#define ODP_PACKET_ATTR_MAX (__ODP_PACKET_ATTR_MAX - 1) + /** - * struct odp_sflow_sample_header - header added to sFlow sampled packet. - * @sample_pool: Number of packets that were candidates for sFlow sampling, - * regardless of whether they were actually chosen and sent down to userspace. - * @actions_len: Number of bytes of actions immediately following this header. + * struct odp_packet - header for packets passed up between kernel and + * userspace. + * @dp_idx: Number of datapath to which the packet belongs. + * @len: Length of complete message, including this header. + * + * The header is followed by a sequence of Netlink attributes. The + * %ODP_PACKET_ATTR_TYPE, %ODP_PACKET_ATTR_PACKET, and %ODP_PACKET_ATTR_KEY + * attributes are always present. When @type == %_ODPL_ACTION_NR, the + * %ODP_PACKET_ATTR_USERDATA attribute is included if it would be nonzero. + * When @type == %_ODPL_SFLOW_NR, the %ODP_PACKET_ATTR_SAMPLE_POOL and + * %ODP_PACKET_ATTR_ACTIONS attributes are included. * - * This header follows &struct odp_msg when that structure's @type is - * %_ODPL_SFLOW_NR, and it is itself followed by a series of Netlink attributes - * (the number of bytes of which is specified in @actions_len) and then by - * packet data. + * For @type of %_ODPL_ACTION_NR, %ODP_PACKET_ATTR_PACKET reflects changes made + * by actions preceding %ODPAT_CONTROLLER, but %ODP_PACKET_ATTR_KEY is the flow + * key extracted from the packet as originally received. */ -struct odp_sflow_sample_header { - uint32_t sample_pool; - uint32_t actions_len; +struct odp_packet { + uint32_t dp_idx; + uint32_t len; }; #define VPORT_TYPE_SIZE 16 @@ -190,14 +182,24 @@ struct odp_port { char devname[16]; /* IFNAMSIZ */ char type[VPORT_TYPE_SIZE]; uint16_t port; - uint16_t reserved1; + uint16_t dp_idx; uint32_t reserved2; __aligned_u64 config[VPORT_CONFIG_SIZE / 8]; /* type-specific */ }; -struct odp_portvec { - struct odp_port *ports; - uint32_t n_ports; +/** + * struct odp_vport_dump - ODP_VPORT_DUMP argument. + * @port: Points to port structure to fill in. + * @port_no: Minimum port number of interest. + * + * Used to iterate through vports one at a time. The kernel fills in @port + * with the information for the configured port with the smallest port number + * greater than or equal to @port_no. If there is no such port, it sets + * @port->devname to the empty string. + */ +struct odp_vport_dump { + struct odp_port *port; + uint32_t port_no; }; struct odp_flow_stats {