summaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-07-14 14:37:24 (GMT)
committerDavid S. Miller <davem@davemloft.net>2014-07-15 23:12:48 (GMT)
commitc835a677331495cf137a7f8a023463afd9f032f8 (patch)
treeca1b7c3aa3c2404f7912388e70f7e0cb9cf37043 /net/core
parent238fa3623a5709d29673ed78ff8e714d040fbb89 (diff)
downloadlinux-c835a677331495cf137a7f8a023463afd9f032f8.tar.xz
net: set name_assign_type in alloc_netdev()
Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert all users to pass NET_NAME_UNKNOWN. Coccinelle patch: @@ expression sizeof_priv, name, setup, txqs, rxqs, count; @@ ( -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs) +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs) | -alloc_netdev_mq(sizeof_priv, name, setup, count) +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count) | -alloc_netdev(sizeof_priv, name, setup) +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup) ) v9: move comments here from the wrong commit Signed-off-by: Tom Gundersen <teg@jklm.no> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c13
-rw-r--r--net/core/rtnetlink.c4
2 files changed, 10 insertions, 7 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 38793fb..2c98f10 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6441,17 +6441,19 @@ void netdev_freemem(struct net_device *dev)
/**
* alloc_netdev_mqs - allocate network device
- * @sizeof_priv: size of private data to allocate space for
- * @name: device name format string
- * @setup: callback to initialize device
- * @txqs: the number of TX subqueues to allocate
- * @rxqs: the number of RX subqueues to allocate
+ * @sizeof_priv: size of private data to allocate space for
+ * @name: device name format string
+ * @name_assign_type: origin of device name
+ * @setup: callback to initialize device
+ * @txqs: the number of TX subqueues to allocate
+ * @rxqs: the number of RX subqueues to allocate
*
* Allocates a struct net_device with private data area for driver use
* and performs basic initialization. Also allocates subqueue structs
* for each queue on the device.
*/
struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
+ unsigned char name_assign_type,
void (*setup)(struct net_device *),
unsigned int txqs, unsigned int rxqs)
{
@@ -6530,6 +6532,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
#endif
strcpy(dev->name, name);
+ dev->name_assign_type = name_assign_type;
dev->group = INIT_NETDEV_GROUP;
if (!dev->ethtool_ops)
dev->ethtool_ops = &default_ethtool_ops;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1f8a59e..5998643 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1828,8 +1828,8 @@ struct net_device *rtnl_create_link(struct net *net,
num_rx_queues = ops->get_num_rx_queues();
err = -ENOMEM;
- dev = alloc_netdev_mqs(ops->priv_size, ifname, ops->setup,
- num_tx_queues, num_rx_queues);
+ dev = alloc_netdev_mqs(ops->priv_size, ifname, NET_NAME_UNKNOWN,
+ ops->setup, num_tx_queues, num_rx_queues);
if (!dev)
goto err;