And fill it with copied from net_device.
Also make newly created devices be assigned to the
(currently empty) nd_default_ops.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
include/linux/netdevice.h | 39 +++++++++++++++++++++++++++++++++++++++
net/core/dev.c | 9 +++++++++
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8b17ed4..33f00ff 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -447,6 +447,43 @@ static inline void napi_synchronize(const struct napi_struct *n)
* moves out.
*/
+struct net_device_ops {
+ int (*init)(struct net_device *dev);
+ struct net_device_stats* (*get_stats)(struct net_device *dev);
+ int (*hard_start_xmit) (struct sk_buff *skb,
+ struct net_device *dev);
+ void (*uninit)(struct net_device *dev);
+ void (*destructor)(struct net_device *dev);
+ int (*open)(struct net_device *dev);
+ int (*stop)(struct net_device *dev);
+ void (*change_rx_flags)(struct net_device *dev,
+ int flags);
+ void (*set_rx_mode)(struct net_device *dev);
+ void (*set_multicast_list)(struct net_device *dev);
+ int (*set_mac_address)(struct net_device *dev,
+ void *addr);
+ int (*validate_addr)(struct net_device *dev);
+ int (*do_ioctl)(struct net_device *dev,
+ struct ifreq *ifr, int cmd);
+ int (*set_config)(struct net_device *dev,
+ struct ifmap *map);
+ int (*change_mtu)(struct net_device *dev,
+ int new_mtu);
+ void (*tx_timeout) (struct net_device *dev);
+
+ void (*vlan_rx_register)(struct net_device *dev,
+ struct vlan_group *grp);
+ void (*vlan_rx_add_vid)(struct net_device *dev,
+ unsigned short vid);
+ void (*vlan_rx_kill_vid)(struct net_device *dev,
+ unsigned short vid);
+ int (*neigh_setup)(struct net_device *dev,
+ struct neigh_parms *);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+ void (*poll_controller)(struct net_device *dev);
+#endif
+};
+
struct net_device
{
@@ -662,6 +699,8 @@ struct net_device
NETREG_RELEASED, /* called free_netdev */
} reg_state;
+ struct net_device_ops *nd_ops;
+
/* Called after device is detached from network. */
void (*uninit)(struct net_device *dev);
/* Called after last user reference disappears. */
diff --git a/net/core/dev.c b/net/core/dev.c
index 7aa0112..5e7bf79 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3976,6 +3976,13 @@ static struct net_device_stats *internal_stats(struct net_device *dev)
return &dev->stats;
}
+/*
+ * temporary devices operations - to be removed very soon
+ */
+
+static struct net_device_ops nd_default_ops = {
+};
+
/**
* alloc_netdev_mq - allocate network device
* @sizeof_priv: size of private data to allocate space for
@@ -4027,6 +4034,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
dev->get_stats = internal_stats;
netpoll_netdev_init(dev);
setup(dev);
+ if (dev->nd_ops == NULL)
+ dev->nd_ops = &nd_default_ops;
strcpy(dev->name, name);
return dev;
}
--
1.5.3.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Karl Meyer | PROBLEM: 2.6.23-rc "NETDEV WATCHDOG: eth0: transmit timed out" |
| Greg Kroah-Hartman | [PATCH 040/196] kobject: add kobject_add_ng function |
| Steven Rostedt | [RFC PATCH v4] Unified trace buffer |
| Dave Airlie | [git pull] drm patches for 2.6.27 final |
| Krzysztof Halasa | Re: [PATCH v2] Re: WAN: new PPP code for generic HDLC |
| David Miller | Re: [PATCH] Expose netdevice dev_id through sysfs |
| Jay Cliburn | Re: atl1 64-bit => 32-bit DMA borkage (reproducible, bisected) |
| Evgeniy Polyakov | [resend take 2 0/4] Distributed storage. |
git: | |
| Andrew Morton | Untracked working tree files |
| Miklos Vajna | [rfc] git submodules howto |
| Ben Collins | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Jon Smirl | ! [rejected] master -> master (non-fast forward) |
| rancor | How to copy/pipe console buffert to file? |
| Pieter Verberne | File collision while using pkg_add |
| Greg Thomas | Re: Is it possible to fix a stale NFS hadle without rebooting? |
| Didier Wiroth | win32-codecs, avi and amd64 question |
| Netfilter kernel module | 9 hours ago | Linux kernel |
| serial driver xmit problem | 12 hours ago | Linux kernel |
| Why Windows is better than Linux | 12 hours ago | Linux general |
| How can I see my kernel messages in vt12? | 19 hours ago | Linux kernel |
| Grub | 1 day ago | Linux general |
| vmalloc_fault handling in x86_64 | 1 day ago | Linux kernel |
| epoll_wait()ing on epoll FD | 1 day ago | Linux kernel |
| Framebuffer in x86_64 causes problems to multiseat | 1 day ago | Linux kernel |
| Difference between 2.4 and 2.6 regarding thread creation | 1 day ago | Linux general |
| Compiling gfs2 on kernel 2.6.27 | 2 days ago | Linux kernel |
