My network device don't work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.
I write simple network device, but its don't work. Module is loading, loading, loading...
Code:

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/string.h>
#define DEV_NAME "chwdp"

struct net_device my_netdev;

int init_my_net_dev(struct net_device *dev);

struct net_device_ops nops = {
  .ndo_init = init_my_net_dev,
  //.ndo_uninit = uninit_my_net_dev,
};

static int __init init_dev(void)
{
  //my_netdev.netdev_ops = &nops;
  int result;
  if((netdev_boot_setup_check(&my_netdev))){
    printk(KERN_ERR "NETDEV: setup error");
    return 0;
  }
  strncpy(my_netdev.name, DEV_NAME, 5);
  if((result = register_netdev(&my_netdev)))
    printk(KERN_ERR "NETDEV: Error registering device");
  printk("NETDEV: Device registered successfully");
  return 0;
}

static void __exit remove_dev(void)
{
  unregister_netdev(&my_netdev);
}
int init_my_net_dev(struct net_device *dev)
{
  printk("INIT");
  return 0;
}
module_init(init_dev);
module_exit(remove_dev);


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux