diff options
author | Xiao Liang <shaw.leon@gmail.com> | 2017-08-17 00:06:24 +0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-10-31 12:31:25 -0700 |
commit | dc02e1eba62e09d106782ee75692a730cdcf364d (patch) | |
tree | 4b547e14859eacecce0ed3d40571a7f37faccf52 | |
parent | 8ce087fdcf333f4ac779e1ec4da987b94abbd0c4 (diff) | |
download | openvswitch-dc02e1eba62e09d106782ee75692a730cdcf364d.tar.gz |
lib: Move lib/rconn.h to include/openvswitch
Rconn provides useful features over vconn. Make it available to library
users.
Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r-- | include/openvswitch/automake.mk | 1 | ||||
-rw-r--r-- | include/openvswitch/rconn.h (renamed from lib/rconn.h) | 17 | ||||
-rw-r--r-- | lib/automake.mk | 1 | ||||
-rw-r--r-- | lib/learning-switch.c | 2 | ||||
-rw-r--r-- | lib/rconn.c | 11 | ||||
-rw-r--r-- | ofproto/bundles.c | 2 | ||||
-rw-r--r-- | ofproto/connmgr.c | 2 | ||||
-rw-r--r-- | ofproto/fail-open.c | 2 | ||||
-rw-r--r-- | ofproto/pinsched.c | 2 | ||||
-rw-r--r-- | ovn/controller/ofctrl.c | 2 | ||||
-rw-r--r-- | ovn/controller/pinctrl.c | 2 | ||||
-rw-r--r-- | utilities/ovs-testcontroller.c | 2 |
12 files changed, 27 insertions, 19 deletions
diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk index 6cb19b84e..ec4580641 100644 --- a/include/openvswitch/automake.mk +++ b/include/openvswitch/automake.mk @@ -20,6 +20,7 @@ openvswitchinclude_HEADERS = \ include/openvswitch/ofp-prop.h \ include/openvswitch/ofp-util.h \ include/openvswitch/packets.h \ + include/openvswitch/rconn.h \ include/openvswitch/shash.h \ include/openvswitch/thread.h \ include/openvswitch/token-bucket.h \ diff --git a/lib/rconn.h b/include/openvswitch/rconn.h index fd5df126d..176c5f641 100644 --- a/lib/rconn.h +++ b/include/openvswitch/rconn.h @@ -21,7 +21,6 @@ #include <stdint.h> #include <time.h> #include "openvswitch/types.h" -#include "ovs-thread.h" /* A wrapper around vconn that provides queuing and optionally reliability. * @@ -41,6 +40,10 @@ * Fully thread-safe. */ +#ifdef __cplusplus +extern "C" { +#endif + struct vconn; struct rconn_packet_counter; @@ -90,14 +93,6 @@ unsigned int rconn_get_connection_seqno(const struct rconn *); int rconn_get_last_error(const struct rconn *); unsigned int rconn_count_txqlen(const struct rconn *); -/* Counts packets and bytes queued into an rconn by a given source. */ -struct rconn_packet_counter { - struct ovs_mutex mutex; - unsigned int n_packets OVS_GUARDED; /* Number of packets queued. */ - unsigned int n_bytes OVS_GUARDED; /* Number of bytes queued. */ - int ref_cnt OVS_GUARDED; /* Number of owners. */ -}; - struct rconn_packet_counter *rconn_packet_counter_create(void); void rconn_packet_counter_destroy(struct rconn_packet_counter *); void rconn_packet_counter_inc(struct rconn_packet_counter *, unsigned n_bytes); @@ -107,4 +102,8 @@ unsigned int rconn_packet_counter_n_packets( const struct rconn_packet_counter *); unsigned int rconn_packet_counter_n_bytes(const struct rconn_packet_counter *); +#ifdef __cplusplus +} +#endif + #endif /* rconn.h */ diff --git a/lib/automake.mk b/lib/automake.mk index ca1cf5dd2..b984a759a 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -214,7 +214,6 @@ lib_libopenvswitch_la_SOURCES = \ lib/random.c \ lib/random.h \ lib/rconn.c \ - lib/rconn.h \ lib/rculist.h \ lib/reconnect.c \ lib/reconnect.h \ diff --git a/lib/learning-switch.c b/lib/learning-switch.c index a9cb95a57..16d1feadf 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -40,7 +40,7 @@ #include "openvswitch/vconn.h" #include "openvswitch/vlog.h" #include "poll-loop.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "openvswitch/shash.h" #include "simap.h" #include "timeval.h" diff --git a/lib/rconn.c b/lib/rconn.c index 8a2986403..673ee1cea 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -15,7 +15,7 @@ */ #include <config.h> -#include "rconn.h" +#include "openvswitch/rconn.h" #include <errno.h> #include <limits.h> #include <stdlib.h> @@ -32,6 +32,7 @@ #include "stream.h" #include "timeval.h" #include "util.h" +#include "ovs-thread.h" VLOG_DEFINE_THIS_MODULE(rconn); @@ -143,6 +144,14 @@ struct rconn { uint32_t allowed_versions; }; +/* Counts packets and bytes queued into an rconn by a given source. */ +struct rconn_packet_counter { + struct ovs_mutex mutex; + unsigned int n_packets OVS_GUARDED; /* Number of packets queued. */ + unsigned int n_bytes OVS_GUARDED; /* Number of bytes queued. */ + int ref_cnt OVS_GUARDED; /* Number of owners. */ +}; + uint32_t rconn_get_allowed_versions(const struct rconn *rconn) { return rconn->allowed_versions; diff --git a/ofproto/bundles.c b/ofproto/bundles.c index 24ea1ae7a..2fcc32369 100644 --- a/ofproto/bundles.c +++ b/ofproto/bundles.c @@ -32,7 +32,7 @@ #include "openvswitch/vlog.h" #include "pinsched.h" #include "poll-loop.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "openvswitch/shash.h" #include "simap.h" #include "stream.h" diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c index 30c627f43..d814ed8b7 100644 --- a/ofproto/connmgr.c +++ b/ofproto/connmgr.c @@ -35,7 +35,7 @@ #include "ovs-atomic.h" #include "pinsched.h" #include "poll-loop.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "openvswitch/shash.h" #include "simap.h" #include "stream.h" diff --git a/ofproto/fail-open.c b/ofproto/fail-open.c index 819bdadc3..775f1d6f5 100644 --- a/ofproto/fail-open.c +++ b/ofproto/fail-open.c @@ -32,7 +32,7 @@ #include "ofproto.h" #include "ofproto-provider.h" #include "poll-loop.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "timeval.h" VLOG_DEFINE_THIS_MODULE(fail_open); diff --git a/ofproto/pinsched.c b/ofproto/pinsched.c index 500115ad2..35716ea89 100644 --- a/ofproto/pinsched.c +++ b/ofproto/pinsched.c @@ -28,7 +28,7 @@ #include "openflow/openflow.h" #include "poll-loop.h" #include "random.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "sat-math.h" #include "timeval.h" #include "openvswitch/token-bucket.h" diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c index fc88a410b..436df8d5a 100644 --- a/ovn/controller/ofctrl.c +++ b/ovn/controller/ofctrl.c @@ -38,7 +38,7 @@ #include "ovn/actions.h" #include "poll-loop.h" #include "physical.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "socket-util.h" #include "util.h" #include "vswitch-idl.h" diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 469a35586..f9b2e0caf 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -44,7 +44,7 @@ #include "ovn/lib/ovn-dhcp.h" #include "ovn/lib/ovn-util.h" #include "poll-loop.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "socket-util.h" #include "timeval.h" #include "vswitch-idl.h" diff --git a/utilities/ovs-testcontroller.c b/utilities/ovs-testcontroller.c index b4a451286..9b9903ba5 100644 --- a/utilities/ovs-testcontroller.c +++ b/utilities/ovs-testcontroller.c @@ -33,7 +33,7 @@ #include "openvswitch/ofpbuf.h" #include "openflow/openflow.h" #include "poll-loop.h" -#include "rconn.h" +#include "openvswitch/rconn.h" #include "simap.h" #include "stream-ssl.h" #include "timeval.h" |