All of lore.kernel.org
 help / color / mirror / Atom feed
* A flow path for ethernet kernel driver
@ 2015-05-18 19:23 Airton Ishimori
  2015-05-18 20:01 ` Rami Rosen
  2015-05-19  5:48 ` anish singh
  0 siblings, 2 replies; 7+ messages in thread
From: Airton Ishimori @ 2015-05-18 19:23 UTC (permalink / raw)
  To: kernelnewbies

Hello, everybody,

I'm trying to develop a new Ethernet driver (Realtek) for Linux kernel
4.0.2.

[    3.612938] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded

As part of my studies, I'm trying to trace the path for functions defined
in drivers/net/ethernet/realtek/r8169.c, net/core/dev.c and
net/core/dev_ioctl.c. I'm using "printks" for this purpose. For instance,
something like:

printk("TEST: __dev_set_promiscuity\n");

However, I'm not getting what's going on. I can set/unset the promiscuity
behaviour via ifconfig command.

[  131.330091] device eth0 entered promiscuous mode
[  170.619086] device eth0 left promiscuous mode

By looking at the dmesg output above, I thought the function that deals
with promiscuity was __dev_set_promiscuity() defined in net/core/dev.c, because
this function calls a function to print the message above:

pr_info("device %s %s promiscuous mode\n", dev->name, dev->flags &
IFF_PROMISC ? "entered" : "left");

But, when I tried to look for my printk message with dmesg after compiling
and running the kernel, I couldn't find it.

$ cd linux-4.0.2/
$ make net && make modules
$ sudo make modules_install && sudo make install

Can somebody help me to understand what's happening?

Thanks in advance,


*--*Airton Ishimori
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150518/9667cdfe/attachment.html 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* A flow path for ethernet kernel driver
  2015-05-18 19:23 A flow path for ethernet kernel driver Airton Ishimori
@ 2015-05-18 20:01 ` Rami Rosen
  2015-05-18 23:11   ` Airton Ishimori
  2015-05-19  5:48 ` anish singh
  1 sibling, 1 reply; 7+ messages in thread
From: Rami Rosen @ 2015-05-18 20:01 UTC (permalink / raw)
  To: kernelnewbies

Hi, Airton,

This is simply a matter of setting dmesg to work with
the level which you need in your setup.
You should set "dmesg -n" to work with the pr_info() level.
Pleas look in man dmesg, for the "-n, --console-level level" part.

If you are in a haste and looking for immediate solution, you can also
try pr_err() instead, as most distros do print such messages with
dmesg without need for any special setup.

Regards,
Rami Rosen
http://ramirose.wix.com/ramirosen

On 18 May 2015 at 22:23, Airton Ishimori <nobumasa.bcc@gmail.com> wrote:
> Hello, everybody,
>
> I'm trying to develop a new Ethernet driver (Realtek) for Linux kernel
> 4.0.2.
>
> [    3.612938] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>
> As part of my studies, I'm trying to trace the path for functions defined in
> drivers/net/ethernet/realtek/r8169.c, net/core/dev.c and
> net/core/dev_ioctl.c. I'm using "printks" for this purpose. For instance,
> something like:
>
> printk("TEST: __dev_set_promiscuity\n");
>
> However, I'm not getting what's going on. I can set/unset the promiscuity
> behaviour via ifconfig command.
>
> [  131.330091] device eth0 entered promiscuous mode
> [  170.619086] device eth0 left promiscuous mode
>
> By looking at the dmesg output above, I thought the function that deals with
> promiscuity was __dev_set_promiscuity() defined in net/core/dev.c, because
> this function calls a function to print the message above:
>
> pr_info("device %s %s promiscuous mode\n", dev->name, dev->flags &
> IFF_PROMISC ? "entered" : "left");
>
> But, when I tried to look for my printk message with dmesg after compiling
> and running the kernel, I couldn't find it.
>
> $ cd linux-4.0.2/
> $ make net && make modules
> $ sudo make modules_install && sudo make install
>
> Can somebody help me to understand what's happening?
>
> Thanks in advance,
>
> --
> Airton Ishimori
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* A flow path for ethernet kernel driver
  2015-05-18 20:01 ` Rami Rosen
@ 2015-05-18 23:11   ` Airton Ishimori
  0 siblings, 0 replies; 7+ messages in thread
From: Airton Ishimori @ 2015-05-18 23:11 UTC (permalink / raw)
  To: kernelnewbies

Thank you both Nick and Rami. You helped me a lot !


*--*Airton Ishimori



On Mon, May 18, 2015 at 5:01 PM, Rami Rosen <roszenrami@gmail.com> wrote:

> Hi, Airton,
>
> This is simply a matter of setting dmesg to work with
> the level which you need in your setup.
> You should set "dmesg -n" to work with the pr_info() level.
> Pleas look in man dmesg, for the "-n, --console-level level" part.
>
> If you are in a haste and looking for immediate solution, you can also
> try pr_err() instead, as most distros do print such messages with
> dmesg without need for any special setup.
>
> Regards,
> Rami Rosen
> http://ramirose.wix.com/ramirosen
>
> On 18 May 2015 at 22:23, Airton Ishimori <nobumasa.bcc@gmail.com> wrote:
> > Hello, everybody,
> >
> > I'm trying to develop a new Ethernet driver (Realtek) for Linux kernel
> > 4.0.2.
> >
> > [    3.612938] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
> >
> > As part of my studies, I'm trying to trace the path for functions
> defined in
> > drivers/net/ethernet/realtek/r8169.c, net/core/dev.c and
> > net/core/dev_ioctl.c. I'm using "printks" for this purpose. For instance,
> > something like:
> >
> > printk("TEST: __dev_set_promiscuity\n");
> >
> > However, I'm not getting what's going on. I can set/unset the promiscuity
> > behaviour via ifconfig command.
> >
> > [  131.330091] device eth0 entered promiscuous mode
> > [  170.619086] device eth0 left promiscuous mode
> >
> > By looking at the dmesg output above, I thought the function that deals
> with
> > promiscuity was __dev_set_promiscuity() defined in net/core/dev.c,
> because
> > this function calls a function to print the message above:
> >
> > pr_info("device %s %s promiscuous mode\n", dev->name, dev->flags &
> > IFF_PROMISC ? "entered" : "left");
> >
> > But, when I tried to look for my printk message with dmesg after
> compiling
> > and running the kernel, I couldn't find it.
> >
> > $ cd linux-4.0.2/
> > $ make net && make modules
> > $ sudo make modules_install && sudo make install
> >
> > Can somebody help me to understand what's happening?
> >
> > Thanks in advance,
> >
> > --
> > Airton Ishimori
> >
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150518/09a1b6f2/attachment-0001.html 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* A flow path for ethernet kernel driver
  2015-05-18 19:23 A flow path for ethernet kernel driver Airton Ishimori
  2015-05-18 20:01 ` Rami Rosen
@ 2015-05-19  5:48 ` anish singh
  2015-05-19  5:53   ` Saket Sinha
  2015-05-19 14:08   ` Airton Ishimori
  1 sibling, 2 replies; 7+ messages in thread
From: anish singh @ 2015-05-19  5:48 UTC (permalink / raw)
  To: kernelnewbies

On Mon, May 18, 2015 at 12:23 PM, Airton Ishimori <nobumasa.bcc@gmail.com>
wrote:

> Hello, everybody,
>
> I'm trying to develop a new Ethernet driver (Realtek) for Linux kernel
> 4.0.2.
>
> [    3.612938] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>
> As part of my studies, I'm trying to trace the path for functions defined
> in drivers/net/ethernet/realtek/r8169.c, net/core/dev.c and
> net/core/dev_ioctl.c. I'm using "printks" for this purpose. For instance,
> something like:
>
> printk("TEST: __dev_set_promiscuity\n");
>
> However, I'm not getting what's going on. I can set/unset the promiscuity
> behaviour via ifconfig command.
>
> [  131.330091] device eth0 entered promiscuous mode
> [  170.619086] device eth0 left promiscuous mode
>
> By looking at the dmesg output above, I thought the function that deals
> with promiscuity was __dev_set_promiscuity() defined in net/core/dev.c, because
> this function calls a function to print the message above:
>
> pr_info("device %s %s promiscuous mode\n", dev->name, dev->flags &
> IFF_PROMISC ? "entered" : "left");
>
> But, when I tried to look for my printk message with dmesg after
> compiling and running the kernel, I couldn't find it.
>
> $ cd linux-4.0.2/
> $ make net && make modules
> $ sudo make modules_install && sudo make install
>
> Can somebody help me to understand what's happening?
>

There are only two reasons why your printk is not coming
1. Your printk is not executing.
2. Your driver is not getting installed.
Have you verified both of these points?

>
> Thanks in advance,
>
>
> *--*Airton Ishimori
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150518/34b190a2/attachment.html 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* A flow path for ethernet kernel driver
  2015-05-19  5:48 ` anish singh
@ 2015-05-19  5:53   ` Saket Sinha
  2015-05-19 14:09     ` Airton Ishimori
  2015-05-19 14:08   ` Airton Ishimori
  1 sibling, 1 reply; 7+ messages in thread
From: Saket Sinha @ 2015-05-19  5:53 UTC (permalink / raw)
  To: kernelnewbies

HI ,

   If you want to go further than just the printks, you can setup a
qemu setup and attach gdb to it.
Then you can even set breakpoints to analyze it.

Let me know if you have any issues with the setup.

Regards,
Saket Sinha


On Tue, May 19, 2015 at 11:18 AM, anish singh
<anish198519851985@gmail.com> wrote:
>
>
> On Mon, May 18, 2015 at 12:23 PM, Airton Ishimori <nobumasa.bcc@gmail.com>
> wrote:
>>
>> Hello, everybody,
>>
>> I'm trying to develop a new Ethernet driver (Realtek) for Linux kernel
>> 4.0.2.
>>
>> [    3.612938] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>>
>> As part of my studies, I'm trying to trace the path for functions defined
>> in drivers/net/ethernet/realtek/r8169.c, net/core/dev.c and
>> net/core/dev_ioctl.c. I'm using "printks" for this purpose. For instance,
>> something like:
>>
>> printk("TEST: __dev_set_promiscuity\n");
>>
>> However, I'm not getting what's going on. I can set/unset the promiscuity
>> behaviour via ifconfig command.
>>
>> [  131.330091] device eth0 entered promiscuous mode
>> [  170.619086] device eth0 left promiscuous mode
>>
>> By looking at the dmesg output above, I thought the function that deals
>> with promiscuity was __dev_set_promiscuity() defined in net/core/dev.c,
>> because this function calls a function to print the message above:
>>
>> pr_info("device %s %s promiscuous mode\n", dev->name, dev->flags &
>> IFF_PROMISC ? "entered" : "left");
>>
>> But, when I tried to look for my printk message with dmesg after compiling
>> and running the kernel, I couldn't find it.
>>
>> $ cd linux-4.0.2/
>> $ make net && make modules
>> $ sudo make modules_install && sudo make install
>>
>> Can somebody help me to understand what's happening?
>
>
> There are only two reasons why your printk is not coming
> 1. Your printk is not executing.
> 2. Your driver is not getting installed.
> Have you verified both of these points?
>>
>>
>> Thanks in advance,
>>
>> --
>> Airton Ishimori
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* A flow path for ethernet kernel driver
  2015-05-19  5:48 ` anish singh
  2015-05-19  5:53   ` Saket Sinha
@ 2015-05-19 14:08   ` Airton Ishimori
  1 sibling, 0 replies; 7+ messages in thread
From: Airton Ishimori @ 2015-05-19 14:08 UTC (permalink / raw)
  To: kernelnewbies

Yes, but for some reason (appearently) the object codes were not being
updated or part of the object wasn't being linked to the newest object
code.
So, I thought my printk was not executing and the current module being
executed wasn't the newest one.

In order to speed up the compilation process, I thought I could only
compile the piece of codes that I wanted to.
I was doing *make net** && make modules* after compiling the kernel for the
first time, but when I tried to make the full compilation again by typing *make
&& make modules*,
things went okay. The printk was ok at this time, but I also adjusted the
debug level for getting more debug information as pointed out by Nick and
Rami.

Thanks for replying!.


*--*Airton Ishimori


On Tue, May 19, 2015 at 2:48 AM, anish singh <anish198519851985@gmail.com>
wrote:

>
>
> On Mon, May 18, 2015 at 12:23 PM, Airton Ishimori <nobumasa.bcc@gmail.com>
> wrote:
>
>> Hello, everybody,
>>
>> I'm trying to develop a new Ethernet driver (Realtek) for Linux kernel
>> 4.0.2.
>>
>> [    3.612938] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
>>
>> As part of my studies, I'm trying to trace the path for functions defined
>> in drivers/net/ethernet/realtek/r8169.c, net/core/dev.c and
>> net/core/dev_ioctl.c. I'm using "printks" for this purpose. For
>> instance, something like:
>>
>> printk("TEST: __dev_set_promiscuity\n");
>>
>> However, I'm not getting what's going on. I can set/unset the promiscuity
>> behaviour via ifconfig command.
>>
>> [  131.330091] device eth0 entered promiscuous mode
>> [  170.619086] device eth0 left promiscuous mode
>>
>> By looking at the dmesg output above, I thought the function that deals
>> with promiscuity was __dev_set_promiscuity() defined in net/core/dev.c, because
>> this function calls a function to print the message above:
>>
>> pr_info("device %s %s promiscuous mode\n", dev->name, dev->flags &
>> IFF_PROMISC ? "entered" : "left");
>>
>> But, when I tried to look for my printk message with dmesg after
>> compiling and running the kernel, I couldn't find it.
>>
>> $ cd linux-4.0.2/
>> $ make net && make modules
>> $ sudo make modules_install && sudo make install
>>
>> Can somebody help me to understand what's happening?
>>
>
> There are only two reasons why your printk is not coming
> 1. Your printk is not executing.
> 2. Your driver is not getting installed.
> Have you verified both of these points?
>
>>
>> Thanks in advance,
>>
>>
>> *--*Airton Ishimori
>>
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150519/b92b03e5/attachment-0001.html 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* A flow path for ethernet kernel driver
  2015-05-19  5:53   ` Saket Sinha
@ 2015-05-19 14:09     ` Airton Ishimori
  0 siblings, 0 replies; 7+ messages in thread
From: Airton Ishimori @ 2015-05-19 14:09 UTC (permalink / raw)
  To: kernelnewbies

Hi, Saket,

Thanks for the tip!


*--*Airton Ishimori


On Tue, May 19, 2015 at 2:53 AM, Saket Sinha <saket.sinha89@gmail.com>
wrote:

> HI ,
>
>    If you want to go further than just the printks, you can setup a
> qemu setup and attach gdb to it.
> Then you can even set breakpoints to analyze it.
>
> Let me know if you have any issues with the setup.
>
> Regards,
> Saket Sinha
>
>
> On Tue, May 19, 2015 at 11:18 AM, anish singh
> <anish198519851985@gmail.com> wrote:
> >
> >
> > On Mon, May 18, 2015 at 12:23 PM, Airton Ishimori <
> nobumasa.bcc at gmail.com>
> > wrote:
> >>
> >> Hello, everybody,
> >>
> >> I'm trying to develop a new Ethernet driver (Realtek) for Linux kernel
> >> 4.0.2.
> >>
> >> [    3.612938] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
> >>
> >> As part of my studies, I'm trying to trace the path for functions
> defined
> >> in drivers/net/ethernet/realtek/r8169.c, net/core/dev.c and
> >> net/core/dev_ioctl.c. I'm using "printks" for this purpose. For
> instance,
> >> something like:
> >>
> >> printk("TEST: __dev_set_promiscuity\n");
> >>
> >> However, I'm not getting what's going on. I can set/unset the
> promiscuity
> >> behaviour via ifconfig command.
> >>
> >> [  131.330091] device eth0 entered promiscuous mode
> >> [  170.619086] device eth0 left promiscuous mode
> >>
> >> By looking at the dmesg output above, I thought the function that deals
> >> with promiscuity was __dev_set_promiscuity() defined in net/core/dev.c,
> >> because this function calls a function to print the message above:
> >>
> >> pr_info("device %s %s promiscuous mode\n", dev->name, dev->flags &
> >> IFF_PROMISC ? "entered" : "left");
> >>
> >> But, when I tried to look for my printk message with dmesg after
> compiling
> >> and running the kernel, I couldn't find it.
> >>
> >> $ cd linux-4.0.2/
> >> $ make net && make modules
> >> $ sudo make modules_install && sudo make install
> >>
> >> Can somebody help me to understand what's happening?
> >
> >
> > There are only two reasons why your printk is not coming
> > 1. Your printk is not executing.
> > 2. Your driver is not getting installed.
> > Have you verified both of these points?
> >>
> >>
> >> Thanks in advance,
> >>
> >> --
> >> Airton Ishimori
> >>
> >>
> >> _______________________________________________
> >> Kernelnewbies mailing list
> >> Kernelnewbies at kernelnewbies.org
> >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >>
> >
> >
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150519/a76fe761/attachment.html 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-05-19 14:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18 19:23 A flow path for ethernet kernel driver Airton Ishimori
2015-05-18 20:01 ` Rami Rosen
2015-05-18 23:11   ` Airton Ishimori
2015-05-19  5:48 ` anish singh
2015-05-19  5:53   ` Saket Sinha
2015-05-19 14:09     ` Airton Ishimori
2015-05-19 14:08   ` Airton Ishimori

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.