X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fopenvswitch%2Fdatapath-protocol.h;h=3db960a9cb909bda0d5f8ea8ff4a9e1f37fd6988;hb=299915eadc559f12d145945436289931a74621b8;hp=97a7c04df766992420cc8af90cc9f7e2e94c2846;hpb=ff8d7a5e81625bbb13d33ca73888fc848b02db83;p=openvswitch diff --git a/include/openvswitch/datapath-protocol.h b/include/openvswitch/datapath-protocol.h index 97a7c04d..3db960a9 100644 --- a/include/openvswitch/datapath-protocol.h +++ b/include/openvswitch/datapath-protocol.h @@ -51,7 +51,6 @@ #include #endif -#include #include /* datapaths. */ @@ -86,19 +85,15 @@ struct ovs_header { * the &struct ovs_header. Always present in notifications. Required in * %OVS_DP_NEW requests. May be used as an alternative to specifying * dp_ifindex in other requests (with a dp_ifindex of 0). + * @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. * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the * datapath. Always present in notifications. * @OVS_DP_ATTR_IPV4_FRAGS: One of %OVS_DP_FRAG_*. Always present in * notifications. May be included in %OVS_DP_NEW or %OVS_DP_SET requests to * change the fragment handling policy. - * @OVS_DP_ATTR_SAMPLING: 32-bit fraction of packets to sample with - * @OVS_PACKET_CMD_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_DP_ATTR_MCGROUPS: Nested attributes with multicast groups. Each nested - * attribute has a %OVS_PACKET_CMD_* type with a 32-bit value giving the - * Generic Netlink multicast group number used for sending this datapath's - * messages with that command type up to userspace. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_DP_* commands. @@ -106,10 +101,9 @@ struct ovs_header { enum ovs_datapath_attr { OVS_DP_ATTR_UNSPEC, OVS_DP_ATTR_NAME, /* name of dp_ifindex netdev */ + OVS_DP_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ OVS_DP_ATTR_STATS, /* struct ovs_dp_stats */ OVS_DP_ATTR_IPV4_FRAGS, /* 32-bit enum ovs_frag_handling */ - OVS_DP_ATTR_SAMPLING, /* 32-bit fraction of packets to sample. */ - OVS_DP_ATTR_MCGROUPS, /* Nested attributes with multicast groups. */ __OVS_DP_ATTR_MAX }; @@ -136,6 +130,17 @@ struct ovs_dp_stats { uint64_t n_flows; /* Number of flows present */ }; +struct ovs_vport_stats { + uint64_t rx_packets; /* total packets received */ + uint64_t tx_packets; /* total packets transmitted */ + uint64_t rx_bytes; /* total bytes received */ + uint64_t tx_bytes; /* total bytes transmitted */ + uint64_t rx_errors; /* bad packets received */ + uint64_t tx_errors; /* packet transmit problems */ + uint64_t rx_dropped; /* no space in linux buffers */ + uint64_t tx_dropped; /* no space available in linux */ +}; + /* Logical ports. */ #define OVSP_LOCAL ((uint16_t)0) @@ -147,7 +152,6 @@ enum ovs_packet_cmd { /* Kernel-to-user notifications. */ OVS_PACKET_CMD_MISS, /* Flow table miss. */ OVS_PACKET_CMD_ACTION, /* OVS_ACTION_ATTR_USERSPACE action. */ - OVS_PACKET_CMD_SAMPLE, /* Sampled packet. */ /* User commands. */ OVS_PACKET_CMD_EXECUTE /* Apply actions to a packet. */ @@ -164,14 +168,15 @@ enum ovs_packet_cmd { * extracted from the packet as nested %OVS_KEY_ATTR_* attributes. This allows * userspace to adapt its flow setup strategy by comparing its notion of the * flow key against the kernel's. + * @OVS_PACKET_ATTR_ACTIONS: Contains actions for the packet. Used + * for %OVS_PACKET_CMD_EXECUTE. It has nested %OVS_ACTION_ATTR_* attributes. + * @OVS_PACKET_ATTR_UPCALL_PID: Optionally present for OVS_PACKET_CMD_EXECUTE. + * The Netlink socket in userspace that OVS_PACKET_CMD_USERSPACE and + * OVS_PACKET_CMD_SAMPLE upcalls will be directed to for actions triggered by + * this packet. A value of zero indicates that upcalls should not be sent. * @OVS_PACKET_ATTR_USERDATA: Present for an %OVS_PACKET_CMD_ACTION * notification if the %OVS_ACTION_ATTR_USERSPACE, action's argument was * nonzero. - * @OVS_PACKET_ATTR_SAMPLE_POOL: Present for %OVS_PACKET_CMD_SAMPLE. Contains - * the number of packets processed so far that were candidates for sampling. - * @OVS_PACKET_ATTR_ACTIONS: Present for %OVS_PACKET_CMD_SAMPLE. Contains a - * copy of the actions applied to the packet, as nested %OVS_ACTION_ATTR_* - * attributes. * * These attributes follow the &struct ovs_header within the Generic Netlink * payload for %OVS_PACKET_* commands. @@ -180,9 +185,9 @@ enum ovs_packet_attr { OVS_PACKET_ATTR_UNSPEC, OVS_PACKET_ATTR_PACKET, /* Packet data. */ OVS_PACKET_ATTR_KEY, /* Nested OVS_KEY_ATTR_* attributes. */ - OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */ - OVS_PACKET_ATTR_SAMPLE_POOL, /* # sampling candidate packets so far. */ OVS_PACKET_ATTR_ACTIONS, /* Nested OVS_ACTION_ATTR_* attributes. */ + OVS_PACKET_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls. */ + OVS_PACKET_ATTR_USERDATA, /* u64 OVS_ACTION_ATTR_USERSPACE arg. */ __OVS_PACKET_ATTR_MAX }; @@ -219,11 +224,12 @@ enum ovs_vport_cmd { * @OVS_VPORT_ATTR_NAME: Name of vport. For a vport based on a network device * this is the name of the network device. Maximum length %IFNAMSIZ-1 bytes * plus a null terminator. - * @OVS_VPORT_ATTR_STATS: A &struct rtnl_link_stats64 giving statistics for + * @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. + * @OVS_VPORT_ATTR_STATS: A &struct ovs_vport_stats giving statistics for * packets sent or received through the vport. * @OVS_VPORT_ATTR_ADDRESS: A 6-byte Ethernet address for the vport. - * @OVS_VPORT_ATTR_MTU: MTU for the vport. Omitted if the vport does not have - * an MTU as, e.g., some tunnels do not. * @OVS_VPORT_ATTR_IFINDEX: ifindex of the underlying network device, if any. * * These attributes follow the &struct ovs_header within the Generic Netlink @@ -237,8 +243,8 @@ enum ovs_vport_cmd { * %OVS_VPORT_ATTR_NAME attributes are required. %OVS_VPORT_ATTR_PORT_NO is * optional; if not specified a free port number is automatically selected. * Whether %OVS_VPORT_ATTR_OPTIONS is required or optional depends on the type - * of vport. %OVS_VPORT_ATTR_STATS, %OVS_VPORT_ATTR_ADDRESS, and - * %OVS_VPORT_ATTR_MTU are optional, and other attributes are ignored. + * of vport. %OVS_VPORT_ATTR_STATS and %OVS_VPORT_ATTR_ADDRESS are optional, + * and other attributes are ignored. * * For other requests, if %OVS_VPORT_ATTR_NAME is specified then it is used to * look up the vport to operate on; otherwise dp_idx from the &struct @@ -249,9 +255,9 @@ enum ovs_vport_attr { OVS_VPORT_ATTR_PORT_NO, /* port number within datapath */ OVS_VPORT_ATTR_TYPE, /* 32-bit OVS_VPORT_TYPE_* constant. */ OVS_VPORT_ATTR_NAME, /* string name, up to IFNAMSIZ bytes long */ - OVS_VPORT_ATTR_STATS, /* struct rtnl_link_stats64 */ + OVS_VPORT_ATTR_UPCALL_PID, /* Netlink PID to receive upcalls */ + OVS_VPORT_ATTR_STATS, /* struct ovs_vport_stats */ OVS_VPORT_ATTR_ADDRESS, /* hardware address */ - OVS_VPORT_ATTR_MTU, /* 32-bit maximum transmission unit */ OVS_VPORT_ATTR_OPTIONS, /* nested attributes, varies by vport type */ OVS_VPORT_ATTR_IFINDEX, /* 32-bit ifindex of backing netdev */ __OVS_VPORT_ATTR_MAX @@ -372,6 +378,10 @@ struct ovs_key_nd { * @OVS_FLOW_ATTR_ACTIONS: Nested %OVS_ACTION_ATTR_* attributes specifying * the actions to take for packets that match the key. Always present in * notifications. Required for %OVS_FLOW_CMD_NEW requests, optional + * @OVS_FLOW_ATTR_UPCALL_PID: The Netlink socket in userspace that + * OVS_PACKET_CMD_USERSPACE and OVS_PACKET_CMD_SAMPLE upcalls will be + * directed to for packets received on this port. A value of zero indicates + * that upcalls should not be sent. * on %OVS_FLOW_CMD_SET request to change the existing actions, ignored for * other requests. * @OVS_FLOW_ATTR_STATS: &struct ovs_flow_stats giving statistics for this @@ -395,6 +405,7 @@ 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_UPCALL_PID, /* Netlink PID to receive upcalls. */ 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. */ @@ -404,13 +415,31 @@ enum ovs_flow_attr { #define OVS_FLOW_ATTR_MAX (__OVS_FLOW_ATTR_MAX - 1) +/** + * enum ovs_sample_attr - Attributes for OVS_ACTION_ATTR_SAMPLE + * @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. + */ +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) + /* Action types. */ enum ovs_action_type { OVS_ACTION_ATTR_UNSPEC, OVS_ACTION_ATTR_OUTPUT, /* Output to switch port. */ OVS_ACTION_ATTR_USERSPACE, /* Send copy to userspace. */ - OVS_ACTION_ATTR_SET_DL_TCI, /* Set the 802.1q TCI value. */ - OVS_ACTION_ATTR_STRIP_VLAN, /* Strip the 802.1q header. */ + OVS_ACTION_ATTR_PUSH_VLAN, /* Set the 802.1q TCI value. */ + OVS_ACTION_ATTR_POP_VLAN, /* Strip the 802.1q header. */ OVS_ACTION_ATTR_SET_DL_SRC, /* Ethernet source address. */ OVS_ACTION_ATTR_SET_DL_DST, /* Ethernet destination address. */ OVS_ACTION_ATTR_SET_NW_SRC, /* IPv4 source address. */ @@ -421,6 +450,8 @@ enum ovs_action_type { OVS_ACTION_ATTR_SET_TUNNEL, /* Set the encapsulating tunnel ID. */ OVS_ACTION_ATTR_SET_PRIORITY, /* Set skb->priority. */ OVS_ACTION_ATTR_POP_PRIORITY, /* Restore original skb->priority. */ + OVS_ACTION_ATTR_SAMPLE, /* Execute list of actions at given + probability. */ __OVS_ACTION_ATTR_MAX };