From: Unai Uribarri <unai.uribarri@optenet.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] af_packet: don't enable timestamps in mmap'ed sockets
Date: Thu, 09 Aug 2007 16:21:54 +0200 [thread overview]
Message-ID: <1186669314.24669.56.camel@localhost.localdomain> (raw)
Hello folks,
I've discovered two strange behaviours (bugs?) about timestamp
generation:
1. If a program opens an AF_PACKET socket and setup a reception ring
with setsockopt(sock, SOL_PACKET, PACKET_RX_RING), timestamps are
automatically (re)enabled at the reception of every packet.
2. Setting SOL_SOCKET/SO_TIMESTAMP to 0 doesn't disables timestamp
generation. Every skb continues begin timestamped until you close the
socket that activated it.
Timestamp generation is a heavy task that is consuming more than 50% of
the CPU (using ACPI PM clock) and is currently the bottleneck in my
packet capturing application.
The attached patch removes the automatic timestamp activation, that
only mmap'ed AF_PACKET sockets perform. I known it can break user
applications, but I believe that it's the correct solution.
I will be very pleased to receive any feedback.
Signed-off-by: Unai Uribarri <unai.uribarri@optenet.com>
---
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 1322d62..a4f2da3 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -640,10 +640,6 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
h->tp_snaplen = snaplen;
h->tp_mac = macoff;
h->tp_net = netoff;
- if (skb->tstamp.tv64 == 0) {
- __net_timestamp(skb);
- sock_enable_timestamp(sk);
- }
tv = ktime_to_timeval(skb->tstamp);
h->tp_sec = tv.tv_sec;
h->tp_usec = tv.tv_usec;
next reply other threads:[~2007-08-09 14:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-09 14:21 Unai Uribarri [this message]
2007-08-09 14:33 ` [PATCH 1/1] af_packet: don't enable timestamps in mmap'ed sockets Evgeniy Polyakov
2007-08-09 18:13 ` Unai Uribarri
2007-08-09 18:18 ` Evgeniy Polyakov
2007-08-09 18:44 ` Unai Uribarri
2007-08-10 8:34 ` Evgeniy Polyakov
2007-08-10 11:55 ` Unai Uribarri
2007-08-10 12:14 ` Evgeniy Polyakov
2007-08-09 18:50 ` Unai Uribarri
2007-09-13 10:42 ` [RFC] af_packet: allow disabling timestamps Stephen Hemminger
2007-09-13 12:24 ` Eric Dumazet
2007-09-14 10:26 ` Stephen Hemminger
2007-09-19 9:07 ` Evgeniy Polyakov
2007-09-27 14:08 ` Unai Uribarri
2007-09-27 14:34 ` Unai Uribarri
-- strict thread matches above, loose matches on Subject: below --
2007-08-08 11:50 [PATCH 1/1] af_packet: don't enable timestamps in mmap'ed sockets Unai Uribarri
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=1186669314.24669.56.camel@localhost.localdomain \
--to=unai.uribarri@optenet.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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).