*
* ofproto-dpif provides an ofproto implementation for those platforms which
* implement the netdev and dpif interface defined in netdev.h and dpif.h. The
- * most important of which is the Linux Kernel Module (dpif-linux), but
+ * most important of which is the Linux Kernel Module (dpif-netlink), but
* alternatives are supported such as a userspace only implementation
* (dpif-netdev), and a dummy implementation used for unit testing.
*
#include "fail-open.h"
#include "hmapx.h"
#include "odp-util.h"
-#include "openvswitch/ofp-util.h"
+#include "id-pool.h"
#include "ovs-thread.h"
#include "ofproto-provider.h"
#include "util.h"
-#include "ovs-thread.h"
struct dpif_flow_stats;
struct ofproto_async_msg;
struct ofproto_dpif;
+struct uuid;
struct xlate_cache;
+struct xlate_ctx;
/* Number of implemented OpenFlow tables. */
enum { N_TABLES = 255 };
* - Do include packets and bytes from datapath flows which have not
* recently been processed by a revalidator. */
struct ovs_mutex stats_mutex;
- struct dpif_flow_stats stats OVS_GUARDED;
+ struct dpif_flow_detailed_stats stats OVS_GUARDED;
/* In non-NULL, will point to a new rule (for which a reference is held) to
* which all the stats updates should be forwarded. This exists only
struct xlate_cache *);
void rule_dpif_credit_stats(struct rule_dpif *,
- const struct dpif_flow_stats *);
+ const struct dpif_flow_stats *, bool);
void rule_set_recirc_id(struct rule *, uint32_t id);
\f
/* Groups. */
+enum group_selection_method {
+ SEL_METHOD_DEFAULT,
+ SEL_METHOD_DP_HASH,
+ SEL_METHOD_HASH,
+};
+
struct group_dpif {
struct ofgroup up;
struct ovs_mutex stats_mutex;
uint64_t packet_count OVS_GUARDED; /* Number of packets received. */
uint64_t byte_count OVS_GUARDED; /* Number of bytes received. */
+
+ enum group_selection_method selection_method;
+ enum ovs_hash_alg hash_alg; /* dp_hash algorithm to be applied. */
+ uint32_t hash_basis; /* Basis for dp_hash. */
+ uint32_t hash_mask; /* Used to mask dp_hash (2^N - 1).*/
+ struct ofputil_bucket **hash_map; /* Map hash values to buckets. */
};
void group_dpif_credit_stats(struct group_dpif *,
struct group_dpif *group_dpif_lookup(struct ofproto_dpif *,
uint32_t group_id, ovs_version_t version,
bool take_ref);
+
\f
/* Backers.
*
* ofproto-dpif) resides. A backer can host several bridges, but a bridge is
* backed by only a single dpif. */
-/* Stores the various features which the corresponding backer supports. */
-struct dpif_backer_support {
- /* True if the datapath supports variable-length
- * OVS_USERSPACE_ATTR_USERDATA in OVS_ACTION_ATTR_USERSPACE actions.
- * False if the datapath supports only 8-byte (or shorter) userdata. */
- bool variable_length_userdata;
-
- /* True if the datapath supports masked data in OVS_ACTION_ATTR_SET
- * actions. */
- bool masked_set_action;
- /* True if the datapath supports tnl_push and pop actions. */
- bool tnl_push_pop;
+/* DPIF_SUPPORT_FIELD(TYPE, FIELD_NAME, FIELD_DESCRIPTION)
+ *
+ * Each 'DPIF_SUPPORT_FIELD' defines a member in 'struct dpif_backer_support'
+ * and represents support for a datapath action.
+ * They are defined as macros to keep 'dpif_show_support()' in sync
+ * as new fields are added. */
+#define DPIF_SUPPORT_FIELDS \
+ /* True if the datapath supports masked data in OVS_ACTION_ATTR_SET \
+ * actions. */ \
+ DPIF_SUPPORT_FIELD(bool, masked_set_action, "Masked set action") \
+ \
+ /* True if the datapath supports tnl_push and pop actions. */ \
+ DPIF_SUPPORT_FIELD(bool, tnl_push_pop, "Tunnel push pop") \
+ \
+ /* True if the datapath supports OVS_FLOW_ATTR_UFID. */ \
+ DPIF_SUPPORT_FIELD(bool, ufid, "Ufid") \
+ \
+ /* True if the datapath supports OVS_ACTION_ATTR_TRUNC action. */ \
+ DPIF_SUPPORT_FIELD(bool, trunc, "Truncate action") \
+ \
+ /* True if the datapath supports OVS_ACTION_ATTR_CLONE action. */ \
+ DPIF_SUPPORT_FIELD(bool, clone, "Clone action") \
+ \
+ /* Maximum level of nesting allowed by OVS_ACTION_ATTR_SAMPLE action. */\
+ DPIF_SUPPORT_FIELD(size_t, sample_nesting, "Sample nesting") \
+ \
+ /* OVS_CT_ATTR_EVENTMASK supported by OVS_ACTION_ATTR_CT action. */ \
+ DPIF_SUPPORT_FIELD(bool, ct_eventmask, "Conntrack eventmask") \
+ \
+ /* True if the datapath supports OVS_ACTION_ATTR_CT_CLEAR action. */ \
+ DPIF_SUPPORT_FIELD(bool, ct_clear, "Conntrack clear") \
+ \
+ /* Highest supported dp_hash algorithm. */ \
+ DPIF_SUPPORT_FIELD(size_t, max_hash_alg, "Max dp_hash algorithm") \
+ \
+ /* True if the datapath supports OVS_ACTION_ATTR_CHECK_PKT_LEN. */ \
+ DPIF_SUPPORT_FIELD(bool, check_pkt_len, "Check pkt length action") \
+ \
+ /* True if the datapath supports OVS_CT_ATTR_TIMEOUT in \
+ * OVS_ACTION_ATTR_CT action. */ \
+ DPIF_SUPPORT_FIELD(bool, ct_timeout, "Conntrack timeout policy") \
+ \
+ /* True if the datapath supports explicit drop action. */ \
+ DPIF_SUPPORT_FIELD(bool, explicit_drop_action, "Explicit Drop action") \
+ \
+ /* True if the datapath supports balance_tcp optimization */ \
+ DPIF_SUPPORT_FIELD(bool, lb_output_action, "Optimized Balance TCP mode")
- /* True if the datapath supports OVS_FLOW_ATTR_UFID. */
- bool ufid;
- /* True if the datapath supports OVS_ACTION_ATTR_TRUNC action. */
- bool trunc;
+/* Stores the various features which the corresponding backer supports. */
+struct dpif_backer_support {
+#define DPIF_SUPPORT_FIELD(TYPE, NAME, TITLE) TYPE NAME;
+ DPIF_SUPPORT_FIELDS
+#undef DPIF_SUPPORT_FIELD
/* Each member represents support for related OVS_KEY_ATTR_* fields. */
struct odp_support odp;
-
- /* True if the datapath supports OVS_ACTION_ATTR_CLONE action. */
- bool clone;
};
/* Reasons that we might need to revalidate every datapath flow, and
bool recv_set_enable; /* Enables or disables receiving packets. */
+ /* Meter. */
+ struct id_pool *meter_ids; /* Datapath meter allocation. */
+
+ /* Connection tracking. */
+ struct id_pool *tp_ids; /* Datapath timeout policy id
+ * allocation. */
+ struct cmap ct_zones; /* "struct ct_zone"s indexed by zone
+ * id. */
+ struct hmap ct_tps; /* "struct ct_timeout_policy"s indexed
+ * by timeout policy (struct simap). */
+ struct ovs_list ct_tp_kill_list; /* A list of timeout policy to be
+ * deleted. */
+
/* Version string of the datapath stored in OVSDB. */
char *dp_version_string;
/* Datapath feature support. */
- struct dpif_backer_support support;
+ struct dpif_backer_support bt_support; /* Boot time support. Set once
+ when vswitch starts up, then
+ it is read only through out
+ the life time of vswitchd. */
+ struct dpif_backer_support rt_support; /* Runtime support. Can be
+ set to a lower level in
+ feature than 'bt_support'. */
+
struct atomic_count tnl_count;
};
/* A bridge based on a "dpif" datapath. */
struct ofproto_dpif {
- struct hmap_node all_ofproto_dpifs_node; /* In 'all_ofproto_dpifs'. */
+ /* In 'all_ofproto_dpifs_by_name'. */
+ struct hmap_node all_ofproto_dpifs_by_name_node;
+
+ /* In 'all_ofproto_dpifs_by_uuid'. */
+ struct hmap_node all_ofproto_dpifs_by_uuid_node;
+
struct ofproto up;
struct dpif_backer *backer;
struct guarded_list ams; /* Contains "struct ofproto_async_msgs"s. */
struct seq *ams_seq; /* For notifying 'ams' reception. */
uint64_t ams_seqno;
-};
-/* All existing ofproto_dpif instances, indexed by ->up.name. */
-extern struct hmap all_ofproto_dpifs;
+ bool is_controller_connected; /* True if any controller admitted this
+ * switch connection. */
+};
-struct ofproto_dpif *ofproto_dpif_lookup(const char *name);
+struct ofproto_dpif *ofproto_dpif_lookup_by_name(const char *name);
+struct ofproto_dpif *ofproto_dpif_lookup_by_uuid(const struct uuid *uuid);
ovs_version_t ofproto_dpif_get_tables_version(struct ofproto_dpif *);
ofp_port_t);
int ofproto_dpif_add_internal_flow(struct ofproto_dpif *,
- const struct match *, int priority,
+ struct match *, int priority,
uint16_t idle_timeout,
const struct ofpbuf *ofpacts,
struct rule **rulep);
int ofproto_dpif_delete_internal_flow(struct ofproto_dpif *, struct match *,
int priority);
+int ofproto_dpif_add_lb_output_buckets(struct ofproto_dpif *, uint32_t bond_id,
+ const ofp_port_t *member_map);
+int ofproto_dpif_delete_lb_output_buckets(struct ofproto_dpif *,
+ uint32_t bond_id);
+bool ovs_lb_output_action_supported(struct ofproto_dpif *);
bool ovs_native_tunneling_is_on(struct ofproto_dpif *);
+bool ofproto_dpif_ct_zone_timeout_policy_get_name(
+ const struct dpif_backer *backer, uint16_t zone, uint16_t dl_type,
+ uint8_t nw_proto, char **tp_name, bool *unwildcard);
+
+bool ovs_explicit_drop_action_supported(struct ofproto_dpif *);
+
#endif /* ofproto-dpif.h */