summaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorVlad Dogaru2011-01-14 00:38:30 +0100
committerDavid S. Miller2011-01-20 08:31:09 +0100
commitcbda10fa97d72c7a1923be4426171aa90e8c6dab (patch)
tree113206ef603189e9f91f075e154cbdc8e1ac3f40 /net/core/dev.c
parentnet: cleanup unused macros in net directory (diff)
downloadkernel-qcow2-linux-cbda10fa97d72c7a1923be4426171aa90e8c6dab.tar.gz
kernel-qcow2-linux-cbda10fa97d72c7a1923be4426171aa90e8c6dab.tar.xz
kernel-qcow2-linux-cbda10fa97d72c7a1923be4426171aa90e8c6dab.zip
net_device: add support for network device groups
Net devices can now be grouped, enabling simpler manipulation from userspace. This patch adds a group field to the net_device structure, as well as rtnetlink support to query and modify it. Signed-off-by: Vlad Dogaru <ddvlad@rosedu.org> Acked-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 7741507429f4..2b85d4ae981f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4572,6 +4572,17 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
EXPORT_SYMBOL(dev_set_mtu);
/**
+ * dev_set_group - Change group this device belongs to
+ * @dev: device
+ * @new_group: group this device should belong to
+ */
+void dev_set_group(struct net_device *dev, int new_group)
+{
+ dev->group = new_group;
+}
+EXPORT_SYMBOL(dev_set_group);
+
+/**
* dev_set_mac_address - Change Media Access Control Address
* @dev: device
* @sa: new address
@@ -5678,6 +5689,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
dev->priv_flags = IFF_XMIT_DST_RELEASE;
setup(dev);
strcpy(dev->name, name);
+ dev->group = INIT_NETDEV_GROUP;
return dev;
free_pcpu: