[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091009232140.GA31403@hmsreliant.think-freely.org>
Date: Fri, 9 Oct 2009 19:21:40 -0400
From: Neil Horman <nhorman@...driver.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, socketcan@...tkopp.net
Subject: Re: [PATCH] Generalize socket rx gap / receive queue overflow cmsg
(v2)
On Fri, Oct 09, 2009 at 11:31:26PM +0200, Eric Dumazet wrote:
> 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.
>
No, I certainly meant both. The defintion clearly handles both the timestamp
cmsg and the drops cmsg. That way we don't need to make two calls in the
receive path for these
>
> > + 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.
>
I don't really see any difference, sock_flag is simply a wrapper around
test_bit. I can change it if you really need, but it just looks like additional
operations to me
> > 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.
>
No. I'm differentiating from sock_recv_timestamp here, as I'm concerned about
the case in which we enqueue to sk_error_queue. For those cases, in which
recvmsg is called with MSG_ERRQUEUE, I don't think its right to apply a cmsg
based on skb->dropcount, since the frame may have been from a tx path, or may
not have had dropcount set in the first place. timestamp is still recorded
there, but I don't think we should mark the dropcount.
> And is it really too large to be inlined ?
>
No, I was just following the style of sock_recv_timestamp.
> 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)
Fine.
--
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