Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66608
b: refs/heads/master
c: 0cfad07
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Oct 10, 2007
1 parent a5635dd commit eac90b2
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 007e3936bdaaa012483c9fe06ca71c272458c710
refs/heads/master: 0cfad07555312468296ea3bbbcdf99038f58678b
2 changes: 1 addition & 1 deletion trunk/include/net/netlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ struct nl_info {
u32 pid;
};

extern void netlink_run_queue(struct sock *sk, unsigned int *qlen,
extern unsigned int netlink_run_queue(struct sock *sk, unsigned int qlen,
int (*cb)(struct sk_buff *,
struct nlmsghdr *));
extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,7 @@ static void rtnetlink_rcv(struct sock *sk, int len)

do {
mutex_lock(&rtnl_mutex);
netlink_run_queue(sk, &qlen, &rtnetlink_rcv_msg);
qlen = netlink_run_queue(sk, qlen, &rtnetlink_rcv_msg);
mutex_unlock(&rtnl_mutex);

netdev_run_todo();
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/ipv4/inet_diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ static void inet_diag_rcv(struct sock *sk, int len)

do {
mutex_lock(&inet_diag_mutex);
netlink_run_queue(sk, &qlen, &inet_diag_rcv_msg);
qlen = netlink_run_queue(sk, qlen, &inet_diag_rcv_msg);
mutex_unlock(&inet_diag_mutex);
} while (qlen);
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/netfilter/nfnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ static void nfnetlink_rcv(struct sock *sk, int len)
do {
if (nfnl_trylock())
return;
netlink_run_queue(sk, &qlen, nfnetlink_rcv_msg);
qlen = netlink_run_queue(sk, qlen, nfnetlink_rcv_msg);
__nfnl_unlock();
} while (qlen);
}
Expand Down
18 changes: 10 additions & 8 deletions trunk/net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ static int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
/**
* nelink_run_queue - Process netlink receive queue.
* @sk: Netlink socket containing the queue
* @qlen: Place to store queue length upon entry
* @qlen: Initial queue length
* @cb: Callback function invoked for each netlink message found
*
* Processes as much as there was in the queue upon entry and invokes
Expand All @@ -1639,35 +1639,37 @@ static int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
* returns with a qlen != 0.
*
* qlen must be initialized to 0 before the initial entry, afterwards
* the function may be called repeatedly until qlen reaches 0.
* the function may be called repeatedly until the returned qlen is 0.
*
* The callback function may return -EINTR to signal that processing
* of netlink messages shall be interrupted. In this case the message
* currently being processed will NOT be requeued onto the receive
* queue.
*/
void netlink_run_queue(struct sock *sk, unsigned int *qlen,
int (*cb)(struct sk_buff *, struct nlmsghdr *))
unsigned int netlink_run_queue(struct sock *sk, unsigned int qlen,
int (*cb)(struct sk_buff *, struct nlmsghdr *))
{
struct sk_buff *skb;

if (!*qlen || *qlen > skb_queue_len(&sk->sk_receive_queue))
*qlen = skb_queue_len(&sk->sk_receive_queue);
if (!qlen || qlen > skb_queue_len(&sk->sk_receive_queue))
qlen = skb_queue_len(&sk->sk_receive_queue);

for (; *qlen; (*qlen)--) {
for (; qlen; qlen--) {
skb = skb_dequeue(&sk->sk_receive_queue);
if (netlink_rcv_skb(skb, cb)) {
if (skb->len)
skb_queue_head(&sk->sk_receive_queue, skb);
else {
kfree_skb(skb);
(*qlen)--;
qlen--;
}
break;
}

kfree_skb(skb);
}

return qlen;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static void genl_rcv(struct sock *sk, int len)
do {
if (genl_trylock())
return;
netlink_run_queue(sk, &qlen, genl_rcv_msg);
qlen = netlink_run_queue(sk, qlen, genl_rcv_msg);
genl_unlock();
} while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen);
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1887,7 +1887,7 @@ static void xfrm_netlink_rcv(struct sock *sk, int len)

do {
mutex_lock(&xfrm_cfg_mutex);
netlink_run_queue(sk, &qlen, &xfrm_user_rcv_msg);
qlen = netlink_run_queue(sk, qlen, &xfrm_user_rcv_msg);
mutex_unlock(&xfrm_cfg_mutex);

} while (qlen);
Expand Down

0 comments on commit eac90b2

Please sign in to comment.