summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMatt Mackall <mpm@selenic.com>2004-01-10 04:45:17 -0500
committerStephen Hemminger <shemminger@osdl.org>2004-01-10 04:45:17 -0500
commit8fb9cf8ab6c0ccb1b17b32c05dc9da3cc96ac229 (patch)
treeb50929ef8f50649d0988230485e92eb319bee1cc /include/linux
parent4576b4fa6948c61818252abc141758967d2447c9 (diff)
[NET] add netpoll API
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h17
-rw-r--r--include/linux/netpoll.h38
2 files changed, 55 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 666d89f875f5..023d0c543b1c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -452,6 +452,12 @@ struct net_device
unsigned char *haddr);
int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
int (*accept_fastpath)(struct net_device *, struct dst_entry*);
+#ifdef CONFIG_NETPOLL_RX
+ int netpoll_rx;
+#endif
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ void (*poll_controller)(struct net_device *dev);
+#endif
/* bridge stuff */
struct net_bridge_port *br_port;
@@ -533,6 +539,9 @@ extern int dev_new_index(void);
extern struct net_device *dev_get_by_index(int ifindex);
extern struct net_device *__dev_get_by_index(int ifindex);
extern int dev_restart(struct net_device *dev);
+#ifdef CONFIG_NETPOLL_TRAP
+extern int netpoll_trap(void);
+#endif
typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len);
extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf);
@@ -591,12 +600,20 @@ static inline void netif_start_queue(struct net_device *dev)
static inline void netif_wake_queue(struct net_device *dev)
{
+#ifdef CONFIG_NETPOLL_TRAP
+ if (netpoll_trap())
+ return;
+#endif
if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state))
__netif_schedule(dev);
}
static inline void netif_stop_queue(struct net_device *dev)
{
+#ifdef CONFIG_NETPOLL_TRAP
+ if (netpoll_trap())
+ return;
+#endif
set_bit(__LINK_STATE_XOFF, &dev->state);
}
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
new file mode 100644
index 000000000000..965ce83bfbc3
--- /dev/null
+++ b/include/linux/netpoll.h
@@ -0,0 +1,38 @@
+/*
+ * Common code for low-level network console, dump, and debugger code
+ *
+ * Derived from netconsole, kgdb-over-ethernet, and netdump patches
+ */
+
+#ifndef _LINUX_NETPOLL_H
+#define _LINUX_NETPOLL_H
+
+#include <linux/netdevice.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/list.h>
+
+struct netpoll;
+
+struct netpoll {
+ struct net_device *dev;
+ char dev_name[16], *name;
+ void (*rx_hook)(struct netpoll *, int, char *, int);
+ u32 local_ip, remote_ip;
+ u16 local_port, remote_port;
+ unsigned char local_mac[6], remote_mac[6];
+ struct list_head rx_list;
+};
+
+void netpoll_poll(struct netpoll *np);
+void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
+void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
+int netpoll_parse_options(struct netpoll *np, char *opt);
+int netpoll_setup(struct netpoll *np);
+int netpoll_trap(void);
+void netpoll_set_trap(int trap);
+void netpoll_cleanup(struct netpoll *np);
+int netpoll_rx(struct sk_buff *skb);
+
+
+#endif