diff mbox

decnet: Use data ready call back, rather than hand coding it

Message ID 1241800225.29604.282.camel@localhost.localdomain
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Steven Whitehouse May 8, 2009, 4:30 p.m. UTC
Chrissie, can you test this? I don't have a suitable set up at the
moment. This should be correct though since its taken directly from
sock_queue_rcv_skb from whence the original code was also take in times
past. I did compile test it though.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller May 9, 2009, 8:18 p.m. UTC | #1
From: Steven Whitehouse <swhiteho@redhat.com>
Date: Fri, 08 May 2009 17:30:25 +0100

> Chrissie, can you test this? I don't have a suitable set up at the
> moment. This should be correct though since its taken directly from
> sock_queue_rcv_skb from whence the original code was also take in times
> past. I did compile test it though.
> 
> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

I'm tossing this into net-next-2.6 now, if there is some bug
we can add a follow-on fix.

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chrissie Caulfield May 11, 2009, 8:33 a.m. UTC | #2
Steven Whitehouse wrote:
> Chrissie, can you test this? I don't have a suitable set up at the
> moment. This should be correct though since its taken directly from
> sock_queue_rcv_skb from whence the original code was also take in times
> past. I did compile test it though.
> 
> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
> 
> 
> diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
> index 5d8a2a5..932408d 100644
> --- a/net/decnet/dn_nsp_in.c
> +++ b/net/decnet/dn_nsp_in.c
> @@ -578,6 +578,7 @@ out:
>  static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
>  {
>  	int err;
> +	int skb_len;
>  
>  	/* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
>  	   number of warnings when compiling with -W --ANK
> @@ -592,22 +593,12 @@ static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig
>  	if (err)
>  		goto out;
>  
> +	skb_len = skb->len;
>  	skb_set_owner_r(skb, sk);
>  	skb_queue_tail(queue, skb);
>  
> -	/* This code only runs from BH or BH protected context.
> -	 * Therefore the plain read_lock is ok here. -DaveM
> -	 */
> -	read_lock(&sk->sk_callback_lock);
> -	if (!sock_flag(sk, SOCK_DEAD)) {
> -		struct socket *sock = sk->sk_socket;
> -		wake_up_interruptible(sk->sk_sleep);
> -		if (sock && sock->fasync_list &&
> -		    !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
> -			__kill_fasync(sock->fasync_list, sig,
> -				    (sig == SIGURG) ? POLL_PRI : POLL_IN);
> -	}
> -	read_unlock(&sk->sk_callback_lock);
> +	if (!sock_flag(sk, SOCK_DEAD))
> +		sk->sk_data_ready(sk, skb_len);
>  out:
>  	return err;
>  }


ACK

The patch works fine for me.

Chrissie
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/decnet/dn_nsp_in.c b/net/decnet/dn_nsp_in.c
index 5d8a2a5..932408d 100644
--- a/net/decnet/dn_nsp_in.c
+++ b/net/decnet/dn_nsp_in.c
@@ -578,6 +578,7 @@  out:
 static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
 {
 	int err;
+	int skb_len;
 
 	/* Cast skb->rcvbuf to unsigned... It's pointless, but reduces
 	   number of warnings when compiling with -W --ANK
@@ -592,22 +593,12 @@  static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig
 	if (err)
 		goto out;
 
+	skb_len = skb->len;
 	skb_set_owner_r(skb, sk);
 	skb_queue_tail(queue, skb);
 
-	/* This code only runs from BH or BH protected context.
-	 * Therefore the plain read_lock is ok here. -DaveM
-	 */
-	read_lock(&sk->sk_callback_lock);
-	if (!sock_flag(sk, SOCK_DEAD)) {
-		struct socket *sock = sk->sk_socket;
-		wake_up_interruptible(sk->sk_sleep);
-		if (sock && sock->fasync_list &&
-		    !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags))
-			__kill_fasync(sock->fasync_list, sig,
-				    (sig == SIGURG) ? POLL_PRI : POLL_IN);
-	}
-	read_unlock(&sk->sk_callback_lock);
+	if (!sock_flag(sk, SOCK_DEAD))
+		sk->sk_data_ready(sk, skb_len);
 out:
 	return err;
 }