return oso ? EOPNOTSUPP : 0;
}
}
+
+int
+ofproto_set_ipfix(struct ofproto *ofproto,
+ const struct ofproto_ipfix_bridge_exporter_options *bo,
+ const struct ofproto_ipfix_flow_exporter_options *fo,
+ size_t n_fo)
+{
+ if (ofproto->ofproto_class->set_ipfix) {
+ return ofproto->ofproto_class->set_ipfix(ofproto, bo, fo, n_fo);
+ } else {
+ return (bo || fo) ? EOPNOTSUPP : 0;
+ }
+}
\f
/* Spanning Tree Protocol (STP) configuration. */
}
}
+/* Configures BFD on 'ofp_port' in 'ofproto'. This function has no effect if
+ * 'ofproto' does not have a port 'ofp_port'. */
+void
+ofproto_port_set_bfd(struct ofproto *ofproto, uint16_t ofp_port,
+ const struct smap *cfg)
+{
+ struct ofport *ofport;
+ int error;
+
+ ofport = ofproto_get_port(ofproto, ofp_port);
+ if (!ofport) {
+ VLOG_WARN("%s: cannot configure bfd on nonexistent port %"PRIu16,
+ ofproto->name, ofp_port);
+ }
+
+ error = (ofproto->ofproto_class->set_bfd
+ ? ofproto->ofproto_class->set_bfd(ofport, cfg)
+ : EOPNOTSUPP);
+ if (error) {
+ VLOG_WARN("%s: bfd configuration on port %"PRIu16" (%s) failed (%s)",
+ ofproto->name, ofp_port, netdev_get_name(ofport->netdev),
+ strerror(error));
+ }
+}
+
+/* Populates 'status' with key value pairs indicating the status of the BFD
+ * session on 'ofp_port'. This information is intended to be populated in the
+ * OVS database. Has no effect if 'ofp_port' is not na OpenFlow port in
+ * 'ofproto'. */
+int
+ofproto_port_get_bfd_status(struct ofproto *ofproto, uint16_t ofp_port,
+ struct smap *status)
+{
+ struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
+ return (ofport && ofproto->ofproto_class->get_bfd_status
+ ? ofproto->ofproto_class->get_bfd_status(ofport, status)
+ : EOPNOTSUPP);
+}
+
/* Checks the status of LACP negotiation for 'ofp_port' within ofproto.
* Returns 1 if LACP partner information for 'ofp_port' is up-to-date,
* 0 if LACP partner information is not current (generally indicating a
toggle = (config ^ port->pp.config) & mask;
if (toggle & OFPUTIL_PC_PORT_DOWN) {
if (config & OFPUTIL_PC_PORT_DOWN) {
- netdev_turn_flags_off(port->netdev, NETDEV_UP, true);
+ netdev_turn_flags_off(port->netdev, NETDEV_UP, NULL);
} else {
- netdev_turn_flags_on(port->netdev, NETDEV_UP, true);
+ netdev_turn_flags_on(port->netdev, NETDEV_UP, NULL);
}
toggle &= ~OFPUTIL_PC_PORT_DOWN;
}
ofproto->ofproto_class->get_netflow_ids(ofproto, engine_type, engine_id);
}
-/* Checks the fault status of CFM for 'ofp_port' within 'ofproto'. Returns a
- * bitmask of 'cfm_fault_reason's to indicate a CFM fault (generally
- * indicating a connectivity problem). Returns zero if CFM is not faulted,
- * and -1 if CFM is not enabled on 'ofp_port'. */
-int
-ofproto_port_get_cfm_fault(const struct ofproto *ofproto, uint16_t ofp_port)
-{
- struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
- return (ofport && ofproto->ofproto_class->get_cfm_fault
- ? ofproto->ofproto_class->get_cfm_fault(ofport)
- : -1);
-}
-
-/* Checks the operational status reported by the remote CFM endpoint of
- * 'ofp_port' Returns 1 if operationally up, 0 if operationally down, and -1
- * if CFM is not enabled on 'ofp_port' or does not support operational status.
- */
-int
-ofproto_port_get_cfm_opup(const struct ofproto *ofproto, uint16_t ofp_port)
-{
- struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
- return (ofport && ofproto->ofproto_class->get_cfm_opup
- ? ofproto->ofproto_class->get_cfm_opup(ofport)
- : -1);
-}
-
-/* Gets the MPIDs of the remote maintenance points broadcasting to 'ofp_port'
- * within 'ofproto'. Populates 'rmps' with an array of MPIDs owned by
- * 'ofproto', and 'n_rmps' with the number of MPIDs in 'rmps'. Returns a
- * number less than 0 if CFM is not enabled on 'ofp_port'. */
-int
-ofproto_port_get_cfm_remote_mpids(const struct ofproto *ofproto,
- uint16_t ofp_port, const uint64_t **rmps,
- size_t *n_rmps)
-{
- struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
-
- *rmps = NULL;
- *n_rmps = 0;
- return (ofport && ofproto->ofproto_class->get_cfm_remote_mpids
- ? ofproto->ofproto_class->get_cfm_remote_mpids(ofport, rmps,
- n_rmps)
- : -1);
-}
-
-/* Checks the health of the CFM for 'ofp_port' within 'ofproto'. Returns an
- * integer value between 0 and 100 to indicate the health of the port as a
- * percentage which is the average of cfm health of all the remote_mpids or
- * returns -1 if CFM is not enabled on 'ofport'. */
-int
-ofproto_port_get_cfm_health(const struct ofproto *ofproto, uint16_t ofp_port)
+/* Checks the status of CFM configured on 'ofp_port' within 'ofproto'. Returns
+ * true if the port's CFM status was successfully stored into '*status'.
+ * Returns false if the port did not have CFM configured, in which case
+ * '*status' is indeterminate.
+ *
+ * The caller must provide and owns '*status', but it does not own and must not
+ * modify or free the array returned in 'status->rmps'. */
+bool
+ofproto_port_get_cfm_status(const struct ofproto *ofproto, uint16_t ofp_port,
+ struct ofproto_cfm_status *status)
{
struct ofport *ofport = ofproto_get_port(ofproto, ofp_port);
- return (ofport && ofproto->ofproto_class->get_cfm_health
- ? ofproto->ofproto_class->get_cfm_health(ofport)
- : -1);
+ return (ofport
+ && ofproto->ofproto_class->get_cfm_status
+ && ofproto->ofproto_class->get_cfm_status(ofport, status));
}
static enum ofperr