ofproto-dpif: Improve RSPAN translation performance from O(n**2) to O(n).
[sliver-openvswitch.git] / ofproto / ofproto.h
index 3552aac..eed4e50 100644 (file)
@@ -26,6 +26,7 @@
 #include "flow.h"
 #include "netflow.h"
 #include "sset.h"
+#include "stp.h"
 #include "tag.h"
 
 #ifdef  __cplusplus
@@ -65,6 +66,39 @@ struct ofproto_sflow_options {
     char *control_ip;
 };
 
+struct ofproto_stp_settings {
+    stp_identifier system_id;
+    uint16_t priority;
+    uint16_t hello_time;
+    uint16_t max_age;
+    uint16_t fwd_delay;
+};
+
+struct ofproto_stp_status {
+    bool enabled;               /* If false, ignore other members. */
+    stp_identifier bridge_id;
+    stp_identifier designated_root;
+    int root_path_cost;
+};
+
+struct ofproto_port_stp_settings {
+    bool enable;
+    uint8_t port_num;           /* In the range 1-255, inclusive. */
+    uint8_t priority;
+    uint16_t path_cost;
+};
+
+struct ofproto_port_stp_status {
+    bool enabled;               /* If false, ignore other members. */
+    int port_id;
+    enum stp_state state;
+    unsigned int sec_in_state;
+    enum stp_role role;
+    int tx_count;               /* Number of BPDUs transmitted. */
+    int rx_count;               /* Number of valid BPDUs received. */
+    int error_count;            /* Number of bad BPDUs received. */
+};
+
 /* How the switch should act if the controller cannot be contacted. */
 enum ofproto_fail_mode {
     OFPROTO_FAIL_SECURE,        /* Preserve flow table. */
@@ -170,6 +204,8 @@ int ofproto_set_snoops(struct ofproto *, const struct sset *snoops);
 int ofproto_set_netflow(struct ofproto *,
                         const struct netflow_options *nf_options);
 int ofproto_set_sflow(struct ofproto *, const struct ofproto_sflow_options *);
+int ofproto_set_stp(struct ofproto *, const struct ofproto_stp_settings *);
+int ofproto_get_stp_status(struct ofproto *, struct ofproto_stp_status *);
 
 /* Configuration of ports. */
 
@@ -179,6 +215,31 @@ void ofproto_port_clear_cfm(struct ofproto *, uint16_t ofp_port);
 void ofproto_port_set_cfm(struct ofproto *, uint16_t ofp_port,
                           const struct cfm_settings *);
 int ofproto_port_is_lacp_current(struct ofproto *, uint16_t ofp_port);
+int ofproto_port_set_stp(struct ofproto *, uint16_t ofp_port,
+                         const struct ofproto_port_stp_settings *);
+int ofproto_port_get_stp_status(struct ofproto *, uint16_t ofp_port,
+                                struct ofproto_port_stp_status *);
+
+/* The behaviour of the port regarding VLAN handling */
+enum port_vlan_mode {
+    /* This port is an access port.  'vlan' is the VLAN ID.  'trunks' is
+     * ignored. */
+    PORT_VLAN_ACCESS,
+
+    /* This port is a trunk.  'trunks' is the set of trunks. 'vlan' is
+     * ignored. */
+    PORT_VLAN_TRUNK,
+
+    /* Untagged incoming packets are part of 'vlan', as are incoming packets
+     * tagged with 'vlan'.  Outgoing packets tagged with 'vlan' stay tagged.
+     * Other VLANs in 'trunks' are trunked. */
+    PORT_VLAN_NATIVE_TAGGED,
+
+    /* Untagged incoming packets are part of 'vlan', as are incoming packets
+     * tagged with 'vlan'.  Outgoing packets tagged with 'vlan' are untagged.
+     * Other VLANs in 'trunks' are trunked. */
+    PORT_VLAN_NATIVE_UNTAGGED
+};
 
 /* Configuration of bundles. */
 struct ofproto_bundle_settings {
@@ -187,8 +248,9 @@ struct ofproto_bundle_settings {
     uint16_t *slaves;           /* OpenFlow port numbers for slaves. */
     size_t n_slaves;
 
-    int vlan;                   /* VLAN if access port, -1 if trunk port. */
-    unsigned long *trunks;      /* vlan_bitmap, NULL to trunk all VLANs. */
+    enum port_vlan_mode vlan_mode; /* Selects mode for vlan and trunks */
+    int vlan;                   /* VLAN VID, except for PORT_VLAN_TRUNK. */
+    unsigned long *trunks;      /* vlan_bitmap, except for PORT_VLAN_ACCESS. */
 
     struct bond_settings *bond; /* Must be nonnull iff if n_slaves > 1. */
     uint32_t *bond_stable_ids;  /* Array of n_slaves elements. */
@@ -227,7 +289,7 @@ int ofproto_mirror_register(struct ofproto *, void *aux,
 int ofproto_mirror_unregister(struct ofproto *, void *aux);
 
 int ofproto_set_flood_vlans(struct ofproto *, unsigned long *flood_vlans);
-bool ofproto_is_mirror_output_bundle(struct ofproto *, void *aux);
+bool ofproto_is_mirror_output_bundle(const struct ofproto *, void *aux);
 
 /* Configuration querying. */
 bool ofproto_has_snoops(const struct ofproto *);