netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <dborkman@redhat.com>
To: Willem de Bruijn <willemb@google.com>
Cc: Paul Chavent <paul.chavent@onera.fr>,
	Richard Cochran <richardcochran@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	daniel.borkmann@tik.ee.ethz.ch, xemul@parallels.com,
	ebiederm@xmission.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net-packet: tx timestamping on tpacket ring
Date: Sun, 14 Apr 2013 12:52:16 +0200	[thread overview]
Message-ID: <516A8A60.5020003@redhat.com> (raw)
In-Reply-To: <CA+FuTSe1KCPPW=FBXZoTNmri9oPHicuoFeEMKws09PwbyRe-2A@mail.gmail.com>

On 04/14/2013 02:00 AM, Willem de Bruijn wrote:
> On Sat, Apr 13, 2013 at 6:18 PM, Daniel Borkmann <dborkman@redhat.com> wrote:
>> On 04/13/2013 08:56 PM, Willem de Bruijn wrote:
>>>
>>> When transmit timestamping is enabled at the socket level, have
>>> writes to a PACKET_TX_RING record a timestamp for the generated
>>> skbuffs. Tx timestamps are always looped to the application over
>>> the socket error queue.
>>
>>
>> Nitpick: if so, then this should go to net-next (subject line).
>
> Thanks.
>>
>>> The patch also loops software timestamps back into the ring.

Also v2 should probably contain a ``Reported-by''.

>>> Signed-off-by: Willem de Bruijn <willemb@google.com>
>>> ---
>>>    net/core/skbuff.c      |  2 +-
>>>    net/packet/af_packet.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>>>    2 files changed, 43 insertions(+), 1 deletion(-)
>>
>> [...]
>>
>>> +static void __packet_set_timestamp(struct packet_sock *po, void *frame,
>>> +                                  ktime_t tstamp)
>>> +{
>>> +       struct tpacket_hdr *h1;
>>> +       struct tpacket2_hdr *h2;
>>> +       struct timespec ts;
>>> +
>>> +       if (!tstamp.tv64 || !sock_flag(&po->sk,
>>> SOCK_TIMESTAMPING_SOFTWARE))
>>> +               return;

While going a bit more through the code, I'm wondering .. if we want to support
TX timestamps, could we also support SW _and_ HW timestamps e.g. similar as in
sock_recv_timestamp()? I'm asking, because we already allow setting the flags
for it via sock_tx_timestamp(). This might be good, if possible.

Paul, since you've reported / requested this, your use case would be to fill
the ring, trigger a sendto() and then loop through all the frames to check the
tx timestamps for your custom protocol mockup, then fill the returned frames
again, etc.?

>>> +       ts = ktime_to_timespec(tstamp);
>>> +
>>> +       switch (po->tp_version) {
>>> +       case TPACKET_V1:
>>> +               h1 = frame;
>>> +               h1->tp_sec = ts.tv_sec;
>>> +               h1->tp_usec = ts.tv_nsec / NSEC_PER_USEC;
>>> +
>>> +               flush_dcache_page(pgv_to_page(&h1->tp_sec));
>>> +               flush_dcache_page(pgv_to_page(&h1->tp_usec));
>>
>>
>> Hmm, not sure, but could we also flush the dcache only once?

  reply	other threads:[~2013-04-14 10:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 15:29 [RFC] net : add tx timestamp to packet mmap Paul Chavent
2012-12-12 19:23 ` David Miller
2012-12-13  7:13   ` Paul Chavent
2012-12-13 13:29 ` Richard Cochran
2012-12-13 16:13   ` Paul Chavent
2012-12-13 18:17     ` Richard Cochran
2012-12-14  7:57       ` Paul Chavent
2013-04-09 10:42       ` Paul Chavent
2013-04-09 13:15         ` Richard Cochran
2013-04-13 18:33     ` Willem de Bruijn
2013-04-13 18:56       ` [PATCH] net-packet: tx timestamping on tpacket ring Willem de Bruijn
2013-04-13 22:18         ` Daniel Borkmann
2013-04-13 22:47           ` David Miller
2013-04-14  0:04             ` Willem de Bruijn
2013-04-14  0:16               ` Willem de Bruijn
2013-04-14  0:49                 ` Willem de Bruijn
2013-04-14  5:16                   ` Daniel Borkmann
2013-04-14  0:00           ` Willem de Bruijn
2013-04-14 10:52             ` Daniel Borkmann [this message]
2013-04-14 13:07               ` Richard Cochran
2013-04-15  7:37                 ` Paul Chavent
2013-04-15 16:56                   ` Richard Cochran
2013-04-15 16:59                   ` Willem de Bruijn
2013-04-17 10:22                     ` Richard Cochran
2013-04-19 21:51                     ` [PATCH net-next v2] packet: " Willem de Bruijn
2013-04-20 12:33                       ` Daniel Borkmann
2013-04-21  2:30                         ` Willem de Bruijn
2013-04-21 10:10                           ` Daniel Borkmann
2013-04-21 16:42                             ` Willem de Bruijn
2013-04-21 18:14                               ` Daniel Borkmann
2013-04-22  8:19                               ` Paul Chavent
2013-04-22 10:25                                 ` Daniel Borkmann
2013-04-22 14:23                                 ` Willem de Bruijn
2013-04-20 16:43                       ` Richard Cochran
2013-04-21  2:34                         ` Willem de Bruijn
2013-04-15 15:41               ` [PATCH] net-packet: " Paul Chavent
2013-04-15  9:45           ` David Laight
2013-04-15 17:08             ` Willem de Bruijn
2013-04-15 17:31             ` David Miller
2013-04-15  7:31         ` Paul Chavent
2013-04-15 16:37           ` Willem de Bruijn

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=516A8A60.5020003@redhat.com \
    --to=dborkman@redhat.com \
    --cc=daniel.borkmann@tik.ee.ethz.ch \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul.chavent@onera.fr \
    --cc=richardcochran@gmail.com \
    --cc=willemb@google.com \
    --cc=xemul@parallels.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).