From: Eric Dumazet <eric.dumazet@gmail.com>
To: Brian Haley <brian.haley@hp.com>
Cc: David Miller <davem@davemloft.net>,
Patrick McHardy <kaber@trash.net>,
Stephen Hemminger <shemminger@vyatta.com>,
jarkao2@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next-2.6] vlan: multiqueue vlan devices
Date: Wed, 02 Sep 2009 20:55:24 +0200 [thread overview]
Message-ID: <4A9EBF9C.2030904@gmail.com> (raw)
In-Reply-To: <4A9EBB68.2080903@hp.com>
Brian Haley a écrit :
> Eric Dumazet wrote:
>> diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
>> index 3c1895e..0525a1d 100644
>> --- a/include/net/rtnetlink.h
>> +++ b/include/net/rtnetlink.h
>> @@ -70,6 +70,8 @@ struct rtnl_link_ops {
>> size_t (*get_xstats_size)(const struct net_device *dev);
>> int (*fill_xstats)(struct sk_buff *skb,
>> const struct net_device *dev);
>> + int (*get_tx_queues)(struct net*, struct nlattr *tb[],
>> + int *tx_queues, int *real_tx_queues);
>
> int (*get_tx_queues)(struct net *net, struct nlattr *tb[],
>
> Total nitpick, but tbird highlighted it because of the missing "net".
>
Thats right, and I believe some gcc versions could complain
Thanks Brian
[PATCH net-next-2.6] vlan: multiqueue vlan device
vlan devices are currently not multi-queue capable.
We can do that with a new rtnl_link_ops method,
get_tx_queues(), called from rtnl_create_link()
This new method gets num_tx_queues/real_num_tx_queues
from real device.
register_vlan_device() is also handled.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/net/rtnetlink.h | 2 ++
net/8021q/vlan.c | 5 +++--
net/8021q/vlan_netlink.c | 20 ++++++++++++++++++++
net/core/rtnetlink.c | 10 +++++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 3c1895e..3f4ab54 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -70,6 +70,8 @@ struct rtnl_link_ops {
size_t (*get_xstats_size)(const struct net_device *dev);
int (*fill_xstats)(struct sk_buff *skb,
const struct net_device *dev);
+ int (*get_tx_queues)(struct net *net, struct nlattr *tb[],
+ int *tx_queues, int *real_tx_queues);
};
extern int __rtnl_link_register(struct rtnl_link_ops *ops);
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index e814794..8836575 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -330,12 +330,13 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id)
snprintf(name, IFNAMSIZ, "vlan%.4i", vlan_id);
}
- new_dev = alloc_netdev(sizeof(struct vlan_dev_info), name,
- vlan_setup);
+ new_dev = alloc_netdev_mq(sizeof(struct vlan_dev_info), name,
+ vlan_setup, real_dev->num_tx_queues);
if (new_dev == NULL)
return -ENOBUFS;
+ new_dev->real_num_tx_queues = real_dev->real_num_tx_queues;
dev_net_set(new_dev, net);
/* need 4 bytes for extra VLAN header info,
* hope the underlying device can handle it.
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index e9c91dc..8ce4122 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -100,6 +100,25 @@ static int vlan_changelink(struct net_device *dev,
return 0;
}
+static int vlan_get_tx_queues(struct net *net,
+ struct nlattr *tb[],
+ int *num_tx_queues,
+ int *real_num_tx_queues)
+{
+ struct net_device *real_dev;
+
+ if (!tb[IFLA_LINK])
+ return -EINVAL;
+
+ real_dev = __dev_get_by_index(net, nla_get_u32(tb[IFLA_LINK]));
+ if (!real_dev)
+ return -ENODEV;
+
+ *num_tx_queues = real_dev->num_tx_queues;
+ *real_num_tx_queues = real_dev->real_num_tx_queues;
+ return 0;
+}
+
static int vlan_newlink(struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[])
{
@@ -216,6 +235,7 @@ struct rtnl_link_ops vlan_link_ops __read_mostly = {
.maxtype = IFLA_VLAN_MAX,
.policy = vlan_policy,
.priv_size = sizeof(struct vlan_dev_info),
+ .get_tx_queues = vlan_get_tx_queues,
.setup = vlan_setup,
.validate = vlan_validate,
.newlink = vlan_newlink,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index b44775f..5c1fe53 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -974,12 +974,20 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
{
int err;
struct net_device *dev;
+ int num_queues = 1;
+ int real_num_queues = 1;
+ if (ops->get_tx_queues) {
+ err = ops->get_tx_queues(net, tb, &num_queues, &real_num_queues);
+ if (err)
+ goto err;
+ }
err = -ENOMEM;
- dev = alloc_netdev(ops->priv_size, ifname, ops->setup);
+ dev = alloc_netdev_mq(ops->priv_size, ifname, ops->setup, num_queues);
if (!dev)
goto err;
+ dev->real_num_tx_queues = real_num_queues;
if (strchr(dev->name, '%')) {
err = dev_alloc_name(dev, dev->name);
if (err < 0)
next prev parent reply other threads:[~2009-09-02 18:55 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-01 23:52 [NET] Add proc file to display the state of all qdiscs Christoph Lameter
2009-09-02 8:14 ` Jarek Poplawski
2009-09-02 8:28 ` Eric Dumazet
2009-09-02 8:30 ` David Miller
2009-09-02 12:30 ` [PATCH net-next-2.6] tc: report informations for multiqueue devices Eric Dumazet
2009-09-02 12:48 ` Eric Dumazet
2009-09-02 16:23 ` Stephen Hemminger
2009-09-02 16:30 ` Patrick McHardy
2009-09-02 16:50 ` Eric Dumazet
2009-09-02 17:17 ` [PATCH net-next-2.6] vlan: multiqueue vlan devices Eric Dumazet
2009-09-02 17:49 ` Patrick McHardy
2009-09-02 18:37 ` Brian Haley
2009-09-02 18:55 ` Eric Dumazet [this message]
2009-09-02 19:01 ` Stephen Hemminger
2009-09-02 19:12 ` Eric Dumazet
2009-09-03 1:04 ` David Miller
2009-09-03 1:05 ` Eric Dumazet
2009-09-03 9:17 ` Eric Dumazet
2009-09-03 9:20 ` David Miller
2009-09-02 17:31 ` [PATCH net-next-2.6] tc: report informations for multiqueue devices Eric Dumazet
2009-09-02 17:50 ` Patrick McHardy
2009-09-02 13:18 ` Patrick McHardy
2009-09-02 13:49 ` Eric Dumazet
2009-09-02 14:07 ` Patrick McHardy
2009-09-02 22:17 ` Jarek Poplawski
2009-09-02 9:18 ` [NET] Add proc file to display the state of all qdiscs Jarek Poplawski
2009-09-02 9:33 ` Jarek Poplawski
2009-09-02 9:37 ` Jarek Poplawski
2009-09-02 12:44 ` Patrick McHardy
2009-09-02 18:13 ` Christoph Lameter
2009-09-03 14:19 ` Jesper Dangaard Brouer
2009-09-03 14:29 ` Patrick McHardy
2009-09-03 14:43 ` Eric Dumazet
2009-09-03 17:30 ` Jesper Dangaard Brouer
2009-09-03 17:56 ` Patrick McHardy
2009-09-03 23:31 ` David Miller
2009-09-04 1:36 ` Patrick McHardy
2009-09-04 1:43 ` Patrick McHardy
2009-09-03 23:28 ` David Miller
2009-09-03 23:22 ` David Miller
2009-09-02 18:12 ` Christoph Lameter
2009-09-02 19:49 ` Jarek Poplawski
2009-09-02 21:27 ` Jarek Poplawski
2009-09-03 18:03 ` Christoph Lameter
2009-09-03 19:35 ` Jarek Poplawski
2009-09-03 19:38 ` Eric Dumazet
2009-09-03 19:54 ` Jarek Poplawski
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=4A9EBF9C.2030904@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=brian.haley@hp.com \
--cc=davem@davemloft.net \
--cc=jarkao2@gmail.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).