From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org
Cc: roopa@cumulusnetworks.com, f.fainelli@gmail.com,
nicolas.dichtel@6wind.com, David Ahern <dsahern@gmail.com>
Subject: [PATCH RFC net-next 2/6] net: Add flags argument to alloc_netdev_mqs
Date: Sat, 6 May 2017 10:07:30 -0600 [thread overview]
Message-ID: <20170506160734.47084-3-dsahern@gmail.com> (raw)
In-Reply-To: <20170506160734.47084-1-dsahern@gmail.com>
Used in a later patch to pass in flags at create time
Signed-off-by: David Ahern <dsahern@gmail.com>
---
drivers/net/ethernet/mellanox/mlx5/core/ipoib.c | 2 +-
drivers/net/ethernet/tile/tilegx.c | 2 +-
drivers/net/tun.c | 2 +-
drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 +-
include/linux/netdevice.h | 7 ++++---
net/core/dev.c | 5 ++++-
net/core/rtnetlink.c | 2 +-
net/ethernet/eth.c | 2 +-
net/mac80211/iface.c | 2 +-
9 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c
index 3c84e36af018..f5aaa92726a2 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib.c
@@ -446,7 +446,7 @@ static struct net_device *mlx5_rdma_netdev_alloc(struct mlx5_core_dev *mdev,
name, NET_NAME_UNKNOWN,
setup,
nch * MLX5E_MAX_NUM_TC,
- nch);
+ nch, 0);
if (!netdev) {
mlx5_core_warn(mdev, "alloc_netdev_mqs failed\n");
goto free_mdev_resources;
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
index 7c634bc75615..f38067e260bd 100644
--- a/drivers/net/ethernet/tile/tilegx.c
+++ b/drivers/net/ethernet/tile/tilegx.c
@@ -2198,7 +2198,7 @@ static void tile_net_dev_init(const char *name, const uint8_t *mac)
* template, instantiated by register_netdev(), but not for us.
*/
dev = alloc_netdev_mqs(sizeof(*priv), name, NET_NAME_UNKNOWN,
- tile_net_setup, NR_CPUS, 1);
+ tile_net_setup, NR_CPUS, 1, 0);
if (!dev) {
pr_err("alloc_netdev_mqs(%s) failed\n", name);
return;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index bbd707b9ef7a..030621621ea8 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1804,7 +1804,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
dev = alloc_netdev_mqs(sizeof(struct tun_struct), name,
NET_NAME_UNKNOWN, tun_setup, queues,
- queues);
+ queues, 0);
if (!dev)
return -ENOMEM;
diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 7ec06bf13413..38b6570ff1cd 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -2960,7 +2960,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy,
dev = alloc_netdev_mqs(sizeof(struct mwifiex_private *), name,
name_assign_type, ether_setup,
- IEEE80211_NUM_ACS, 1);
+ IEEE80211_NUM_ACS, 1, 0);
if (!dev) {
mwifiex_dbg(adapter, ERROR,
"no memory available for netdevice\n");
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 305d2d42b349..f47c8712398a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3699,13 +3699,14 @@ void ether_setup(struct net_device *dev);
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);
+ unsigned int txqs, unsigned int rxqs,
+ unsigned int flags);
#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \
- alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1)
+ alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, 1, 1, 0)
#define alloc_netdev_mq(sizeof_priv, name, name_assign_type, setup, count) \
alloc_netdev_mqs(sizeof_priv, name, name_assign_type, setup, count, \
- count)
+ count, 0)
int register_netdev(struct net_device *dev);
void unregister_netdev(struct net_device *dev);
diff --git a/net/core/dev.c b/net/core/dev.c
index f166b3bf1895..48a0252037d5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7829,6 +7829,7 @@ void netdev_freemem(struct net_device *dev)
* @setup: callback to initialize device
* @txqs: the number of TX subqueues to allocate
* @rxqs: the number of RX subqueues to allocate
+ * @flags: flags to 'or' with priv_flags
*
* Allocates a struct net_device with private data area for driver use
* and performs basic initialization. Also allocates subqueue structs
@@ -7837,7 +7838,8 @@ void netdev_freemem(struct net_device *dev)
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)
+ unsigned int txqs, unsigned int rxqs,
+ unsigned int flags)
{
struct net_device *dev;
size_t alloc_size;
@@ -7920,6 +7922,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
if (netif_alloc_rx_queues(dev))
goto free_all;
#endif
+ dev->priv_flags |= flags;
strcpy(dev->name, name);
dev->name_assign_type = name_assign_type;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index bcb0f610ee42..a4db1cd91c4a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2390,7 +2390,7 @@ struct net_device *rtnl_create_link(struct net *net,
num_rx_queues = ops->get_num_rx_queues();
dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type,
- ops->setup, num_tx_queues, num_rx_queues);
+ ops->setup, num_tx_queues, num_rx_queues, 0);
if (!dev)
return ERR_PTR(-ENOMEM);
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 1446810047f5..d8f489e134f0 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -389,7 +389,7 @@ struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs,
unsigned int rxqs)
{
return alloc_netdev_mqs(sizeof_priv, "eth%d", NET_NAME_UNKNOWN,
- ether_setup, txqs, rxqs);
+ ether_setup, txqs, rxqs, 0);
}
EXPORT_SYMBOL(alloc_etherdev_mqs);
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 3bd5b81f5d81..54891601e3d1 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1802,7 +1802,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
ndev = alloc_netdev_mqs(size + txq_size,
name, name_assign_type,
- if_setup, txqs, 1);
+ if_setup, txqs, 1, 0);
if (!ndev)
return -ENOMEM;
dev_net_set(ndev, wiphy_net(local->hw.wiphy));
--
2.11.0 (Apple Git-81)
next prev parent reply other threads:[~2017-05-06 16:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-06 16:07 [PATCH RFC net-next 0/6] net: reducing memory footprint of network devices David Ahern
2017-05-06 16:07 ` [PATCH RFC net-next 1/6] net: Add accessor for kboject in a net_device David Ahern
2017-05-06 16:07 ` David Ahern [this message]
2017-05-06 16:07 ` [PATCH RFC net-next 3/6] net: Introduce IFF_LWT_NETDEV flag David Ahern
2017-05-08 8:55 ` Johannes Berg
2017-05-08 20:11 ` David Miller
2017-05-08 21:37 ` Roopa Prabhu
2017-05-09 0:57 ` David Ahern
2017-05-09 5:04 ` Roopa Prabhu
2017-05-06 16:07 ` [PATCH RFC net-next 4/6] net: Do not intialize kobject for lightweight netdevs David Ahern
2017-05-08 17:26 ` Florian Fainelli
2017-05-06 16:07 ` [PATCH RFC net-next 5/6] net: Delay initializations for lightweight devices David Ahern
2017-05-08 17:31 ` Florian Fainelli
2017-05-06 16:07 ` [PATCH RFC net-next 6/6] net: add uapi for creating " David Ahern
2017-05-08 17:35 ` [PATCH RFC net-next 0/6] net: reducing memory footprint of network devices Florian Fainelli
2017-05-09 9:50 ` Nicolas Dichtel
2017-05-09 15:42 ` David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170506160734.47084-3-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.