git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto: Add group desc and stats tests
[sliver-openvswitch.git]
/
lib
/
netlink-socket.c
diff --git
a/lib/netlink-socket.c
b/lib/netlink-socket.c
index
da32284
..
3420503
100644
(file)
--- a/
lib/netlink-socket.c
+++ b/
lib/netlink-socket.c
@@
-40,7
+40,6
@@
VLOG_DEFINE_THIS_MODULE(netlink_socket);
COVERAGE_DEFINE(netlink_overflow);
COVERAGE_DEFINE(netlink_received);
COVERAGE_DEFINE(netlink_recv_jumbo);
COVERAGE_DEFINE(netlink_overflow);
COVERAGE_DEFINE(netlink_received);
COVERAGE_DEFINE(netlink_recv_jumbo);
-COVERAGE_DEFINE(netlink_send);
COVERAGE_DEFINE(netlink_sent);
/* Linux header file confusion causes this to be undefined. */
COVERAGE_DEFINE(netlink_sent);
/* Linux header file confusion causes this to be undefined. */
@@
-925,12
+924,10
@@
do_lookup_genl_family(const char *name, struct nlattr **attrs,
/* Finds the multicast group called 'group_name' in genl family 'family_name'.
* When successful, writes its result to 'multicast_group' and returns 0.
* Otherwise, clears 'multicast_group' and returns a positive error code.
/* Finds the multicast group called 'group_name' in genl family 'family_name'.
* When successful, writes its result to 'multicast_group' and returns 0.
* Otherwise, clears 'multicast_group' and returns a positive error code.
- *
- * Some kernels do not support looking up a multicast group with this function.
- * In this case, 'multicast_group' will be populated with 'fallback'. */
+ */
int
nl_lookup_genl_mcgroup(const char *family_name, const char *group_name,
int
nl_lookup_genl_mcgroup(const char *family_name, const char *group_name,
- unsigned int *multicast_group
, unsigned int fallback
)
+ unsigned int *multicast_group)
{
struct nlattr *family_attrs[ARRAY_SIZE(family_policy)];
const struct nlattr *mc;
{
struct nlattr *family_attrs[ARRAY_SIZE(family_policy)];
const struct nlattr *mc;
@@
-945,10
+942,7
@@
nl_lookup_genl_mcgroup(const char *family_name, const char *group_name,
}
if (!family_attrs[CTRL_ATTR_MCAST_GROUPS]) {
}
if (!family_attrs[CTRL_ATTR_MCAST_GROUPS]) {
- *multicast_group = fallback;
- VLOG_WARN("%s-%s: has no multicast group, using fallback %d",
- family_name, group_name, *multicast_group);
- error = 0;
+ error = EPROTO;
goto exit;
}
goto exit;
}
@@
-1012,8
+1006,8
@@
struct nl_pool {
int n;
};
int n;
};
-static struct
nl_pool pools[MAX_LINKS]
;
-static
pthread_mutex_t pool_mutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER
;
+static struct
ovs_mutex pool_mutex = OVS_MUTEX_INITIALIZER
;
+static
struct nl_pool pools[MAX_LINKS] OVS_GUARDED_BY(pool_mutex)
;
static int
nl_pool_alloc(int protocol, struct nl_sock **sockp)
static int
nl_pool_alloc(int protocol, struct nl_sock **sockp)
@@
-1023,12
+1017,12
@@
nl_pool_alloc(int protocol, struct nl_sock **sockp)
ovs_assert(protocol >= 0 && protocol < ARRAY_SIZE(pools));
ovs_assert(protocol >= 0 && protocol < ARRAY_SIZE(pools));
-
xpthread
_mutex_lock(&pool_mutex);
+
ovs
_mutex_lock(&pool_mutex);
pool = &pools[protocol];
if (pool->n > 0) {
sock = pool->socks[--pool->n];
}
pool = &pools[protocol];
if (pool->n > 0) {
sock = pool->socks[--pool->n];
}
-
xpthread
_mutex_unlock(&pool_mutex);
+
ovs
_mutex_unlock(&pool_mutex);
if (sock) {
*sockp = sock;
if (sock) {
*sockp = sock;
@@
-1044,12
+1038,12
@@
nl_pool_release(struct nl_sock *sock)
if (sock) {
struct nl_pool *pool = &pools[sock->protocol];
if (sock) {
struct nl_pool *pool = &pools[sock->protocol];
-
xpthread
_mutex_lock(&pool_mutex);
+
ovs
_mutex_lock(&pool_mutex);
if (pool->n < ARRAY_SIZE(pool->socks)) {
pool->socks[pool->n++] = sock;
sock = NULL;
}
if (pool->n < ARRAY_SIZE(pool->socks)) {
pool->socks[pool->n++] = sock;
sock = NULL;
}
-
xpthread
_mutex_unlock(&pool_mutex);
+
ovs
_mutex_unlock(&pool_mutex);
nl_sock_destroy(sock);
}
nl_sock_destroy(sock);
}