bfd/cfm: Check status change before update status to database.
[sliver-openvswitch.git] / ofproto / ofproto.h
index 1bde385..9ba6354 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,7 +23,9 @@
 #include <stddef.h>
 #include <stdint.h>
 #include "cfm.h"
+#include "classifier.h"
 #include "flow.h"
+#include "meta-flow.h"
 #include "netflow.h"
 #include "sset.h"
 #include "stp.h"
@@ -36,12 +38,12 @@ struct bfd_cfg;
 struct cfm_settings;
 struct cls_rule;
 struct netdev;
-struct ofproto;
+struct netdev_stats;
 struct ofport;
+struct ofproto;
 struct shash;
 struct simap;
 struct smap;
-struct netdev_stats;
 
 struct ofproto_controller_info {
     bool is_connected;
@@ -53,13 +55,6 @@ struct ofproto_controller_info {
     } pairs;
 };
 
-struct ofexpired {
-    struct flow flow;
-    uint64_t packet_count;      /* Packets from subrules. */
-    uint64_t byte_count;        /* Bytes from subrules. */
-    long long int used;         /* Last-used time (0 if never used). */
-};
-
 struct ofproto_sflow_options {
     struct sset targets;
     uint32_t sampling_rate;
@@ -70,17 +65,20 @@ struct ofproto_sflow_options {
     char *control_ip;
 };
 
-
 struct ofproto_ipfix_bridge_exporter_options {
     struct sset targets;
     uint32_t sampling_rate;
     uint32_t obs_domain_id;  /* Bridge-wide Observation Domain ID. */
     uint32_t obs_point_id;  /* Bridge-wide Observation Point ID. */
+    uint32_t cache_active_timeout;
+    uint32_t cache_max_flows;
 };
 
 struct ofproto_ipfix_flow_exporter_options {
     uint32_t collector_set_id;
     struct sset targets;
+    uint32_t cache_active_timeout;
+    uint32_t cache_max_flows;
 };
 
 struct ofproto_stp_settings {
@@ -111,6 +109,10 @@ struct ofproto_port_stp_status {
     enum stp_state state;
     unsigned int sec_in_state;
     enum stp_role role;
+};
+
+struct ofproto_port_stp_stats {
+    bool enabled;               /* If false, ignore other members. */
     int tx_count;               /* Number of BPDUs transmitted. */
     int rx_count;               /* Number of valid BPDUs received. */
     int error_count;            /* Number of bad BPDUs received. */
@@ -163,7 +165,6 @@ struct iface_hint {
 void ofproto_init(const struct shash *iface_hints);
 
 int ofproto_type_run(const char *datapath_type);
-int ofproto_type_run_fast(const char *datapath_type);
 void ofproto_type_wait(const char *datapath_type);
 
 int ofproto_create(const char *datapath, const char *datapath_type,
@@ -172,11 +173,11 @@ void ofproto_destroy(struct ofproto *);
 int ofproto_delete(const char *name, const char *type);
 
 int ofproto_run(struct ofproto *);
-int ofproto_run_fast(struct ofproto *);
 void ofproto_wait(struct ofproto *);
 bool ofproto_is_alive(const struct ofproto *);
 
 void ofproto_get_memory_usage(const struct ofproto *, struct simap *);
+void ofproto_type_get_memory_usage(const char *datapath_type, struct simap *);
 
 /* A port within an OpenFlow switch.
  *
@@ -212,15 +213,8 @@ int ofproto_port_dump_done(struct ofproto_port_dump *);
           : (ofproto_port_dump_done(DUMP), false));         \
         )
 
-#define OFPROTO_FLOW_EVICTION_THRESHOLD_DEFAULT  2500
-#define OFPROTO_FLOW_EVICTION_THRESHOLD_MIN 100
-
-/* How flow misses should be handled in ofproto-dpif */
-enum ofproto_flow_miss_model {
-    OFPROTO_HANDLE_MISS_AUTO,           /* Based on flow eviction threshold. */
-    OFPROTO_HANDLE_MISS_WITH_FACETS,    /* Always create facets. */
-    OFPROTO_HANDLE_MISS_WITHOUT_FACETS  /* Always handle without facets.*/
-};
+#define OFPROTO_FLOW_LIMIT_DEFAULT 200000
+#define OFPROTO_MAX_IDLE_DEFAULT 1500
 
 const char *ofproto_port_open_type(const char *datapath_type,
                                    const char *port_type);
@@ -242,11 +236,12 @@ void ofproto_reconnect_controllers(struct ofproto *);
 void ofproto_set_extra_in_band_remotes(struct ofproto *,
                                        const struct sockaddr_in *, size_t n);
 void ofproto_set_in_band_queue(struct ofproto *, int queue_id);
-void ofproto_set_flow_eviction_threshold(unsigned threshold);
-void ofproto_set_flow_miss_model(unsigned model);
+void ofproto_set_flow_limit(unsigned limit);
+void ofproto_set_max_idle(unsigned max_idle);
 void ofproto_set_forward_bpdu(struct ofproto *, bool forward_bpdu);
 void ofproto_set_mac_table_config(struct ofproto *, unsigned idle_time,
                                   size_t max_entries);
+void ofproto_set_threads(int n_handlers, int n_revalidators);
 void ofproto_set_dp_desc(struct ofproto *, const char *dp_desc);
 int ofproto_set_snoops(struct ofproto *, const struct sset *snoops);
 int ofproto_set_netflow(struct ofproto *,
@@ -276,6 +271,8 @@ int ofproto_port_set_stp(struct ofproto *, ofp_port_t ofp_port,
                          const struct ofproto_port_stp_settings *);
 int ofproto_port_get_stp_status(struct ofproto *, ofp_port_t ofp_port,
                                 struct ofproto_port_stp_status *);
+int ofproto_port_get_stp_stats(struct ofproto *, ofp_port_t ofp_port,
+                               struct ofproto_port_stp_stats *);
 int ofproto_port_set_queues(struct ofproto *, ofp_port_t ofp_port,
                             const struct ofproto_port_queue *,
                             size_t n_queues);
@@ -376,9 +373,16 @@ struct ofproto_table_settings {
      * distinguished by different values for the subfields within 'groups'. */
     struct mf_subfield *groups;
     size_t n_groups;
+
+    /*
+     * Fields for which prefix trie lookup is maintained.
+     */
+    unsigned int n_prefix_fields;
+    enum mf_field_id prefix_fields[CLS_MAX_TRIES];
 };
 
 int ofproto_get_n_tables(const struct ofproto *);
+uint8_t ofproto_get_n_visible_tables(const struct ofproto *);
 void ofproto_configure_table(struct ofproto *, int table_id,
                              const struct ofproto_table_settings *);
 
@@ -403,6 +407,8 @@ struct ofproto_cfm_status {
      * mode. */
     int remote_opstate;
 
+    uint64_t flap_count;
+
     /* Ordinarily a "health status" in the range 0...100 inclusive, with 0
      * being worst and 100 being best, or -1 if the health status is not
      * well-defined. */
@@ -413,9 +419,9 @@ struct ofproto_cfm_status {
     size_t n_rmps;
 };
 
-bool ofproto_port_get_cfm_status(const struct ofproto *,
-                                 ofp_port_t ofp_port,
-                                 struct ofproto_cfm_status *);
+int ofproto_port_get_cfm_status(const struct ofproto *,
+                                ofp_port_t ofp_port,
+                                struct ofproto_cfm_status *);
 \f
 /* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)
  *
@@ -428,9 +434,27 @@ void ofproto_get_vlan_usage(struct ofproto *, unsigned long int *vlan_bitmap);
 bool ofproto_has_vlan_usage_changed(const struct ofproto *);
 int ofproto_port_set_realdev(struct ofproto *, ofp_port_t vlandev_ofp_port,
                              ofp_port_t realdev_ofp_port, int vid);
+\f
+/* Table configuration */
+
+enum ofproto_table_config {
+    /* Send to controller. */
+    OFPROTO_TABLE_MISS_CONTROLLER = OFPTC11_TABLE_MISS_CONTROLLER,
+
+    /* Continue to the next table in the pipeline (OpenFlow 1.0 behavior). */
+    OFPROTO_TABLE_MISS_CONTINUE   = OFPTC11_TABLE_MISS_CONTINUE,
+
+    /* Drop the packet. */
+    OFPROTO_TABLE_MISS_DROP       = OFPTC11_TABLE_MISS_DROP,
+
+    /* The default miss behaviour for the OpenFlow version of the controller a
+     * packet_in message would be sent to..  For pre-OF1.3 controllers, send
+     * packet_in to controller.  For OF1.3+ controllers, drop. */
+    OFPROTO_TABLE_MISS_DEFAULT    = 3,
+};
 
-uint32_t ofproto_get_provider_meter_id(const struct ofproto *,
-                                       uint32_t of_meter_id);
+enum ofproto_table_config ofproto_table_get_config(const struct ofproto *,
+                                                   uint8_t table_id);
 
 #ifdef  __cplusplus
 }