X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ofproto%2Fofproto-provider.h;h=4736b440f536871c8a7bfe96433777eb38619beb;hb=11a574a737fa506c8e66c7bd42fa3186e70c286f;hp=8c01b979d3d920a28855966e9b7ce2be74ff10e8;hpb=b0408fcacca150694d116d4ead3930757e545bbf;p=sliver-openvswitch.git diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index 8c01b979d..4736b440f 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -27,12 +27,12 @@ #include "ofp-errors.h" #include "ofp-util.h" #include "shash.h" +#include "simap.h" #include "timeval.h" struct match; struct ofpact; struct ofputil_flow_mod; -struct simap; /* An OpenFlow switch. * @@ -62,6 +62,9 @@ struct ofproto { /* Datapath. */ struct hmap ports; /* Contains "struct ofport"s. */ struct shash port_by_name; + unsigned long *ofp_port_ids;/* Bitmap of used OpenFlow port numbers. */ + struct simap ofp_requests; /* OpenFlow port number requests. */ + uint16_t alloc_port_no; /* Last allocated OpenFlow port number. */ uint16_t max_ports; /* Max possible OpenFlow port num, plus one. */ /* Flow tables. */ @@ -356,6 +359,37 @@ struct ofproto_class { */ int (*del)(const char *type, const char *name); +/* ## ------------------------ ## */ +/* ## Top-Level type Functions ## */ +/* ## ------------------------ ## */ + + /* Performs any periodic activity required on ofprotos of type + * 'type'. + * + * An ofproto provider may implement it or not, depending on whether + * it needs type-level maintenance. + * + * Returns 0 if successful, otherwise a positive errno value. */ + int (*type_run)(const char *type); + + /* Performs periodic activity required on ofprotos of type 'type' + * that needs to be done with the least possible latency. + * + * This is run multiple times per main loop. An ofproto provider may + * implement it or not, according to whether it provides a performance + * boost for that ofproto implementation. + * + * Returns 0 if successful, otherwise a positive errno value. */ + int (*type_run_fast)(const char *type); + + /* Causes the poll loop to wake up when a type 'type''s 'run' + * function needs to be called, e.g. by calling the timer or fd + * waiting functions in poll-loop.h. + * + * An ofproto provider may implement it or not, depending on whether + * it needs type-level maintenance. */ + void (*type_wait)(const char *type); + /* ## --------------------------- ## */ /* ## Top-Level ofproto Functions ## */ /* ## --------------------------- ## */ @@ -536,6 +570,8 @@ struct ofproto_class { /* Life-cycle functions for a "struct ofport" (see "Life Cycle" above). * * ->port_construct() should not modify any base members of the ofport. + * An ofproto implementation should use the 'ofp_port' member of + * "struct ofport" as the OpenFlow port number. * * ofports are managed by the base ofproto code. The ofproto * implementation should only create and destroy them in response to calls @@ -593,18 +629,15 @@ struct ofproto_class { int (*port_query_by_name)(const struct ofproto *ofproto, const char *devname, struct ofproto_port *port); - /* Attempts to add 'netdev' as a port on 'ofproto'. If '*ofp_portp' - * is not OFPP_NONE, attempts to use that as the port's OpenFlow - * port number. - * - * Returns 0 if successful, otherwise a positive errno value. If - * successful, sets '*ofp_portp' to the new port's port number. + /* Attempts to add 'netdev' as a port on 'ofproto'. Returns 0 if + * successful, otherwise a positive errno value. The caller should + * inform the implementation of the OpenFlow port through the + * ->port_construct() method. * * It doesn't matter whether the new port will be returned by a later call * to ->port_poll(); the implementation may do whatever is more * convenient. */ - int (*port_add)(struct ofproto *ofproto, struct netdev *netdev, - uint16_t *ofp_portp); + int (*port_add)(struct ofproto *ofproto, struct netdev *netdev); /* Deletes port number 'ofp_port' from the datapath for 'ofproto'. Returns * 0 if successful, otherwise a positive errno value.