[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ACFABAE.5050003@gmail.com>
Date: Fri, 09 Oct 2009 23:31:26 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Neil Horman <nhorman@...driver.com>
CC: netdev@...r.kernel.org, davem@...emloft.net, socketcan@...tkopp.net
Subject: Re: [PATCH] Generalize socket rx gap / receive queue overflow cmsg
(v2)
Neil Horman a écrit :
>
> +extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
> + struct sk_buff *skb);
Surely you meant __sock_recv_drops() ? It only deals with drops.
> + case SO_RXQ_OVFL:
> + v.val = sock_flag(sk, SOCK_RXQ_OVFL);
> + break;
> +
Hmm, I advise to use v.val = !!sock_flag(sk, SOCK_RXQ_OVFL);
So that application gets 0 or 1, not 0 or some big value.
Its better because it allows us to change internal SOCK_RXQ_OVFL if necessary in the future.
> drop_n_acct:
> - spin_lock(&sk->sk_receive_queue.lock);
> - po->stats.tp_drops++;
> - spin_unlock(&sk->sk_receive_queue.lock);
> + po->stats.tp_drops = atomic_inc_return(&sk->sk_drops);
Yes :)
> EXPORT_SYMBOL_GPL(__sock_recv_timestamp);
>
> +void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
> + struct sk_buff *skb)
> +{
> + put_cmsg(msg, SOL_SOCKET, SO_RXQ_OVFL, sizeof(__u32), &skb->dropcount);
> +}
> +EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops);
> +
Just change the name.
And is it really too large to be inlined ?
In the contrary, sock_recv_timestamp() is so large that I suspect
your sock_recv_ts_and_drops should *not* be inlined, and include inlined versions only :
I suggest something more orthogonal like :
void inline sock_recv_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
{
if (sock_flag(sk, SOCK_RXQ_OVFL) && skb && skb->dropcount)
put_cmsg(msg, SOL_SOCKET, SO_RXQ_OVFL,
sizeof(__u32), &skb->dropcount);
}
void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
{
sock_recv_timestamp(msg, sk, skb); // inlined
sock_recv_drops(msg, sk, skb); // inlined
}
EXPORT_SYMBOL_GPL(sock_recv_ts_and_drops)
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists