Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
8fb9cf8a
Commit
8fb9cf8a
authored
Jan 10, 2004
by
Matt Mackall
Committed by
Stephen Hemminger
Jan 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET] add netpoll API
parent
4576b4fa
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
721 additions
and
0 deletions
+721
-0
include/linux/netdevice.h
include/linux/netdevice.h
+17
-0
include/linux/netpoll.h
include/linux/netpoll.h
+38
-0
net/Kconfig
net/Kconfig
+14
-0
net/core/Makefile
net/core/Makefile
+1
-0
net/core/dev.c
net/core/dev.c
+15
-0
net/core/netpoll.c
net/core/netpoll.c
+636
-0
No files found.
include/linux/netdevice.h
View file @
8fb9cf8a
...
...
@@ -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
);
}
...
...
include/linux/netpoll.h
0 → 100644
View file @
8fb9cf8a
/*
* 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
net/Kconfig
View file @
8fb9cf8a
...
...
@@ -664,4 +664,18 @@ source "net/irda/Kconfig"
source "net/bluetooth/Kconfig"
config NETPOLL
bool "Netpoll API"
config NETPOLL_RX
bool "Netpoll receive hooks"
depends on NETPOLL
config NETPOLL_TRAP
bool "Netpoll traffic trapping"
depends on NETPOLL
config NET_POLL_CONTROLLER
def_bool NETPOLL
endmenu
net/core/Makefile
View file @
8fb9cf8a
...
...
@@ -13,3 +13,4 @@ obj-$(CONFIG_NETFILTER) += netfilter.o
obj-$(CONFIG_NET_DIVERT)
+=
dv.o
obj-$(CONFIG_NET_PKTGEN)
+=
pktgen.o
obj-$(CONFIG_NET_RADIO)
+=
wireless.o
obj-$(CONFIG_NETPOLL)
+=
netpoll.o
net/core/dev.c
View file @
8fb9cf8a
...
...
@@ -105,6 +105,7 @@
#include <linux/kmod.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/netpoll.h>
#ifdef CONFIG_NET_RADIO
#include <linux/wireless.h>
/* Note : will define WIRELESS_EXT */
#include <net/iw_handler.h>
...
...
@@ -1405,6 +1406,13 @@ int netif_rx(struct sk_buff *skb)
struct
softnet_data
*
queue
;
unsigned
long
flags
;
#ifdef CONFIG_NETPOLL_RX
if
(
skb
->
dev
->
netpoll_rx
&&
netpoll_rx
(
skb
))
{
kfree_skb
(
skb
);
return
NET_RX_DROP
;
}
#endif
if
(
!
skb
->
stamp
.
tv_sec
)
do_gettimeofday
(
&
skb
->
stamp
);
...
...
@@ -1560,6 +1568,13 @@ int netif_receive_skb(struct sk_buff *skb)
int
ret
=
NET_RX_DROP
;
unsigned
short
type
=
skb
->
protocol
;
#ifdef CONFIG_NETPOLL_RX
if
(
skb
->
dev
->
netpoll_rx
&&
skb
->
dev
->
poll
&&
netpoll_rx
(
skb
))
{
kfree_skb
(
skb
);
return
NET_RX_DROP
;
}
#endif
if
(
!
skb
->
stamp
.
tv_sec
)
do_gettimeofday
(
&
skb
->
stamp
);
...
...
net/core/netpoll.c
0 → 100644
View file @
8fb9cf8a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment