From: Jeff Garzik <jeff@garzik.org>
To: David Miller <davem@davemloft.net>
Cc: peter.p.waskiewicz.jr@intel.com, netdev@vger.kernel.org,
auke-jan.h.kok@intel.com, hadi@cyberus.ca, kaber@trash.net
Subject: Re: [PATCH 2/3] NET: [CORE] Stack changes to add multiqueue hardware support API
Date: Fri, 29 Jun 2007 06:54:37 -0400 [thread overview]
Message-ID: <4684E4ED.90604@garzik.org> (raw)
In-Reply-To: <20070628.203956.18146513.davem@davemloft.net>
David Miller wrote:
> From: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
> Date: Thu, 28 Jun 2007 09:21:13 -0700
>
>> -struct net_device *alloc_netdev(int sizeof_priv, const char *name,
>> - void (*setup)(struct net_device *))
>> +struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
>> + void (*setup)(struct net_device *), int queue_count)
>> {
>> void *p;
>> struct net_device *dev;
>> @@ -3557,7 +3564,9 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
>> BUG_ON(strlen(name) >= sizeof(dev->name));
>>
>> /* ensure 32-byte alignment of both the device and private area */
>> - alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST;
>> + alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST +
>> + (sizeof(struct net_device_subqueue) * queue_count)) &
>> + ~NETDEV_ALIGN_CONST;
>> alloc_size += sizeof_priv + NETDEV_ALIGN_CONST;
>>
>> p = kzalloc(alloc_size, GFP_KERNEL);
>> @@ -3573,12 +3582,14 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
>> if (sizeof_priv)
>> dev->priv = netdev_priv(dev);
>>
>> + dev->egress_subqueue_count = queue_count;
>> +
>> dev->get_stats = internal_stats;
>> setup(dev);
>> strcpy(dev->name, name);
>> return dev;
>> }
>
> This isn't going to work.
>
> The pointer returned from netdev_priv() doesn't take into account the
> variable sized queues at the end of struct netdev, so we can stomp
> over the queues with the private area.
>
> This probably works by luck because of NETDEV_ALIGN.
>
> The simplest fix is to just make netdev_priv() use dev->priv,
> except when it's being initialized during allocation, and
> that's what I'm going to do when I apply your patch.
Ugh. That will reverse the gains we had with the current setup, won't it?
Also, what happens when we want to add ingress_queue[0] ?
Jeff
next prev parent reply other threads:[~2007-06-29 10:54 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-28 16:20 [PATCH] NET: Multiple queue hardware support PJ Waskiewicz
2007-06-28 16:21 ` [PATCH 1/3] NET: [DOC] Multiqueue hardware support documentation PJ Waskiewicz
2007-06-28 16:21 ` [PATCH 2/3] NET: [CORE] Stack changes to add multiqueue hardware support API PJ Waskiewicz
2007-06-28 16:31 ` Patrick McHardy
2007-06-28 17:00 ` Patrick McHardy
2007-06-28 19:00 ` Waskiewicz Jr, Peter P
2007-06-28 19:03 ` Patrick McHardy
2007-06-28 19:06 ` Waskiewicz Jr, Peter P
2007-06-28 19:20 ` Patrick McHardy
2007-06-28 19:32 ` Jeff Garzik
2007-06-28 19:37 ` Patrick McHardy
2007-06-28 21:11 ` Waskiewicz Jr, Peter P
2007-06-28 21:18 ` Patrick McHardy
2007-06-28 23:08 ` Waskiewicz Jr, Peter P
2007-06-28 23:31 ` David Miller
2007-06-28 20:39 ` David Miller
2007-06-29 3:39 ` David Miller
2007-06-29 10:54 ` Jeff Garzik [this message]
2007-06-28 16:21 ` [PATCH 3/3] NET: [SCHED] Qdisc changes and sch_rr added for multiqueue PJ Waskiewicz
2007-06-28 16:35 ` Patrick McHardy
2007-06-28 16:43 ` Waskiewicz Jr, Peter P
2007-06-28 16:46 ` Patrick McHardy
2007-06-28 16:50 ` Waskiewicz Jr, Peter P
2007-06-28 16:53 ` Patrick McHardy
2007-06-28 16:50 ` Patrick McHardy
2007-06-28 17:13 ` Patrick McHardy
2007-06-28 19:04 ` Waskiewicz Jr, Peter P
2007-06-28 19:17 ` Patrick McHardy
2007-06-28 19:21 ` Waskiewicz Jr, Peter P
2007-06-28 19:24 ` Patrick McHardy
2007-06-28 19:27 ` Waskiewicz Jr, Peter P
2007-06-29 4:20 ` David Miller
2007-06-29 8:45 ` Waskiewicz Jr, Peter P
2007-06-29 11:43 ` Multiqueue and virtualization WAS(Re: " jamal
2007-06-29 11:59 ` Patrick McHardy
2007-06-29 12:54 ` jamal
2007-06-29 13:08 ` Patrick McHardy
2007-06-29 13:19 ` jamal
2007-06-29 15:33 ` Ben Greear
2007-06-29 15:58 ` Patrick McHardy
2007-06-29 16:16 ` Ben Greear
2007-06-29 21:36 ` David Miller
2007-06-30 7:51 ` Benny Amorsen
2007-06-29 21:31 ` David Miller
2007-06-30 1:30 ` jamal
2007-06-30 4:35 ` David Miller
2007-06-30 14:52 ` jamal
2007-06-30 20:33 ` David Miller
2007-07-03 12:42 ` jamal
2007-07-03 21:24 ` David Miller
2007-07-04 2:20 ` jamal
2007-07-06 7:32 ` Rusty Russell
2007-07-06 14:39 ` jamal
2007-07-06 15:59 ` James Chapman
2007-07-08 2:30 ` Rusty Russell
2007-07-08 6:03 ` David Miller
2007-06-30 14:33 ` Patrick McHardy
2007-06-30 14:37 ` Waskiewicz Jr, Peter P
2007-06-28 17:57 ` [CORE] Stack changes to add multiqueue hardware support API Patrick McHardy
2007-06-28 17:57 ` [SCHED] Qdisc changes and sch_rr added for multiqueue Patrick McHardy
-- strict thread matches above, loose matches on Subject: below --
2007-06-23 21:36 [PATCH] NET: Multiple queue hardware support PJ Waskiewicz
2007-06-23 21:36 ` [PATCH 2/3] NET: [CORE] Stack changes to add multiqueue hardware support API PJ Waskiewicz
2007-06-24 12:00 ` Patrick McHardy
2007-06-25 16:25 ` Waskiewicz Jr, Peter P
2007-06-21 21:26 [PATCH] NET: Multiple queue hardware support PJ Waskiewicz
2007-06-21 21:26 ` [PATCH 2/3] NET: [CORE] Stack changes to add multiqueue hardware support API PJ Waskiewicz
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=4684E4ED.90604@garzik.org \
--to=jeff@garzik.org \
--cc=auke-jan.h.kok@intel.com \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.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).