From: Eric Dumazet <eric.dumazet@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, socketcan@hartkopp.net
Subject: Re: [PATCH] Generalize socket rx gap / receive queue overflow cmsg (v2)
Date: Fri, 09 Oct 2009 23:31:26 +0200 [thread overview]
Message-ID: <4ACFABAE.5050003@gmail.com> (raw)
In-Reply-To: <20091009193515.GA28196@hmsreliant.think-freely.org>
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)
next prev parent reply other threads:[~2009-10-09 21:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-07 18:08 [PATCH] Generalize socket rx gap / receive queue overflow cmsg Neil Horman
2009-10-08 1:05 ` Eric Dumazet
2009-10-08 13:54 ` Neil Horman
2009-10-08 14:45 ` Eric Dumazet
2009-10-08 17:20 ` Neil Horman
2009-10-09 19:35 ` [PATCH] Generalize socket rx gap / receive queue overflow cmsg (v2) Neil Horman
2009-10-09 21:31 ` Eric Dumazet [this message]
2009-10-09 23:21 ` Neil Horman
2009-10-09 23:56 ` [PATCH] Generalize socket rx gap / receive queue overflow cmsg (v3) Neil Horman
2009-10-10 4:59 ` Eric Dumazet
2009-10-10 5:12 ` Eric Dumazet
2009-10-10 12:35 ` [PATCH] Generalize socket rx gap / receive queue overflow cmsg (v4) Neil Horman
2009-10-12 4:38 ` Eric Dumazet
2009-10-12 5:48 ` Oliver Hartkopp
2009-10-12 10:01 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ACFABAE.5050003@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=socketcan@hartkopp.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).