[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ACB1B57.90509@gmail.com>
Date: Tue, 06 Oct 2009 12:26:31 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Oliver Hartkopp <socketcan@...tkopp.net>
CC: Neil Horman <nhorman@...driver.com>,
David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH] af_packet: add interframe drop cmsg (v6)
Oliver Hartkopp a écrit :
>> + gap = check_packet_gap(skb);
>> + if (gap)
>> + put_cmsg(msg, SOL_PACKET, PACKET_GAPDATA, sizeof(__u32), &gap);
>> +
>
> I wonder, if using SOL_PACKET with a packet specific sockopt PACKET_GAPDATA is
> the right approach here, as this functionality should probably be made
> available to all DGRAM/RAW sockets ...
>
> E.g. getting the gap information is also interesting for CAN_RAW sockets as i
> polled from the SocketCAN ML.
>
> So i could easily implement something like this in net/can/raw.c :
>
> gap = check_packet_gap(skb);
> if (gap)
> put_cmsg(msg, SOL_CAN_RAW, CAN_RAW_GAPDATA, sizeof(__u32), &gap);
>
> Is this a good approach or should we better find a general handling within
> SOL_SOCKET here?
>
Given that datagrams are usually lost by network before hitting your socket, I am not sure
it is useful at all.
But yes, we could do the following for free :
Use existing sock->sk_drops total counter, and to store its value at time datagram
is received and stored into socket queue (store sock->sk_drops into skb->mark)
At recv() time, copy this saved value into a CMSG item if user set a given SOL_SOCKET option.
(It would not be a relative gap, but absolute. Your application would have to compute
deltas itself)
--
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