projects
/
cascardo
/
ovs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dpif-netdev: Unique and sequential tx_qids.
[cascardo/ovs.git]
/
lib
/
netlink-notifier.c
diff --git
a/lib/netlink-notifier.c
b/lib/netlink-notifier.c
index
8f6daff
..
45c9188
100644
(file)
--- a/
lib/netlink-notifier.c
+++ b/
lib/netlink-notifier.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012
, 2013
Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-18,7
+18,6
@@
#include "netlink-notifier.h"
#include "netlink-notifier.h"
-#include <assert.h>
#include <errno.h>
#include <poll.h>
#include <stdlib.h>
#include <errno.h>
#include <poll.h>
#include <stdlib.h>
@@
-27,7
+26,7
@@
#include "netlink.h"
#include "netlink-socket.h"
#include "ofpbuf.h"
#include "netlink.h"
#include "netlink-socket.h"
#include "ofpbuf.h"
-#include "vlog.h"
+#include "
openvswitch/
vlog.h"
VLOG_DEFINE_THIS_MODULE(netlink_notifier);
VLOG_DEFINE_THIS_MODULE(netlink_notifier);
@@
-37,12
+36,12
@@
static void nln_report(struct nln *nln, void *change);
struct nln {
struct nl_sock *notify_sock; /* Netlink socket. */
struct nln {
struct nl_sock *notify_sock; /* Netlink socket. */
- struct list all_notifiers; /* All nln notifiers. */
+ struct
ovs_
list all_notifiers; /* All nln notifiers. */
bool has_run; /* Guard for run and wait functions. */
/* Passed in by nln_create(). */
int multicast_group; /* Multicast group we listen on. */
bool has_run; /* Guard for run and wait functions. */
/* Passed in by nln_create(). */
int multicast_group; /* Multicast group we listen on. */
- int protocol; /* Protoc
a
l passed to nl_sock_create(). */
+ int protocol; /* Protoc
o
l passed to nl_sock_create(). */
nln_parse_func *parse; /* Message parsing function. */
void *change; /* Change passed to parse. */
};
nln_parse_func *parse; /* Message parsing function. */
void *change; /* Change passed to parse. */
};
@@
-50,7
+49,7
@@
struct nln {
struct nln_notifier {
struct nln *nln; /* Parent nln. */
struct nln_notifier {
struct nln *nln; /* Parent nln. */
- struct list node;
+ struct
ovs_
list node;
nln_notify_func *cb;
void *aux;
};
nln_notify_func *cb;
void *aux;
};
@@
-87,7
+86,7
@@
void
nln_destroy(struct nln *nln)
{
if (nln) {
nln_destroy(struct nln *nln)
{
if (nln) {
- assert(list_is_empty(&nln->all_notifiers));
+
ovs_
assert(list_is_empty(&nln->all_notifiers));
nl_sock_destroy(nln->notify_sock);
free(nln);
}
nl_sock_destroy(nln->notify_sock);
free(nln);
}
@@
-116,7
+115,8
@@
nln_notifier_create(struct nln *nln, nln_notify_func *cb, void *aux)
}
if (error) {
nl_sock_destroy(sock);
}
if (error) {
nl_sock_destroy(sock);
- VLOG_WARN("could not create netlink socket: %s", strerror(error));
+ VLOG_WARN("could not create netlink socket: %s",
+ ovs_strerror(error));
return NULL;
}
nln->notify_sock = sock;
return NULL;
}
nln->notify_sock = sock;
@@
-182,12
+182,15
@@
nln_run(struct nln *nln)
return;
} else {
if (error == ENOBUFS) {
return;
} else {
if (error == ENOBUFS) {
+ /* The socket buffer might be full, there could be too many
+ * notifications, so it makes sense to call nln_report() */
+ nln_report(nln, NULL);
VLOG_WARN_RL(&rl, "netlink receive buffer overflowed");
} else {
VLOG_WARN_RL(&rl, "error reading netlink socket: %s",
VLOG_WARN_RL(&rl, "netlink receive buffer overflowed");
} else {
VLOG_WARN_RL(&rl, "error reading netlink socket: %s",
- strerror(error));
+
ovs_
strerror(error));
}
}
-
nln_report(nln, NULL)
;
+
return
;
}
}
}
}
}
}