Skip to content

Commit f14511f

Browse files
committed
net: Add flags argument to alloc_netdev_mqs
Used in a later patch to pass in flags at create time Signed-off-by: David Ahern <dsahern@gmail.com>
1 parent 113e2eb commit f14511f

File tree

9 files changed

+15
-11
lines changed

9 files changed

+15
-11
lines changed

drivers/net/ethernet/mellanox/mlx5/core/ipoib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
446446
name, NET_NAME_UNKNOWN,
447447
setup,
448448
nch * MLX5E_MAX_NUM_TC,
449-
nch);
449+
nch, 0);
450450
if (!netdev) {
451451
mlx5_core_warn(mdev, "alloc_netdev_mqs failed\n");
452452
goto free_mdev_resources;

drivers/net/ethernet/tile/tilegx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,7 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
21982198
* template, instantiated by register_netdev(), but not for us.
21992199
*/
22002200
dev = alloc_netdev_mqs(sizeof(*priv), name, NET_NAME_UNKNOWN,
2201-
tile_net_setup, NR_CPUS, 1);
2201+
tile_net_setup, NR_CPUS, 1, 0);
22022202
if (!dev) {
22032203
pr_err("alloc_netdev_mqs(%s) failed\n", name);
22042204
return;

drivers/net/tun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
18041804

18051805
dev = alloc_netdev_mqs(sizeof(struct tun_struct), name,
18061806
NET_NAME_UNKNOWN, tun_setup, queues,
1807-
queues);
1807+
queues, 0);
18081808

18091809
if (!dev)
18101810
return -ENOMEM;

drivers/net/wireless/marvell/mwifiex/cfg80211.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2960,7 +2960,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
29602960

29612961
dev = alloc_netdev_mqs(sizeof(struct mwifiex_private *), name,
29622962
name_assign_type, ether_setup,
2963-
IEEE80211_NUM_ACS, 1);
2963+
IEEE80211_NUM_ACS, 1, 0);
29642964
if (!dev) {
29652965
mwifiex_dbg(adapter, ERROR,
29662966
"no memory available for netdevice\n");

include/linux/netdevice.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3699,13 +3699,14 @@ void ether_setup(struct net_device *dev);
36993699
struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
37003700
unsigned char name_assign_type,
37013701
void (*setup)(struct net_device *),
3702-
unsigned int txqs, unsigned int rxqs);
3702+
unsigned int txqs, unsigned int rxqs,
3703+
unsigned int flags);
37033704
#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
3704-
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)
3705+
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1, 0)
37053706

37063707
#define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \
37073708
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \
3708-
count)
3709+
count, 0)
37093710

37103711
int register_netdev(struct net_device *dev);
37113712
void unregister_netdev(struct net_device *dev);

net/core/dev.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7829,6 +7829,7 @@ void netdev_freemem(struct net_device *dev)
78297829
* @setup: callback to initialize device
78307830
* @txqs: the number of TX subqueues to allocate
78317831
* @rxqs: the number of RX subqueues to allocate
7832+
* @flags: flags to 'or' with priv_flags
78327833
*
78337834
* Allocates a struct net_device with private data area for driver use
78347835
* and performs basic initialization. Also allocates subqueue structs
@@ -7837,7 +7838,8 @@ void netdev_freemem(struct net_device *dev)
78377838
struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
78387839
unsigned char name_assign_type,
78397840
void (*setup)(struct net_device *),
7840-
unsigned int txqs, unsigned int rxqs)
7841+
unsigned int txqs, unsigned int rxqs,
7842+
unsigned int flags)
78417843
{
78427844
struct net_device *dev;
78437845
size_t alloc_size;
@@ -7920,6 +7922,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
79207922
if (netif_alloc_rx_queues(dev))
79217923
goto free_all;
79227924
#endif
7925+
dev->priv_flags |= flags;
79237926

79247927
strcpy(dev->name, name);
79257928
dev->name_assign_type = name_assign_type;

net/core/rtnetlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2390,7 +2390,7 @@ struct net_device *rtnl_create_link(struct net *net,
23902390
num_rx_queues = ops->get_num_rx_queues();
23912391

23922392
dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type,
2393-
ops->setup, num_tx_queues, num_rx_queues);
2393+
ops->setup, num_tx_queues, num_rx_queues, 0);
23942394
if (!dev)
23952395
return ERR_PTR(-ENOMEM);
23962396

net/ethernet/eth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
389389
unsigned int rxqs)
390390
{
391391
return alloc_netdev_mqs(sizeof_priv, "eth%d", NET_NAME_UNKNOWN,
392-
ether_setup, txqs, rxqs);
392+
ether_setup, txqs, rxqs, 0);
393393
}
394394
EXPORT_SYMBOL(alloc_etherdev_mqs);
395395

net/mac80211/iface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
18021802

18031803
ndev = alloc_netdev_mqs(size + txq_size,
18041804
name, name_assign_type,
1805-
if_setup, txqs, 1);
1805+
if_setup, txqs, 1, 0);
18061806
if (!ndev)
18071807
return -ENOMEM;
18081808
dev_net_set(ndev, wiphy_net(local->hw.wiphy));

0 commit comments

Comments
 (0)