From: Oliver Hartkopp <oliver@hartkopp.net>
To: Octavian Purdila <opurdila@ixiacom.com>,
Patrick Ohly <patrick.ohly@intel.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: hardware time stamping with extra skb->hwtstamp
Date: Fri, 28 Nov 2008 16:38:16 +0100 [thread overview]
Message-ID: <49301068.8090401@hartkopp.net> (raw)
In-Reply-To: <200811281455.32744.opurdila@ixiacom.com>
Octavian Purdila wrote:
> From: Oliver Hartkopp <oliver@hartkopp.net>
> Date: Thu, 27 Nov 2008 23:13:08 +0100
>
>
>>> How about this twist: we add a new option at the socket level, to get the
>>> whole skb->head - skb->end data into a user buffer. Then, we call an
>>> device ioctl and pass this buffer. The device will extract the hw
>>> timestamp and give it to the user.
>>>
>>> We might not need to get the whole skb->head - skb->end buffer, maybe
>>> just skb->head - skb->mac if we know that skb->mac is sane at the socket
>>> level and we use the convention that the device driver must put the
>>> timestamp below the mac header.
>>>
>>> One potential problem I see with this approach is leaking sensitive
>>> information into userspace, which means we will have to restrict this to
>>> privileged processes only.
>>>
>> Ugh.
>>
>> Not every protocol that uses skbuffs, has a mac header (e.g. the CAN
>> protocol doesn't have mac addresses).
>>
>
> OK, then what about this: we use a device ioctl to get the number of bytes to
> copy from skb->head. We then pass this to the socket level option.
>
> This is more complicated than option 3 or 4, but it should address the
> concerns raised here - no performance impact when not using this feature. The
> trade-off is moving work from core kernel into userspace and device driver.
>
>
>> This twist does not look very maintainable to me ...
>>
>
> Could you elaborate on the maintainability issues, they are not clear to me.
>
Do you know what all the people are doing with skbuffs in the kernel?
I'm not aware of it.
So whenever we touch a vital data structure like the skbuff we must be
sure that our handling is a wise approach for all.
Btw. your answer brought me to a completely different approach:
What about just creating a new pointer in the struct skbuff that points
to a struct hwstamp when it is available OR the pointer is NULL when no
hwstamps are available.
This struct hwstamp may consist of 'everthing we really need for
timestamping' and is added somewhere at the head or the tail of the
skbuff data section by the device driver.
And if the socket sees this pointer to be not NULL it knows where to
look for our fancy struct hwstamp ...
I don't know, where this hwstamp data could be pasted into the data
section in the best way - but surely others know. Especially this
approach meets the requirement that the additional hwstamp data is only
allocated (per interface!), when it's really needed - and not for
everyone by default.
What do you thing about this idea?
Regards,
Oliver
next prev parent reply other threads:[~2008-11-28 15:38 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 12:08 hardware time stamping with extra skb->hwtstamp Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 01/11] put_cmsg_compat + SO_TIMESTAMP[NS]: use same name for value as caller Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 02/11] net: new user space API for time stamping of incoming and outgoing packets Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 03/11] net: infrastructure for hardware time stamping Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 04/11] net: socket infrastructure for SO_TIMESTAMPING Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 05/11] ip: support for TX timestamps on UDP and RAW sockets Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 06/11] net: pass new SIOCSHWTSTAMP through to device drivers Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 07/11] igb: stub support for SIOCSHWTSTAMP Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 08/11] clocksource: allow usage independent of timekeeping.c Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 09/11] igb: infrastructure for hardware time stamping Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 10/11] time sync: generic infrastructure to map between time stamps generated by a clock source and system time Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 11/11] igb: use clocksync to implement hardware time stamping Patrick Ohly
2008-11-20 1:14 ` [RFC PATCH 10/11] time sync: generic infrastructure to map between time stamps generated by a clock source and system time Andrew Morton
2008-11-20 7:08 ` Ohly, Patrick
2008-12-05 21:05 ` [RFC PATCH 08/11] clocksource: allow usage independent of timekeeping.c john stultz
2008-12-11 12:11 ` Patrick Ohly
2008-12-11 22:23 ` john stultz
2008-12-12 8:50 ` Patrick Ohly
2008-11-19 15:21 ` [RFC PATCH 03/11] net: infrastructure for hardware time stamping Patrick Ohly
2008-11-27 6:14 ` hardware time stamping with extra skb->hwtstamp Oliver Hartkopp
2008-11-27 10:07 ` Patrick Ohly
2008-11-27 14:02 ` Octavian Purdila
2008-11-27 15:31 ` Patrick Ohly
2008-11-27 18:53 ` Octavian Purdila
2008-11-27 22:13 ` Oliver Hartkopp
2008-11-28 12:55 ` Octavian Purdila
2008-11-28 15:38 ` Oliver Hartkopp [this message]
2008-11-28 16:00 ` Octavian Purdila
2008-12-01 10:37 ` Patrick Ohly
2008-12-01 16:31 ` Patrick Ohly
2008-12-01 16:45 ` Oliver Hartkopp
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=49301068.8090401@hartkopp.net \
--to=oliver@hartkopp.net \
--cc=netdev@vger.kernel.org \
--cc=opurdila@ixiacom.com \
--cc=patrick.ohly@intel.com \
/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).