netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Warkentin <andrey.warkentin@gmail.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kgdb-bugreport@lists.sourceforge.net,
	Matt Mackall <mpm@selenic.com>,
	Andrei Warkentin <andreiw@vmware.com>,
	Andrei Warkentin <andrey.warkentin@gmail.com>,
	Jason Wessel <jason.wessel@windriver.com>
Subject: [PATCHv3 1/3] NETPOLL: Extend rx_hook support.
Date: Sun, 26 Feb 2012 22:30:09 -0500	[thread overview]
Message-ID: <1330313411-845-2-git-send-email-andrey.warkentin@gmail.com> (raw)
In-Reply-To: <1330313411-845-1-git-send-email-andrey.warkentin@gmail.com>

From: Andrei Warkentin <andreiw@vmware.com>

Pass down source information to rx_hook, useful
for accepting connections from unspecified clients.

Cc: kgdb-bugreport@lists.sourceforge.net
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com>
Signed-off-by: Andrei Warkentin <andreiw@vmware.com>
---
 include/linux/netpoll.h |   10 +++++++++-
 net/core/netpoll.c      |   10 ++++------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 5dfa091..9a9cfa1 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -11,12 +11,19 @@
 #include <linux/interrupt.h>
 #include <linux/rcupdate.h>
 #include <linux/list.h>
+#include <linux/if_ether.h>
+#include <net/tcp.h>
+#include <net/udp.h>
 
 struct netpoll {
 	struct net_device *dev;
 	char dev_name[IFNAMSIZ];
 	const char *name;
-	void (*rx_hook)(struct netpoll *, int, char *, int);
+	void (*rx_hook)(struct netpoll *,
+			u8 *h_source,
+			__be32 saddr,
+			struct udphdr *,
+			char *, int);
 
 	__be32 local_ip, remote_ip;
 	u16 local_port, remote_port;
@@ -40,6 +47,7 @@ struct netpoll_info {
 	struct netpoll *netpoll;
 };
 
+void netpoll_poll_dev(struct net_device *dev);
 void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
 void netpoll_print_options(struct netpoll *np);
 int netpoll_parse_options(struct netpoll *np, char *opt);
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 3d84fb9..c182bb2 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -26,8 +26,6 @@
 #include <linux/workqueue.h>
 #include <linux/slab.h>
 #include <linux/export.h>
-#include <net/tcp.h>
-#include <net/udp.h>
 #include <asm/unaligned.h>
 #include <trace/events/napi.h>
 
@@ -189,7 +187,7 @@ static void service_arp_queue(struct netpoll_info *npi)
 	}
 }
 
-static void netpoll_poll_dev(struct net_device *dev)
+void netpoll_poll_dev(struct net_device *dev)
 {
 	const struct net_device_ops *ops;
 
@@ -615,9 +613,9 @@ int __netpoll_rx(struct sk_buff *skb)
 		if (np->local_port && np->local_port != ntohs(uh->dest))
 			continue;
 
-		np->rx_hook(np, ntohs(uh->source),
-			       (char *)(uh+1),
-			       ulen - sizeof(struct udphdr));
+		np->rx_hook(np, eth_hdr(skb)->h_source,
+			    iph->saddr, uh, (char *)(uh+1),
+			    ulen - sizeof(struct udphdr));
 		hits++;
 	}
 
-- 
1.7.8.3


------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2

  reply	other threads:[~2012-02-27  3:30 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-25  2:44 NetKGDB suport Andrei Warkentin
2012-02-25  2:44 ` [PATCH 1/2] NETPOLL: Extend rx_hook support Andrei Warkentin
2012-02-25  2:44 ` [PATCH 2/2] NETKGDB: Ethernet/UDP/IP KDB transport Andrei Warkentin
2012-02-27  2:05 ` NetKGDB support v2 Andrei Warkentin
2012-02-27  2:05   ` [PATCHv2 1/2] NETPOLL: Extend rx_hook support Andrei Warkentin
2012-02-27  2:05   ` [PATCHv2 2/2] NETKGDB: Ethernet/UDP/IP KDB transport Andrei Warkentin
2012-02-27  3:30 ` NetKGDB v3 Andrei Warkentin
2012-02-27  3:30   ` Andrei Warkentin [this message]
2012-02-27 23:17     ` [PATCHv3 1/3] NETPOLL: Extend rx_hook support Jason Wessel
2012-02-27 23:33       ` Andrei Warkentin
2012-02-28 16:06         ` Jason Wessel
2012-02-28 17:43           ` Andrei Warkentin
2012-03-01 21:04             ` Andrei Warkentin
2012-03-01 22:24               ` Jason Wessel
2012-03-01 23:41                 ` Andrei Warkentin
2012-02-27  3:30   ` [PATCHv3 2/3] NETKGDB: Ethernet/UDP/IP KDB transport Andrei Warkentin
2012-02-27  5:29     ` Valdis.Kletnieks
2012-02-27  5:36       ` Andrei Warkentin
2012-02-27  3:30   ` [PATCHv3 3/3] KGDB: Allow registering multiple I/O ops Andrei Warkentin
2012-02-27  4:38   ` NetKGDB v3 David Miller
2012-02-27  4:43     ` Andrei E. Warkentin
2012-02-28  0:04   ` Stephen Hemminger

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=1330313411-845-2-git-send-email-andrey.warkentin@gmail.com \
    --to=andrey.warkentin@gmail.com \
    --cc=andreiw@vmware.com \
    --cc=jason.wessel@windriver.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --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).