* dev->get_stats(dev) in COMPAT_NET_DEV_OPS case
@ 2009-01-08 13:12 Oliver Hartkopp
2009-01-08 13:29 ` Ben Hutchings
2009-01-08 16:51 ` Stephen Hemminger
0 siblings, 2 replies; 4+ messages in thread
From: Oliver Hartkopp @ 2009-01-08 13:12 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Linux Netdev List
Hello Stephen,
in commit eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0 ("netdev: introduce
dev_get_stats()
<http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0>")
you remove the setting of dev->get_stats :
@@ -4370,7
<http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=blob;f=net/core/dev.c;h=ca14ab407b338172758bc409efd2baaf75bdee99;hb=d314774cf2cd5dfeb39a00d37deee65d4c627927#l4370>
+4384,6
<http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=blob;f=net/core/dev.c;h=8843f4e3f5e192eba9eb5154faa1ca4131fb01fc;hb=eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0#l4384>
@@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
netdev_init_queues(dev);
- dev->get_stats = internal_stats;
netpoll_netdev_init(dev);
setup(dev);
strcpy(dev->name, name);
I really appreciate your introduction of COMPAT_NET_DEV_OPS but when i
try to compile and run a non-converted driver, i get a NULL pointer
dereference. I tracked it down to be the call of dev->get_stats(dev).
Did you miss something or is this behaviour intended?
Regards,
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: dev->get_stats(dev) in COMPAT_NET_DEV_OPS case
2009-01-08 13:12 dev->get_stats(dev) in COMPAT_NET_DEV_OPS case Oliver Hartkopp
@ 2009-01-08 13:29 ` Ben Hutchings
2009-01-08 14:02 ` Oliver Hartkopp
2009-01-08 16:51 ` Stephen Hemminger
1 sibling, 1 reply; 4+ messages in thread
From: Ben Hutchings @ 2009-01-08 13:29 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: Stephen Hemminger, Linux Netdev List
On Thu, 2009-01-08 at 14:12 +0100, Oliver Hartkopp wrote:
> Hello Stephen,
>
> in commit eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0 ("netdev: introduce
> dev_get_stats()
> <http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0>")
> you remove the setting of dev->get_stats :
>
> @@ -4370,7
> <http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=blob;f=net/core/dev.c;h=ca14ab407b338172758bc409efd2baaf75bdee99;hb=d314774cf2cd5dfeb39a00d37deee65d4c627927#l4370>
> +4384,6
> <http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=blob;f=net/core/dev.c;h=8843f4e3f5e192eba9eb5154faa1ca4131fb01fc;hb=eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0#l4384>
> @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
>
> netdev_init_queues(dev);
>
> - dev->get_stats = internal_stats;
> netpoll_netdev_init(dev);
> setup(dev);
> strcpy(dev->name, name);
>
> I really appreciate your introduction of COMPAT_NET_DEV_OPS but when i
> try to compile and run a non-converted driver, i get a NULL pointer
> dereference. I tracked it down to be the call of dev->get_stats(dev).
>
> Did you miss something or is this behaviour intended?
You should be calling dev_get_stats() now.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: dev->get_stats(dev) in COMPAT_NET_DEV_OPS case
2009-01-08 13:29 ` Ben Hutchings
@ 2009-01-08 14:02 ` Oliver Hartkopp
0 siblings, 0 replies; 4+ messages in thread
From: Oliver Hartkopp @ 2009-01-08 14:02 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Stephen Hemminger, Linux Netdev List
Ben Hutchings wrote:
> On Thu, 2009-01-08 at 14:12 +0100, Oliver Hartkopp wrote:
>
>> Hello Stephen,
>>
>> in commit eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0 ("netdev: introduce dev_get_stats()")
>> you remove the setting of dev->get_stats :
>>
>> @@ -4370,7 +4384,6 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
>>
>> netdev_init_queues(dev);
>>
>> - dev->get_stats = internal_stats;
>> netpoll_netdev_init(dev);
>> setup(dev);
>> strcpy(dev->name, name);
>>
>> I really appreciate your introduction of COMPAT_NET_DEV_OPS but when i
>> try to compile and run a non-converted driver, i get a NULL pointer
>> dereference. I tracked it down to be the call of dev->get_stats(dev).
>>
>> Did you miss something or is this behaviour intended?
>>
>
> You should be calling dev_get_stats() now.
>
>
I noticed that myself and besides a warning (about the const / non-const
definition) i got it working again.
But the question remains, if it still makes sense to provide
dev->get_stats() (referencing to dev_get_stats()) in the
COMPAT_NET_DEV_OPS case, as i would surely not be the only one tapping
into this problem ...
Regards,
Oliver
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: dev->get_stats(dev) in COMPAT_NET_DEV_OPS case
2009-01-08 13:12 dev->get_stats(dev) in COMPAT_NET_DEV_OPS case Oliver Hartkopp
2009-01-08 13:29 ` Ben Hutchings
@ 2009-01-08 16:51 ` Stephen Hemminger
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2009-01-08 16:51 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: Linux Netdev List
On Thu, 08 Jan 2009 14:12:05 +0100
Oliver Hartkopp <oliver@hartkopp.net> wrote:
> Hello Stephen,
>
> in commit eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0 ("netdev: introduce
> dev_get_stats()
> <http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0>")
> you remove the setting of dev->get_stats :
>
> @@ -4370,7
> <http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=blob;f=net/core/dev.c;h=ca14ab407b338172758bc409efd2baaf75bdee99;hb=d314774cf2cd5dfeb39a00d37deee65d4c627927#l4370>
> +4384,6
> <http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=blob;f=net/core/dev.c;h=8843f4e3f5e192eba9eb5154faa1ca4131fb01fc;hb=eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0#l4384>
> @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
>
> netdev_init_queues(dev);
>
> - dev->get_stats = internal_stats;
> netpoll_netdev_init(dev);
> setup(dev);
> strcpy(dev->name, name);
>
> I really appreciate your introduction of COMPAT_NET_DEV_OPS but when i
> try to compile and run a non-converted driver, i get a NULL pointer
> dereference. I tracked it down to be the call of dev->get_stats(dev).
In most cases, drivers shouldn't be call dev->get_stat directly.
I am working to convert all the in-tree uses of get_stats for 2.6.29.
(There are a couple more left).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-08 16:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-08 13:12 dev->get_stats(dev) in COMPAT_NET_DEV_OPS case Oliver Hartkopp
2009-01-08 13:29 ` Ben Hutchings
2009-01-08 14:02 ` Oliver Hartkopp
2009-01-08 16:51 ` Stephen Hemminger
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).