* [PATCH]&[Question] netdevice: Use netdev_priv()
@ 2008-08-01 9:50 Wang Chen
2008-08-01 10:08 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Wang Chen @ 2008-08-01 9:50 UTC (permalink / raw)
To: David S. Miller; +Cc: NETDEV
Dave
This mail is a question mail more than patch mail.
In your commit "netdev: netdev_priv() can now be sane again.",
you said netdev_priv() != netdev->priv, because that time,
netdev->priv = ((char *)dev +((sizeof(struct net_device) +(sizeof(struct net_device_subqueue) *
(queue_count - 1)) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST))
But now, after you do TX multiqueue improvement.
netdev->priv == netdev_priv() again.
That make me think, what the use of netdev->priv?
We have netdev_priv() and use it flexibly. Why don't kill netdev->priv?
---
>From be26ade29c6a3d0002492f7aab25258cb78ab597 Mon Sep 17 00:00:00 2001
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Fri, 1 Aug 2008 16:59:59 +0800
Subject: [PATCH] netdevice: Use netdev_priv()
dev->priv is now point to private data again.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
net/core/dev.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 63d6bcd..9b73624 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4255,11 +4255,8 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
dev->num_tx_queues = queue_count;
dev->real_num_tx_queues = queue_count;
- if (sizeof_priv) {
- dev->priv = ((char *)dev +
- ((sizeof(struct net_device) + NETDEV_ALIGN_CONST)
- & ~NETDEV_ALIGN_CONST));
- }
+ if (sizeof_priv)
+ dev->priv = netdev_priv(dev);
dev->gso_max_size = GSO_MAX_SIZE;
--
1.5.3.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-01 9:50 [PATCH]&[Question] netdevice: Use netdev_priv() Wang Chen
@ 2008-08-01 10:08 ` David Miller
2008-08-01 10:16 ` Wang Chen
0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2008-08-01 10:08 UTC (permalink / raw)
To: wangchen; +Cc: netdev
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Fri, 01 Aug 2008 17:50:15 +0800
> That make me think, what the use of netdev->priv?
> We have netdev_priv() and use it flexibly. Why don't kill netdev->priv?
Way too many old drivers still reference netdev->priv directly.
Once we convert all of them to netdev_priv(), yes we can kill
netdev->priv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-01 10:08 ` David Miller
@ 2008-08-01 10:16 ` Wang Chen
2008-08-01 10:24 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Wang Chen @ 2008-08-01 10:16 UTC (permalink / raw)
To: David Miller; +Cc: netdev
David Miller said the following on 2008-8-1 18:08:
> From: Wang Chen <wangchen@cn.fujitsu.com>
> Date: Fri, 01 Aug 2008 17:50:15 +0800
>
>> That make me think, what the use of netdev->priv?
>> We have netdev_priv() and use it flexibly. Why don't kill netdev->priv?
>
> Way too many old drivers still reference netdev->priv directly.
>
> Once we convert all of them to netdev_priv(), yes we can kill
> netdev->priv
>
Thanks for the explanation.
Then next question comes.
We *have to* convert the drivers to use netdev_priv(), right?
Because, netdev->priv == netdev_priv() maybe change again in future,
just as before.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-01 10:16 ` Wang Chen
@ 2008-08-01 10:24 ` David Miller
2008-08-01 10:35 ` Wang Chen
0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2008-08-01 10:24 UTC (permalink / raw)
To: wangchen; +Cc: netdev
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Fri, 01 Aug 2008 18:16:32 +0800
> Then next question comes.
> We *have to* convert the drivers to use netdev_priv(), right?
No, we don't.
> Because, netdev->priv == netdev_priv() maybe change again in future,
> just as before.
We will work to prevent that. I should not have allowed it to happen
in the first place. :-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-01 10:24 ` David Miller
@ 2008-08-01 10:35 ` Wang Chen
2008-08-01 11:05 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Wang Chen @ 2008-08-01 10:35 UTC (permalink / raw)
To: David Miller; +Cc: netdev
David Miller said the following on 2008-8-1 18:24:
> From: Wang Chen <wangchen@cn.fujitsu.com>
> Date: Fri, 01 Aug 2008 18:16:32 +0800
>
>> Then next question comes.
>> We *have to* convert the drivers to use netdev_priv(), right?
>
> No, we don't.
>
>> Because, netdev->priv == netdev_priv() maybe change again in future,
>> just as before.
>
> We will work to prevent that. I should not have allowed it to happen
> in the first place. :-)
>
How about add a comment to netdev->priv
void *priv; /* pointer to private data, referent me by netdev_priv()*/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-01 10:35 ` Wang Chen
@ 2008-08-01 11:05 ` David Miller
2008-08-05 9:55 ` Wang Chen
0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2008-08-01 11:05 UTC (permalink / raw)
To: wangchen; +Cc: netdev
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Fri, 01 Aug 2008 18:35:24 +0800
> How about add a comment to netdev->priv
>
> void *priv; /* pointer to private data, referent me by netdev_priv()*/
Sure, but I'd much rather apply a patch that converts
all the direct references :-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-01 11:05 ` David Miller
@ 2008-08-05 9:55 ` Wang Chen
2008-08-05 10:04 ` David Miller
0 siblings, 1 reply; 10+ messages in thread
From: Wang Chen @ 2008-08-05 9:55 UTC (permalink / raw)
To: David Miller; +Cc: netdev
David Miller said the following on 2008-8-1 19:05:
> From: Wang Chen <wangchen@cn.fujitsu.com>
> Date: Fri, 01 Aug 2008 18:35:24 +0800
>
>> How about add a comment to netdev->priv
>>
>> void *priv; /* pointer to private data, referent me by netdev_priv()*/
>
> Sure, but I'd much rather apply a patch that converts
> all the direct references :-)
I just checked some drivers' source.
And, maybe some direct references of net_device->priv are needed.
For example:
init_one() of cxgb2 makes several net_device to share one private data.
For this purpose, direct reference is necessary.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-05 9:55 ` Wang Chen
@ 2008-08-05 10:04 ` David Miller
2008-08-05 17:51 ` Divy Le Ray
0 siblings, 1 reply; 10+ messages in thread
From: David Miller @ 2008-08-05 10:04 UTC (permalink / raw)
To: wangchen; +Cc: netdev
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Tue, 05 Aug 2008 17:55:27 +0800
> init_one() of cxgb2 makes several net_device to share one private data.
> For this purpose, direct reference is necessary.
It should use netdev->ml_priv which is created for this purpose.
Every direct netdev->priv usage is a bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-05 10:04 ` David Miller
@ 2008-08-05 17:51 ` Divy Le Ray
2008-08-06 4:21 ` Wang Chen
0 siblings, 1 reply; 10+ messages in thread
From: Divy Le Ray @ 2008-08-05 17:51 UTC (permalink / raw)
To: David Miller; +Cc: wangchen, netdev
On Tuesday 05 August 2008 03:04:33 am David Miller wrote:
> From: Wang Chen <wangchen@cn.fujitsu.com>
> Date: Tue, 05 Aug 2008 17:55:27 +0800
>
> > init_one() of cxgb2 makes several net_device to share one private data.
> > For this purpose, direct reference is necessary.
>
> It should use netdev->ml_priv which is created for this purpose.
>
> Every direct netdev->priv usage is a bug.
cxgb3 was fixed in this regard, cxgb2 needs the same treatment ...
cheers,
Divy
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH]&[Question] netdevice: Use netdev_priv()
2008-08-05 17:51 ` Divy Le Ray
@ 2008-08-06 4:21 ` Wang Chen
0 siblings, 0 replies; 10+ messages in thread
From: Wang Chen @ 2008-08-06 4:21 UTC (permalink / raw)
To: Divy Le Ray; +Cc: David Miller, netdev
Divy Le Ray said the following on 2008-8-6 1:51:
> On Tuesday 05 August 2008 03:04:33 am David Miller wrote:
>> From: Wang Chen <wangchen@cn.fujitsu.com>
>> Date: Tue, 05 Aug 2008 17:55:27 +0800
>>
>>> init_one() of cxgb2 makes several net_device to share one private data.
>>> For this purpose, direct reference is necessary.
>> It should use netdev->ml_priv which is created for this purpose.
>>
>> Every direct netdev->priv usage is a bug.
>
> cxgb3 was fixed in this regard, cxgb2 needs the same treatment ...
>
Thanks Dave and Divy.
I am making the big patch for fixing all direct reference of netdev->priv.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-08-06 4:23 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-01 9:50 [PATCH]&[Question] netdevice: Use netdev_priv() Wang Chen
2008-08-01 10:08 ` David Miller
2008-08-01 10:16 ` Wang Chen
2008-08-01 10:24 ` David Miller
2008-08-01 10:35 ` Wang Chen
2008-08-01 11:05 ` David Miller
2008-08-05 9:55 ` Wang Chen
2008-08-05 10:04 ` David Miller
2008-08-05 17:51 ` Divy Le Ray
2008-08-06 4:21 ` Wang Chen
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).