Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66276
b: refs/heads/master
c: df180e3
h: refs/heads/master
v: v3
  • Loading branch information
Satyam Sharma authored and David S. Miller committed Oct 10, 2007
1 parent 6ab94d0 commit 03f61c9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d4ef88b5df1afe097e38aef8cab2ed35ca141ea
refs/heads/master: df180e369cf54a8ef8440667ab1d13d452fc7215
36 changes: 25 additions & 11 deletions trunk/drivers/net/netconsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,35 @@ static int __init option_setup(char *opt)
__setup("netconsole=", option_setup);
#endif /* MODULE */

static struct netpoll np = {
.name = "netconsole",
.dev_name = "eth0",
.local_port = 6665,
.remote_port = 6666,
.remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
/**
* struct netconsole_target - Represents a configured netconsole target.
* @np: The netpoll structure for this target.
*/
struct netconsole_target {
struct netpoll np;
};

static struct netconsole_target default_target = {
.np = {
.name = "netconsole",
.dev_name = "eth0",
.local_port = 6665,
.remote_port = 6666,
.remote_mac = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
},
};

static void write_msg(struct console *con, const char *msg, unsigned int len)
{
int frag, left;
unsigned long flags;
struct netconsole_target *nt = &default_target;

if (netif_running(np.dev)) {
if (netif_running(nt->np.dev)) {
local_irq_save(flags);
for (left = len; left;) {
frag = min(left, MAX_PRINT_CHUNK);
netpoll_send_udp(&np, msg, frag);
netpoll_send_udp(&nt->np, msg, frag);
msg += frag;
left -= frag;
}
Expand All @@ -96,17 +107,18 @@ static struct console netconsole = {
static int __init init_netconsole(void)
{
int err = 0;
struct netconsole_target *nt = &default_target;

if (!strnlen(config, MAX_PARAM_LENGTH)) {
printk(KERN_INFO "netconsole: not configured, aborting\n");
goto out;
}

err = netpoll_parse_options(&np, config);
err = netpoll_parse_options(&nt->np, config);
if (err)
goto out;

err = netpoll_setup(&np);
err = netpoll_setup(&nt->np);
if (err)
goto out;

Expand All @@ -119,8 +131,10 @@ static int __init init_netconsole(void)

static void __exit cleanup_netconsole(void)
{
struct netconsole_target *nt = &default_target;

unregister_console(&netconsole);
netpoll_cleanup(&np);
netpoll_cleanup(&nt->np);
}

module_init(init_netconsole);
Expand Down

0 comments on commit 03f61c9

Please sign in to comment.