diff options
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r-- | drivers/net/netconsole.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 75cb76139ddc..be15ca6205a8 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c | |||
@@ -62,24 +62,35 @@ static int __init option_setup(char *opt) | |||
62 | __setup("netconsole=", option_setup); | 62 | __setup("netconsole=", option_setup); |
63 | #endif /* MODULE */ | 63 | #endif /* MODULE */ |
64 | 64 | ||
65 | static struct netpoll np = { | 65 | /** |
66 | .name = "netconsole", | 66 | * struct netconsole_target - Represents a configured netconsole target. |
67 | .dev_name = "eth0", | 67 | * @np: The netpoll structure for this target. |
68 | .local_port = 6665, | 68 | */ |
69 | .remote_port = 6666, | 69 | struct netconsole_target { |
70 | .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, | 70 | struct netpoll np; |
71 | }; | ||
72 | |||
73 | static struct netconsole_target default_target = { | ||
74 | .np = { | ||
75 | .name = "netconsole", | ||
76 | .dev_name = "eth0", | ||
77 | .local_port = 6665, | ||
78 | .remote_port = 6666, | ||
79 | .remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, | ||
80 | }, | ||
71 | }; | 81 | }; |
72 | 82 | ||
73 | static void write_msg(struct console *con, const char *msg, unsigned int len) | 83 | static void write_msg(struct console *con, const char *msg, unsigned int len) |
74 | { | 84 | { |
75 | int frag, left; | 85 | int frag, left; |
76 | unsigned long flags; | 86 | unsigned long flags; |
87 | struct netconsole_target *nt = &default_target; | ||
77 | 88 | ||
78 | if (netif_running(np.dev)) { | 89 | if (netif_running(nt->np.dev)) { |
79 | local_irq_save(flags); | 90 | local_irq_save(flags); |
80 | for (left = len; left;) { | 91 | for (left = len; left;) { |
81 | frag = min(left, MAX_PRINT_CHUNK); | 92 | frag = min(left, MAX_PRINT_CHUNK); |
82 | netpoll_send_udp(&np, msg, frag); | 93 | netpoll_send_udp(&nt->np, msg, frag); |
83 | msg += frag; | 94 | msg += frag; |
84 | left -= frag; | 95 | left -= frag; |
85 | } | 96 | } |
@@ -96,17 +107,18 @@ static struct console netconsole = { | |||
96 | static int __init init_netconsole(void) | 107 | static int __init init_netconsole(void) |
97 | { | 108 | { |
98 | int err = 0; | 109 | int err = 0; |
110 | struct netconsole_target *nt = &default_target; | ||
99 | 111 | ||
100 | if (!strnlen(config, MAX_PARAM_LENGTH)) { | 112 | if (!strnlen(config, MAX_PARAM_LENGTH)) { |
101 | printk(KERN_INFO "netconsole: not configured, aborting\n"); | 113 | printk(KERN_INFO "netconsole: not configured, aborting\n"); |
102 | goto out; | 114 | goto out; |
103 | } | 115 | } |
104 | 116 | ||
105 | err = netpoll_parse_options(&np, config); | 117 | err = netpoll_parse_options(&nt->np, config); |
106 | if (err) | 118 | if (err) |
107 | goto out; | 119 | goto out; |
108 | 120 | ||
109 | err = netpoll_setup(&np); | 121 | err = netpoll_setup(&nt->np); |
110 | if (err) | 122 | if (err) |
111 | goto out; | 123 | goto out; |
112 | 124 | ||
@@ -119,8 +131,10 @@ out: | |||
119 | 131 | ||
120 | static void __exit cleanup_netconsole(void) | 132 | static void __exit cleanup_netconsole(void) |
121 | { | 133 | { |
134 | struct netconsole_target *nt = &default_target; | ||
135 | |||
122 | unregister_console(&netconsole); | 136 | unregister_console(&netconsole); |
123 | netpoll_cleanup(&np); | 137 | netpoll_cleanup(&nt->np); |
124 | } | 138 | } |
125 | 139 | ||
126 | module_init(init_netconsole); | 140 | module_init(init_netconsole); |