Commit dc02e1eb authored by Xiao Liang's avatar Xiao Liang Committed by Ben Pfaff

lib: Move lib/rconn.h to include/openvswitch

Rconn provides useful features over vconn. Make it available to library
users.
Signed-off-by: default avatarXiao Liang <shaw.leon@gmail.com>
Signed-off-by: default avatarBen Pfaff <blp@ovn.org>
parent 8ce087fd
......@@ -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 \
......
......@@ -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 */
......@@ -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 \
......
......@@ -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"
......
......@@ -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;
......
......@@ -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"
......
......@@ -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"
......
......@@ -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);
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment