aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-07-14 10:37:24 -0400
committerDavid S. Miller <davem@davemloft.net>2014-07-15 19:12:48 -0400
commitc835a677331495cf137a7f8a023463afd9f032f8 (patch)
treeca1b7c3aa3c2404f7912388e70f7e0cb9cf37043 /net/core
parent238fa3623a5709d29673ed78ff8e714d040fbb89 (diff)
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 38793fb84a35..2c98f10ee62a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6441,17 +6441,19 @@ void netdev_freemem(struct net_device *dev)
6441 6441
6442/** 6442/**
6443 * alloc_netdev_mqs - allocate network device 6443 * alloc_netdev_mqs - allocate network device
6444 * @sizeof_priv: size of private data to allocate space for 6444 * @sizeof_priv: size of private data to allocate space for
6445 * @name: device name format string 6445 * @name: device name format string
6446 * @setup: callback to initialize device 6446 * @name_assign_type: origin of device name
6447 * @txqs: the number of TX subqueues to allocate 6447 * @setup: callback to initialize device
6448 * @rxqs: the number of RX subqueues to allocate 6448 * @txqs: the number of TX subqueues to allocate
6449 * @rxqs: the number of RX subqueues to allocate
6449 * 6450 *
6450 * Allocates a struct net_device with private data area for driver use 6451 * Allocates a struct net_device with private data area for driver use
6451 * and performs basic initialization. Also allocates subqueue structs 6452 * and performs basic initialization. Also allocates subqueue structs
6452 * for each queue on the device. 6453 * for each queue on the device.
6453 */ 6454 */
6454struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, 6455struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
6456 unsigned char name_assign_type,
6455 void (*setup)(struct net_device *), 6457 void (*setup)(struct net_device *),
6456 unsigned int txqs, unsigned int rxqs) 6458 unsigned int txqs, unsigned int rxqs)
6457{ 6459{
@@ -6530,6 +6532,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
6530#endif 6532#endif
6531 6533
6532 strcpy(dev->name, name); 6534 strcpy(dev->name, name);
6535 dev->name_assign_type = name_assign_type;
6533 dev->group = INIT_NETDEV_GROUP; 6536 dev->group = INIT_NETDEV_GROUP;
6534 if (!dev->ethtool_ops) 6537 if (!dev->ethtool_ops)
6535 dev->ethtool_ops = &default_ethtool_ops; 6538 dev->ethtool_ops = &default_ethtool_ops;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1f8a59e02c48..599864322de8 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1828,8 +1828,8 @@ struct net_device *rtnl_create_link(struct net *net,
1828 num_rx_queues = ops->get_num_rx_queues(); 1828 num_rx_queues = ops->get_num_rx_queues();
1829 1829
1830 err = -ENOMEM; 1830 err = -ENOMEM;
1831 dev = alloc_netdev_mqs(ops->priv_size, ifname, ops->setup, 1831 dev = alloc_netdev_mqs(ops->priv_size, ifname, NET_NAME_UNKNOWN,
1832 num_tx_queues, num_rx_queues); 1832 ops->setup, num_tx_queues, num_rx_queues);
1833 if (!dev) 1833 if (!dev)
1834 goto err; 1834 goto err;
1835 1835