[etherlab-users] Running on non-8139 NIC's
Anders Blomdell
anders.blomdell at control.lth.se
Mon Mar 19 16:34:31 CET 2007
Hi,
Is there any simple way to run etehrlab with a non 8139 NIC? Trying the
following hack with a spare e1000 NIC fails (not surprisingly) on a segfault in
e1000_xmit_frame, called from ec_device_send+0x50. Question, is there any simple
way to compile a (non-realtime) master that binds to an arbitrary net_device (ethX)?
Regards
Anders Blomdell
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include "ecdev.h"
static char *wrap;
module_param(wrap, charp, 0);
static ec_device_t *ec_dev = NULL;
static struct net_device *wrap_dev = NULL;
static void ethXwrap_cleanup_module(void);
static void ec_poll(struct net_device *dev)
{
//printk("%s\n", __FUNCTION__);
}
static int __init ethXwrap_init_module(void)
{
int result = 0;
struct net_device *true_dev = 0;
if (result != 0 || !wrap) {
result = -1;
} else {
true_dev = dev_get_by_name(wrap);
}
if (result != 0 || !true_dev) {
result = -1;
} else {
ec_dev = ecdev_register(0, true_dev, ec_poll, THIS_MODULE);
ecdev_link_state(ec_dev, 1);
printk("Wrapped '%s' for EtherCAT\n", wrap);
}
if (result) {
ethXwrap_cleanup_module();
}
return result;
}
static void __exit ethXwrap_cleanup_module(void)
{
printk("%s\n", __FUNCTION__);
if (ec_dev) {
ecdev_link_state(ec_dev, 0);
ecdev_unregister(0, ec_dev);
printk("Unwrapped '%s' for EtherCAT\n", wrap);
}
}
module_init(ethXwrap_init_module);
module_exit(ethXwrap_cleanup_module);
More information about the Etherlab-users
mailing list