projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ovsdb-idl: Fix atomicity of writes that don't change a column's value.
[openvswitch]
/
ofproto
/
ofproto.c
diff --git
a/ofproto/ofproto.c
b/ofproto/ofproto.c
index 7cdc98adf2111d795e11951295f167e940f25b3c..1865277136e2294bed068a0ad031f9c1520549e4 100644
(file)
--- a/
ofproto/ofproto.c
+++ b/
ofproto/ofproto.c
@@
-55,9
+55,10
@@
#include "poll-loop.h"
#include "rconn.h"
#include "shash.h"
#include "poll-loop.h"
#include "rconn.h"
#include "shash.h"
+#include "sset.h"
#include "stream-ssl.h"
#include "stream-ssl.h"
-#include "svec.h"
#include "tag.h"
#include "tag.h"
+#include "timer.h"
#include "timeval.h"
#include "unaligned.h"
#include "unixctl.h"
#include "timeval.h"
#include "unaligned.h"
#include "unixctl.h"
@@
-296,7
+297,7
@@
struct ofproto {
/* Flow table. */
struct classifier cls;
/* Flow table. */
struct classifier cls;
-
long long int
next_expiration;
+
struct timer
next_expiration;
/* Facets. */
struct hmap facets;
/* Facets. */
struct hmap facets;
@@
-404,7
+405,7
@@
ofproto_create(const char *datapath, const char *datapath_type,
/* Initialize flow table. */
classifier_init(&p->cls);
/* Initialize flow table. */
classifier_init(&p->cls);
-
p->next_expiration = time_msec() + 1000
;
+
timer_set_duration(&p->next_expiration, 1000)
;
/* Initialize facet table. */
hmap_init(&p->facets);
/* Initialize facet table. */
hmap_init(&p->facets);
@@
-542,7
+543,7
@@
ofproto_set_desc(struct ofproto *p,
}
int
}
int
-ofproto_set_snoops(struct ofproto *ofproto, const struct s
vec
*snoops)
+ofproto_set_snoops(struct ofproto *ofproto, const struct s
set
*snoops)
{
return connmgr_set_snoops(ofproto->connmgr, snoops);
}
{
return connmgr_set_snoops(ofproto->connmgr, snoops);
}
@@
-551,7
+552,7
@@
int
ofproto_set_netflow(struct ofproto *ofproto,
const struct netflow_options *nf_options)
{
ofproto_set_netflow(struct ofproto *ofproto,
const struct netflow_options *nf_options)
{
- if (nf_options &&
nf_options->collectors.n
) {
+ if (nf_options &&
!sset_is_empty(&nf_options->collectors)
) {
if (!ofproto->netflow) {
ofproto->netflow = netflow_create();
}
if (!ofproto->netflow) {
ofproto->netflow = netflow_create();
}
@@
-666,8
+667,14
@@
ofproto_get_fail_mode(const struct ofproto *p)
return connmgr_get_fail_mode(p->connmgr);
}
return connmgr_get_fail_mode(p->connmgr);
}
+bool
+ofproto_has_snoops(const struct ofproto *ofproto)
+{
+ return connmgr_has_snoops(ofproto->connmgr);
+}
+
void
void
-ofproto_get_snoops(const struct ofproto *ofproto, struct s
vec
*snoops)
+ofproto_get_snoops(const struct ofproto *ofproto, struct s
set
*snoops)
{
connmgr_get_snoops(ofproto->connmgr, snoops);
}
{
connmgr_get_snoops(ofproto->connmgr, snoops);
}
@@
-779,9
+786,9
@@
ofproto_run1(struct ofproto *p)
connmgr_run(p->connmgr, handle_openflow);
connmgr_run(p->connmgr, handle_openflow);
- if (time
_msec() >= p->next_expiration
) {
+ if (time
r_expired(&p->next_expiration)
) {
int delay = ofproto_expire(p);
int delay = ofproto_expire(p);
-
p->next_expiration = time_msec() + delay
;
+
timer_set_duration(&p->next_expiration, delay)
;
COVERAGE_INC(ofproto_expiration);
}
COVERAGE_INC(ofproto_expiration);
}
@@
-844,8
+851,8
@@
ofproto_wait(struct ofproto *p)
/* Shouldn't happen, but if it does just go around again. */
VLOG_DBG_RL(&rl, "need revalidate in ofproto_wait_cb()");
poll_immediate_wake();
/* Shouldn't happen, but if it does just go around again. */
VLOG_DBG_RL(&rl, "need revalidate in ofproto_wait_cb()");
poll_immediate_wake();
- } else
if (p->next_expiration != LLONG_MAX)
{
-
poll_timer_wait_until(
p->next_expiration);
+ } else {
+
timer_wait(&
p->next_expiration);
}
connmgr_wait(p->connmgr);
}
}
connmgr_wait(p->connmgr);
}
@@
-1025,25
+1032,25
@@
static void
reinit_ports(struct ofproto *p)
{
struct dpif_port_dump dump;
reinit_ports(struct ofproto *p)
{
struct dpif_port_dump dump;
- struct shash_node *node;
- struct shash devnames;
+ struct sset devnames;
struct ofport *ofport;
struct dpif_port dpif_port;
struct ofport *ofport;
struct dpif_port dpif_port;
+ const char *devname;
COVERAGE_INC(ofproto_reinit_ports);
COVERAGE_INC(ofproto_reinit_ports);
- s
hash
_init(&devnames);
+ s
set
_init(&devnames);
HMAP_FOR_EACH (ofport, hmap_node, &p->ports) {
HMAP_FOR_EACH (ofport, hmap_node, &p->ports) {
- s
hash_add_once (&devnames, ofport->opp.name, NULL
);
+ s
set_add(&devnames, ofport->opp.name
);
}
DPIF_PORT_FOR_EACH (&dpif_port, &dump, p->dpif) {
}
DPIF_PORT_FOR_EACH (&dpif_port, &dump, p->dpif) {
- s
hash_add_once (&devnames, dpif_port.name, NULL
);
+ s
set_add(&devnames, dpif_port.name
);
}
}
- S
HASH_FOR_EACH (nod
e, &devnames) {
- update_port(p,
node->
name);
+ S
SET_FOR_EACH (devnam
e, &devnames) {
+ update_port(p,
dev
name);
}
}
- s
hash
_destroy(&devnames);
+ s
set
_destroy(&devnames);
}
static struct ofport *
}
static struct ofport *
@@
-1157,8
+1164,8
@@
ofport_run(struct ofproto *ofproto, struct ofport *ofport)
struct ccm *ccm;
ofpbuf_init(&packet, 0);
struct ccm *ccm;
ofpbuf_init(&packet, 0);
- ccm =
compose_packet
(&packet, eth_addr_ccm, ofport->opp.hw_addr,
-
ETH_TYPE_CFM, sizeof *ccm);
+ ccm =
eth_compose
(&packet, eth_addr_ccm, ofport->opp.hw_addr,
+ ETH_TYPE_CFM, sizeof *ccm);
cfm_compose_ccm(ofport->cfm, ccm);
ofproto_send_packet(ofproto, ofport->odp_port, 0, &packet);
ofpbuf_uninit(&packet);
cfm_compose_ccm(ofport->cfm, ccm);
ofproto_send_packet(ofproto, ofport->odp_port, 0, &packet);
ofpbuf_uninit(&packet);