patch-2.4.21 linux-2.4.21/net/netlink/af_netlink.c

Next file: linux-2.4.21/net/netrom/nr_dev.c
Previous file: linux-2.4.21/net/irda/parameters.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.20/net/netlink/af_netlink.c linux-2.4.21/net/netlink/af_netlink.c
@@ -562,6 +562,14 @@
 	read_unlock(&nl_table_lock);
 }
 
+static inline void netlink_rcv_wake(struct sock *sk)
+{
+	if (skb_queue_len(&sk->receive_queue) == 0)
+		clear_bit(0, &sk->protinfo.af_netlink->state);
+	if (!test_bit(0, &sk->protinfo.af_netlink->state))
+		wake_up_interruptible(&sk->protinfo.af_netlink->wait);
+}
+
 static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, int len,
 			   struct scm_cookie *scm)
 {
@@ -675,12 +683,7 @@
 		netlink_dump(sk);
 
 out:
-	if (skb_queue_len(&sk->receive_queue) <= sk->rcvbuf/2) {
-		if (skb_queue_len(&sk->receive_queue) == 0)
-			clear_bit(0, &sk->protinfo.af_netlink->state);
-		if (!test_bit(0, &sk->protinfo.af_netlink->state))
-			wake_up_interruptible(&sk->protinfo.af_netlink->wait);
-	}
+	netlink_rcv_wake(sk);
 	return err ? : copied;
 }
 
@@ -688,13 +691,7 @@
 {
 	if (sk->protinfo.af_netlink->data_ready)
 		sk->protinfo.af_netlink->data_ready(sk, len);
-
-	if (skb_queue_len(&sk->receive_queue) <= sk->rcvbuf/2) {
-		if (skb_queue_len(&sk->receive_queue) == 0)
-			clear_bit(0, &sk->protinfo.af_netlink->state);
-		if (!test_bit(0, &sk->protinfo.af_netlink->state))
-			wake_up_interruptible(&sk->protinfo.af_netlink->wait);
-	}
+	netlink_rcv_wake(sk);
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)