Blame view
include/linux/netpoll.h
2.69 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c Linux-2.6.12-rc2 |
2 3 4 5 6 7 8 9 10 11 12 |
/* * 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> |
53fb95d3c [NETPOLL]: fix in... |
13 |
#include <linux/rcupdate.h> |
1da177e4c Linux-2.6.12-rc2 |
14 |
#include <linux/list.h> |
433cea4d9 net: convert netp... |
15 |
#include <linux/refcount.h> |
1da177e4c Linux-2.6.12-rc2 |
16 |
|
b7394d242 netpoll: prepare ... |
17 18 19 20 21 22 23 |
union inet_addr { __u32 all[4]; __be32 ip; __be32 ip6[4]; struct in_addr in; struct in6_addr in6; }; |
1da177e4c Linux-2.6.12-rc2 |
24 25 |
struct netpoll { struct net_device *dev; |
bf6bce71e netpoll header cl... |
26 27 |
char dev_name[IFNAMSIZ]; const char *name; |
5de4a473b netpoll queue cle... |
28 |
|
b7394d242 netpoll: prepare ... |
29 30 |
union inet_addr local_ip, remote_ip; bool ipv6; |
1da177e4c Linux-2.6.12-rc2 |
31 |
u16 local_port, remote_port; |
095386416 [NETPOLL]: no nee... |
32 |
u8 remote_mac[ETH_ALEN]; |
508e14b4a netpoll: allow ex... |
33 |
|
2cde6acd4 netpoll: Fix __ne... |
34 |
struct work_struct cleanup_work; |
115c1d6e6 [NETPOLL]: Introd... |
35 36 37 |
}; struct netpoll_info { |
433cea4d9 net: convert netp... |
38 |
refcount_t refcnt; |
508e14b4a netpoll: allow ex... |
39 |
|
bd7c4b604 netpoll: convert ... |
40 |
struct semaphore dev_lock; |
508e14b4a netpoll: allow ex... |
41 |
|
b6cd27ed3 netpoll per devic... |
42 |
struct sk_buff_head txq; |
508e14b4a netpoll: allow ex... |
43 |
|
6d5aefb8e WorkQueue: Fix up... |
44 |
struct delayed_work tx_work; |
0e34e9317 netpoll: add gene... |
45 46 |
struct netpoll *netpoll; |
38e6bc185 netpoll: make __n... |
47 |
struct rcu_head rcu; |
1da177e4c Linux-2.6.12-rc2 |
48 |
}; |
ca99ca14c netpoll: protect ... |
49 |
#ifdef CONFIG_NETPOLL |
66b5552fc netpoll: Rename n... |
50 51 |
extern void netpoll_poll_disable(struct net_device *dev); extern void netpoll_poll_enable(struct net_device *dev); |
ca99ca14c netpoll: protect ... |
52 |
#else |
66b5552fc netpoll: Rename n... |
53 54 |
static inline void netpoll_poll_disable(struct net_device *dev) { return; } static inline void netpoll_poll_enable(struct net_device *dev) { return; } |
ca99ca14c netpoll: protect ... |
55 |
#endif |
1da177e4c Linux-2.6.12-rc2 |
56 |
void netpoll_send_udp(struct netpoll *np, const char *msg, int len); |
0bcc18161 [NET] netconsole:... |
57 |
void netpoll_print_options(struct netpoll *np); |
1da177e4c Linux-2.6.12-rc2 |
58 |
int netpoll_parse_options(struct netpoll *np, char *opt); |
a8779ec1c netpoll: Remove g... |
59 |
int __netpoll_setup(struct netpoll *np, struct net_device *ndev); |
1da177e4c Linux-2.6.12-rc2 |
60 |
int netpoll_setup(struct netpoll *np); |
8fdd95ec1 netpoll: Allow ne... |
61 |
void __netpoll_cleanup(struct netpoll *np); |
2cde6acd4 netpoll: Fix __ne... |
62 |
void __netpoll_free_async(struct netpoll *np); |
1da177e4c Linux-2.6.12-rc2 |
63 |
void netpoll_cleanup(struct netpoll *np); |
c2355e1ab bonding: Fix bond... |
64 65 66 67 |
void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb, struct net_device *dev); static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb) { |
2899656b4 netpoll: take rcu... |
68 69 |
unsigned long flags; local_irq_save(flags); |
c2355e1ab bonding: Fix bond... |
70 |
netpoll_send_skb_on_dev(np, skb, np->dev); |
2899656b4 netpoll: take rcu... |
71 |
local_irq_restore(flags); |
c2355e1ab bonding: Fix bond... |
72 |
} |
e1bd4d3d7 netpoll: Move all... |
73 |
#ifdef CONFIG_NETPOLL |
bea3348ee [NET]: Make NAPI ... |
74 75 76 |
static inline void *netpoll_poll_lock(struct napi_struct *napi) { struct net_device *dev = napi->dev; |
bea3348ee [NET]: Make NAPI ... |
77 |
if (dev && dev->npinfo) { |
89c4b442b netpoll: more eff... |
78 79 80 81 |
int owner = smp_processor_id(); while (cmpxchg(&napi->poll_owner, -1, owner) != -1) cpu_relax(); |
bea3348ee [NET]: Make NAPI ... |
82 |
return napi; |
1da177e4c Linux-2.6.12-rc2 |
83 |
} |
53fb95d3c [NETPOLL]: fix in... |
84 |
return NULL; |
1da177e4c Linux-2.6.12-rc2 |
85 |
} |
53fb95d3c [NETPOLL]: fix in... |
86 |
static inline void netpoll_poll_unlock(void *have) |
1da177e4c Linux-2.6.12-rc2 |
87 |
{ |
bea3348ee [NET]: Make NAPI ... |
88 |
struct napi_struct *napi = have; |
53fb95d3c [NETPOLL]: fix in... |
89 |
|
89c4b442b netpoll: more eff... |
90 91 |
if (napi) smp_store_release(&napi->poll_owner, -1); |
1da177e4c Linux-2.6.12-rc2 |
92 |
} |
77ab8a54d netpoll: convert ... |
93 |
static inline bool netpoll_tx_running(struct net_device *dev) |
c18370f5b netpoll: Add netp... |
94 95 96 |
{ return irqs_disabled(); } |
1da177e4c Linux-2.6.12-rc2 |
97 |
#else |
bea3348ee [NET]: Make NAPI ... |
98 99 100 101 102 103 104 105 106 107 |
static inline void *netpoll_poll_lock(struct napi_struct *napi) { return NULL; } static inline void netpoll_poll_unlock(void *have) { } static inline void netpoll_netdev_init(struct net_device *dev) { } |
77ab8a54d netpoll: convert ... |
108 |
static inline bool netpoll_tx_running(struct net_device *dev) |
c18370f5b netpoll: Add netp... |
109 |
{ |
77ab8a54d netpoll: convert ... |
110 |
return false; |
c18370f5b netpoll: Add netp... |
111 |
} |
1da177e4c Linux-2.6.12-rc2 |
112 113 114 |
#endif #endif |