All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: [PATCH 2.6 5/9]: Move rx timestamp functions to net/core/dev.c
Date: Mon, 15 Nov 2004 22:44:50 +0100	[thread overview]
Message-ID: <41992352.3070607@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

This patch moves the rx timestamp functions to net/core/dev.c.
This is necessary for the next patch: ip_queue needs to enable
timestamps while packets are received by it.



[-- Attachment #2: 05.diff --]
[-- Type: text/x-patch, Size: 4029 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/13 13:27:50+01:00 kaber@coreworks.de 
#   [NET]: Move rx timestamp functions to net/core/dev.c
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/core/sock.c
#   2004/11/13 13:27:44+01:00 kaber@coreworks.de +2 -5
#   [NET]: Move rx timestamp functions to net/core/dev.c
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/core/dev.c
#   2004/11/13 13:27:43+01:00 kaber@coreworks.de +25 -0
#   [NET]: Move rx timestamp functions to net/core/dev.c
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# include/net/sock.h
#   2004/11/13 13:27:43+01:00 kaber@coreworks.de +0 -12
#   [NET]: Move rx timestamp functions to net/core/dev.c
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# include/linux/netdevice.h
#   2004/11/13 13:27:43+01:00 kaber@coreworks.de +3 -0
#   [NET]: Move rx timestamp functions to net/core/dev.c
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h	2004-11-15 22:07:09 +01:00
+++ b/include/linux/netdevice.h	2004-11-15 22:07:09 +01:00
@@ -928,6 +928,9 @@
 extern atomic_t netdev_dropping;
 extern int		netdev_set_master(struct net_device *dev, struct net_device *master);
 extern int skb_checksum_help(struct sk_buff *skb, int inward);
+/* rx skb timestamps */
+extern void		net_enable_timestamp(void);
+extern void		net_disable_timestamp(void);
 
 #ifdef CONFIG_SYSCTL
 extern char *net_sysctl_strdup(const char *s);
diff -Nru a/include/net/sock.h b/include/net/sock.h
--- a/include/net/sock.h	2004-11-15 22:07:09 +01:00
+++ b/include/net/sock.h	2004-11-15 22:07:09 +01:00
@@ -1270,19 +1270,7 @@
 	__kfree_skb(skb);
 }
 
-extern atomic_t netstamp_needed;
 extern void sock_enable_timestamp(struct sock *sk);
-
-static inline void net_timestamp(struct timeval *stamp) 
-{ 
-	if (atomic_read(&netstamp_needed)) 
-		do_gettimeofday(stamp);
-	else {
-		stamp->tv_sec = 0;
-		stamp->tv_usec = 0;
-	}		
-} 
-
 extern int sock_get_timestamp(struct sock *, struct timeval __user *);
 
 /* 
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c	2004-11-15 22:07:09 +01:00
+++ b/net/core/dev.c	2004-11-15 22:07:09 +01:00
@@ -1001,6 +1001,29 @@
 	return notifier_call_chain(&netdev_chain, val, v);
 }
 
+/* When > 0 there are consumers of rx skb time stamps */
+static atomic_t netstamp_needed = ATOMIC_INIT(0);
+
+void net_enable_timestamp(void)
+{
+	atomic_inc(&netstamp_needed);
+}
+
+void net_disable_timestamp(void)
+{
+	atomic_dec(&netstamp_needed);
+}
+
+static inline void net_timestamp(struct timeval *stamp)
+{
+	if (atomic_read(&netstamp_needed))
+		do_gettimeofday(stamp);
+	else {
+		stamp->tv_sec = 0;
+		stamp->tv_usec = 0;
+	}
+}
+
 /*
  *	Support routine. Sends outgoing frames to any network
  *	taps currently in use.
@@ -3215,6 +3238,8 @@
 EXPORT_SYMBOL(synchronize_net);
 EXPORT_SYMBOL(unregister_netdevice);
 EXPORT_SYMBOL(unregister_netdevice_notifier);
+EXPORT_SYMBOL(net_enable_timestamp);
+EXPORT_SYMBOL(net_disable_timestamp);
 
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
 EXPORT_SYMBOL(br_handle_frame_hook);
diff -Nru a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c	2004-11-15 22:07:09 +01:00
+++ b/net/core/sock.c	2004-11-15 22:07:09 +01:00
@@ -179,7 +179,7 @@
 {	
 	if (sock_flag(sk, SOCK_TIMESTAMP)) { 
 		sock_reset_flag(sk, SOCK_TIMESTAMP);
-		atomic_dec(&netstamp_needed);
+		net_disable_timestamp();
 	}
 }
 
@@ -1226,9 +1226,6 @@
 }
 EXPORT_SYMBOL(release_sock);
 
-/* When > 0 there are consumers of rx skb time stamps */
-atomic_t netstamp_needed = ATOMIC_INIT(0); 
-
 int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
 { 
 	if (!sock_flag(sk, SOCK_TIMESTAMP))
@@ -1246,7 +1243,7 @@
 {	
 	if (!sock_flag(sk, SOCK_TIMESTAMP)) { 
 		sock_set_flag(sk, SOCK_TIMESTAMP);
-		atomic_inc(&netstamp_needed);
+		net_enable_timestamp();
 	}
 }
 EXPORT_SYMBOL(sock_enable_timestamp); 

                 reply	other threads:[~2004-11-15 21:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=41992352.3070607@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.